2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-10-07 09:15:18 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
|
|
|
, installShellFiles
|
2022-08-21 13:32:41 +00:00
|
|
|
, cmake
|
2023-01-20 10:41:00 +00:00
|
|
|
, git
|
2022-01-13 20:06:32 +00:00
|
|
|
, nixosTests
|
2020-10-07 09:15:18 +00:00
|
|
|
, Security
|
2022-02-20 05:27:41 +00:00
|
|
|
, Foundation
|
2022-04-15 01:41:22 +00:00
|
|
|
, Cocoa
|
2020-10-07 09:15:18 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "starship";
|
2024-07-31 10:19:44 +00:00
|
|
|
version = "1.20.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "starship";
|
2024-04-21 15:54:59 +00:00
|
|
|
repo = "starship";
|
2022-04-27 09:35:20 +00:00
|
|
|
rev = "v${version}";
|
2024-07-31 10:19:44 +00:00
|
|
|
hash = "sha256-Y7jX0XXrSMEex1HG0o69Q1rTtnFL0UuIEgfa1e7D1Nc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles cmake ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ Security Foundation Cocoa ];
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
NIX_LDFLAGS = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ "-framework" "AppKit" ];
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
# tries to access HOME only in aarch64-darwin environment when building mac-notification-sys
|
|
|
|
preBuild = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
'';
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
postInstall = ''
|
2024-09-19 14:19:46 +00:00
|
|
|
presetdir=$out/share/starship/presets/
|
|
|
|
mkdir -p $presetdir
|
|
|
|
cp docs/public/presets/toml/*.toml $presetdir
|
|
|
|
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
2022-08-21 13:32:41 +00:00
|
|
|
installShellCompletion --cmd starship \
|
|
|
|
--bash <($out/bin/starship completions bash) \
|
|
|
|
--fish <($out/bin/starship completions fish) \
|
|
|
|
--zsh <($out/bin/starship completions zsh)
|
2020-07-18 16:06:22 +00:00
|
|
|
'';
|
|
|
|
|
2024-07-31 10:19:44 +00:00
|
|
|
cargoHash = "sha256-yJ32HFaRpujJ9mQa+07b5cQcl1ATO/56dpm1IeKcbzs=";
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ git ];
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
preCheck = ''
|
|
|
|
HOME=$TMPDIR
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) starship;
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Minimal, blazing fast, and extremely customizable prompt for any shell";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://starship.rs";
|
|
|
|
license = licenses.isc;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ danth davidtwco Br1ght0ne Frostman ];
|
2023-08-10 07:59:29 +00:00
|
|
|
mainProgram = "starship";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|