From d1b988602f749e8413c64b557abe23c53f2c7139 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Wed, 16 Apr 2025 18:17:31 -0700 Subject: [PATCH 1/6] starship: migrate to finalAttrs, remove with lib --- pkgs/tools/misc/starship/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/misc/starship/default.nix b/pkgs/tools/misc/starship/default.nix index 094be04ce9a3..f9ec9bbc17ff 100644 --- a/pkgs/tools/misc/starship/default.nix +++ b/pkgs/tools/misc/starship/default.nix @@ -12,14 +12,14 @@ Cocoa, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "starship"; version = "1.22.1"; src = fetchFromGitHub { owner = "starship"; repo = "starship"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-YoLi4wxBK9TFTtZRm+2N8HO5ZiC3V2GMqKFKKLHq++s="; }; @@ -70,15 +70,15 @@ rustPlatform.buildRustPackage rec { inherit (nixosTests) starship; }; - meta = with lib; { + meta = { description = "Minimal, blazing fast, and extremely customizable prompt for any shell"; homepage = "https://starship.rs"; - license = licenses.isc; - maintainers = with maintainers; [ + license = lib.licenses.isc; + maintainers = with lib.maintainers; [ danth Br1ght0ne Frostman ]; mainProgram = "starship"; }; -} +}) From 2e5c1ceaf21b0208331ecebb950096409178d6e9 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Wed, 16 Apr 2025 18:18:07 -0700 Subject: [PATCH 2/6] starship: add downloadPage and changelog --- pkgs/tools/misc/starship/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/tools/misc/starship/default.nix b/pkgs/tools/misc/starship/default.nix index f9ec9bbc17ff..152b51df10c1 100644 --- a/pkgs/tools/misc/starship/default.nix +++ b/pkgs/tools/misc/starship/default.nix @@ -73,6 +73,8 @@ rustPlatform.buildRustPackage (finalAttrs: { meta = { description = "Minimal, blazing fast, and extremely customizable prompt for any shell"; homepage = "https://starship.rs"; + downloadPage = "https://github.com/starship/starship"; + changelog = "https://github.com/starship/starship/releases/tag/v${finalAttrs.version}"; license = lib.licenses.isc; maintainers = with lib.maintainers; [ danth From 8a06f7a8d0984b0f82aa2fe3746c96fccca715e7 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Wed, 16 Apr 2025 18:19:39 -0700 Subject: [PATCH 3/6] starship: emulate shell completions see https://nixos.org/manual/nixpkgs/unstable/#installshellfiles-installshellcompletion --- pkgs/tools/misc/starship/default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/misc/starship/default.nix b/pkgs/tools/misc/starship/default.nix index 152b51df10c1..dc1affff975b 100644 --- a/pkgs/tools/misc/starship/default.nix +++ b/pkgs/tools/misc/starship/default.nix @@ -10,6 +10,7 @@ Security, Foundation, Cocoa, + buildPackages, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -50,12 +51,17 @@ rustPlatform.buildRustPackage (finalAttrs: { mkdir -p $presetdir cp docs/public/presets/toml/*.toml $presetdir '' - + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' - installShellCompletion --cmd starship \ - --bash <($out/bin/starship completions bash) \ - --fish <($out/bin/starship completions fish) \ - --zsh <($out/bin/starship completions zsh) - ''; + + lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ( + let + emulator = stdenv.hostPlatform.emulator buildPackages; + in + '' + installShellCompletion --cmd starship \ + --bash <(${emulator} $out/bin/starship completions bash) \ + --fish <(${emulator} $out/bin/starship completions fish) \ + --zsh <(${emulator} $out/bin/starship completions zsh) + '' + ); useFetchCargoVendor = true; cargoHash = "sha256-B2CCrSH2aTcGEX96oBxl/27hNMdDpdd2vxdt0/nlN6I="; From 38ec78315b716e247b72f4f4140a157df856cefb Mon Sep 17 00:00:00 2001 From: awwpotato Date: Wed, 16 Apr 2025 18:45:04 -0700 Subject: [PATCH 4/6] starship: remove darwin sdks --- pkgs/tools/misc/starship/default.nix | 15 ++------------- pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/pkgs/tools/misc/starship/default.nix b/pkgs/tools/misc/starship/default.nix index dc1affff975b..efbc1d3e1b14 100644 --- a/pkgs/tools/misc/starship/default.nix +++ b/pkgs/tools/misc/starship/default.nix @@ -5,11 +5,9 @@ rustPlatform, installShellFiles, cmake, + writableTmpDirAsHomeHook, git, nixosTests, - Security, - Foundation, - Cocoa, buildPackages, }: @@ -29,16 +27,7 @@ rustPlatform.buildRustPackage (finalAttrs: { cmake ]; - buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ - Security - Foundation - Cocoa - ]; - - NIX_LDFLAGS = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ - "-framework" - "AppKit" - ]; + buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ writableTmpDirAsHomeHook ]; # tries to access HOME only in aarch64-darwin environment when building mac-notification-sys preBuild = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index edb35316c35e..e3ddeaad01e1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13609,9 +13609,7 @@ with pkgs; version = "4.300"; }; - starship = callPackage ../tools/misc/starship { - inherit (darwin.apple_sdk.frameworks) Security Foundation Cocoa; - }; + starship = callPackage ../tools/misc/starship { }; inherit (callPackages ../data/fonts/gdouros { }) aegan From b4d2ebf2cada2707c72e2cc74225e46d5cc087d5 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Wed, 16 Apr 2025 18:48:11 -0700 Subject: [PATCH 5/6] starship: migrate to by-name --- .../starship/default.nix => by-name/st/starship/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{tools/misc/starship/default.nix => by-name/st/starship/package.nix} (100%) diff --git a/pkgs/tools/misc/starship/default.nix b/pkgs/by-name/st/starship/package.nix similarity index 100% rename from pkgs/tools/misc/starship/default.nix rename to pkgs/by-name/st/starship/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e3ddeaad01e1..cda25ad49123 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13609,8 +13609,6 @@ with pkgs; version = "4.300"; }; - starship = callPackage ../tools/misc/starship { }; - inherit (callPackages ../data/fonts/gdouros { }) aegan aegyptus From d541468dfd1de1d229bc98c599e5c668f9316821 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Wed, 16 Apr 2025 21:29:54 -0700 Subject: [PATCH 6/6] starship: add awwpotato as a maintainer --- pkgs/by-name/st/starship/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/st/starship/package.nix b/pkgs/by-name/st/starship/package.nix index efbc1d3e1b14..22feec90455b 100644 --- a/pkgs/by-name/st/starship/package.nix +++ b/pkgs/by-name/st/starship/package.nix @@ -75,6 +75,7 @@ rustPlatform.buildRustPackage (finalAttrs: { danth Br1ght0ne Frostman + awwpotato ]; mainProgram = "starship"; };