starship: refactor, move to by-name, etc (#399355)

This commit is contained in:
Weijia Wang
2025-04-18 23:47:18 +02:00
committed by GitHub
2 changed files with 23 additions and 29 deletions
@@ -5,21 +5,20 @@
rustPlatform,
installShellFiles,
cmake,
writableTmpDirAsHomeHook,
git,
nixosTests,
Security,
Foundation,
Cocoa,
buildPackages,
}:
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=";
};
@@ -28,16 +27,7 @@ rustPlatform.buildRustPackage rec {
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) ''
@@ -50,12 +40,17 @@ rustPlatform.buildRustPackage rec {
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=";
@@ -70,15 +65,18 @@ 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; [
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
Br1ght0ne
Frostman
awwpotato
];
mainProgram = "starship";
};
}
})
-4
View File
@@ -13567,10 +13567,6 @@ with pkgs;
version = "4.300";
};
starship = callPackage ../tools/misc/starship {
inherit (darwin.apple_sdk.frameworks) Security Foundation Cocoa;
};
inherit (callPackages ../data/fonts/gdouros { })
aegan
aegyptus