lol

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

authored by

Weijia Wang and committed by
GitHub
1ec85a0d 1e0ba16e

+82 -88
+82
pkgs/by-name/st/starship/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + rustPlatform, 6 + installShellFiles, 7 + cmake, 8 + writableTmpDirAsHomeHook, 9 + git, 10 + nixosTests, 11 + buildPackages, 12 + }: 13 + 14 + rustPlatform.buildRustPackage (finalAttrs: { 15 + pname = "starship"; 16 + version = "1.22.1"; 17 + 18 + src = fetchFromGitHub { 19 + owner = "starship"; 20 + repo = "starship"; 21 + rev = "v${finalAttrs.version}"; 22 + hash = "sha256-YoLi4wxBK9TFTtZRm+2N8HO5ZiC3V2GMqKFKKLHq++s="; 23 + }; 24 + 25 + nativeBuildInputs = [ 26 + installShellFiles 27 + cmake 28 + ]; 29 + 30 + buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ writableTmpDirAsHomeHook ]; 31 + 32 + # tries to access HOME only in aarch64-darwin environment when building mac-notification-sys 33 + preBuild = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) '' 34 + export HOME=$TMPDIR 35 + ''; 36 + 37 + postInstall = 38 + '' 39 + presetdir=$out/share/starship/presets/ 40 + mkdir -p $presetdir 41 + cp docs/public/presets/toml/*.toml $presetdir 42 + '' 43 + + lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ( 44 + let 45 + emulator = stdenv.hostPlatform.emulator buildPackages; 46 + in 47 + '' 48 + installShellCompletion --cmd starship \ 49 + --bash <(${emulator} $out/bin/starship completions bash) \ 50 + --fish <(${emulator} $out/bin/starship completions fish) \ 51 + --zsh <(${emulator} $out/bin/starship completions zsh) 52 + '' 53 + ); 54 + 55 + useFetchCargoVendor = true; 56 + cargoHash = "sha256-B2CCrSH2aTcGEX96oBxl/27hNMdDpdd2vxdt0/nlN6I="; 57 + 58 + nativeCheckInputs = [ git ]; 59 + 60 + preCheck = '' 61 + HOME=$TMPDIR 62 + ''; 63 + 64 + passthru.tests = { 65 + inherit (nixosTests) starship; 66 + }; 67 + 68 + meta = { 69 + description = "Minimal, blazing fast, and extremely customizable prompt for any shell"; 70 + homepage = "https://starship.rs"; 71 + downloadPage = "https://github.com/starship/starship"; 72 + changelog = "https://github.com/starship/starship/releases/tag/v${finalAttrs.version}"; 73 + license = lib.licenses.isc; 74 + maintainers = with lib.maintainers; [ 75 + danth 76 + Br1ght0ne 77 + Frostman 78 + awwpotato 79 + ]; 80 + mainProgram = "starship"; 81 + }; 82 + })
-84
pkgs/tools/misc/starship/default.nix
··· 1 - { 2 - lib, 3 - stdenv, 4 - fetchFromGitHub, 5 - rustPlatform, 6 - installShellFiles, 7 - cmake, 8 - git, 9 - nixosTests, 10 - Security, 11 - Foundation, 12 - Cocoa, 13 - }: 14 - 15 - rustPlatform.buildRustPackage rec { 16 - pname = "starship"; 17 - version = "1.22.1"; 18 - 19 - src = fetchFromGitHub { 20 - owner = "starship"; 21 - repo = "starship"; 22 - rev = "v${version}"; 23 - hash = "sha256-YoLi4wxBK9TFTtZRm+2N8HO5ZiC3V2GMqKFKKLHq++s="; 24 - }; 25 - 26 - nativeBuildInputs = [ 27 - installShellFiles 28 - cmake 29 - ]; 30 - 31 - buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ 32 - Security 33 - Foundation 34 - Cocoa 35 - ]; 36 - 37 - NIX_LDFLAGS = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ 38 - "-framework" 39 - "AppKit" 40 - ]; 41 - 42 - # tries to access HOME only in aarch64-darwin environment when building mac-notification-sys 43 - preBuild = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) '' 44 - export HOME=$TMPDIR 45 - ''; 46 - 47 - postInstall = 48 - '' 49 - presetdir=$out/share/starship/presets/ 50 - mkdir -p $presetdir 51 - cp docs/public/presets/toml/*.toml $presetdir 52 - '' 53 - + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 54 - installShellCompletion --cmd starship \ 55 - --bash <($out/bin/starship completions bash) \ 56 - --fish <($out/bin/starship completions fish) \ 57 - --zsh <($out/bin/starship completions zsh) 58 - ''; 59 - 60 - useFetchCargoVendor = true; 61 - cargoHash = "sha256-B2CCrSH2aTcGEX96oBxl/27hNMdDpdd2vxdt0/nlN6I="; 62 - 63 - nativeCheckInputs = [ git ]; 64 - 65 - preCheck = '' 66 - HOME=$TMPDIR 67 - ''; 68 - 69 - passthru.tests = { 70 - inherit (nixosTests) starship; 71 - }; 72 - 73 - meta = with lib; { 74 - description = "Minimal, blazing fast, and extremely customizable prompt for any shell"; 75 - homepage = "https://starship.rs"; 76 - license = licenses.isc; 77 - maintainers = with maintainers; [ 78 - danth 79 - Br1ght0ne 80 - Frostman 81 - ]; 82 - mainProgram = "starship"; 83 - }; 84 - }
-4
pkgs/top-level/all-packages.nix
··· 13567 13567 version = "4.300"; 13568 13568 }; 13569 13569 13570 - starship = callPackage ../tools/misc/starship { 13571 - inherit (darwin.apple_sdk.frameworks) Security Foundation Cocoa; 13572 - }; 13573 - 13574 13570 inherit (callPackages ../data/fonts/gdouros { }) 13575 13571 aegan 13576 13572 aegyptus