From 4bb7bc77c98e4ddd355785b4875e4ac484383e62 Mon Sep 17 00:00:00 2001 From: Dimitar Nestorov <8790386+dimitarnestorov@users.noreply.github.com> Date: Sat, 21 Dec 2024 13:37:45 +0200 Subject: [PATCH] swiftformat: 0.47.10 -> 0.55.4 --- pkgs/by-name/sw/swiftformat/package.nix | 55 +++++++++++++------------ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/pkgs/by-name/sw/swiftformat/package.nix b/pkgs/by-name/sw/swiftformat/package.nix index 3ff1ce98ffc8..fa4c303ae66a 100644 --- a/pkgs/by-name/sw/swiftformat/package.nix +++ b/pkgs/by-name/sw/swiftformat/package.nix @@ -2,48 +2,51 @@ stdenv, lib, fetchFromGitHub, + swift, + swiftformat, + swiftpm, + testers, + versionCheckHook, + nix-update-script, }: -# This derivation is impure: it relies on an Xcode toolchain being installed -# and available in the expected place. The values of sandboxProfile and -# hydraPlatforms are copied pretty directly from the MacVim derivation, which -# is also impure. - -stdenv.mkDerivation rec { +swift.stdenv.mkDerivation rec { pname = "swiftformat"; - version = "0.47.10"; + version = "0.55.4"; src = fetchFromGitHub { owner = "nicklockwood"; repo = "SwiftFormat"; rev = version; - sha256 = "1gqxpymbhpmap0i2blg9akarlql4mkzv45l4i212gsxcs991b939"; + sha256 = "sha256-0Dk2SgfPozgbdhyQa74NZkd/kA6JleSfpHDn4NuQdEo="; }; - preConfigure = "LD=$CC"; - - buildPhase = '' - /usr/bin/xcodebuild -project SwiftFormat.xcodeproj \ - -scheme "SwiftFormat (Command Line Tool)" \ - CODE_SIGN_IDENTITY= SYMROOT=build OBJROOT=build - ''; + nativeBuildInputs = [ + swift + swiftpm + ]; installPhase = '' - install -D -m 0555 build/Release/swiftformat $out/bin/swiftformat + install -D "$(swiftpmBinPath)/swiftformat" $out/bin/swiftformat ''; - sandboxProfile = '' - (allow file-read* file-write* process-exec mach-lookup) - ; block homebrew dependencies - (deny file-read* file-write* process-exec mach-lookup (subpath "/usr/local") (with no-log)) - ''; + nativeInstallCheckInputs = [ + versionCheckHook + ]; + doInstallCheck = true; - meta = with lib; { + passthru = { + updateScript = nix-update-script { }; + }; + + meta = { description = "Code formatting and linting tool for Swift"; homepage = "https://github.com/nicklockwood/SwiftFormat"; - license = licenses.mit; - maintainers = [ maintainers.bdesham ]; - platforms = platforms.darwin; - hydraPlatforms = [ ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + bdesham + DimitarNestorov + ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; }; }