1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-28 02:27:44 +00:00

Use a WIP branch of starship for jj

This commit is contained in:
RGBCube 2025-01-18 20:39:18 +03:00
parent 6b2a6bb4ad
commit 8ae633a5e4

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }: let { config, lib, pkgs, ... }: let
inherit (lib) enabled filter first foldl' getExe last match mkIf nameValuePair optionalAttrs readFile removeAttrs splitString; inherit (lib) enabled const filter first foldl' getExe last match mkIf nameValuePair optionalAttrs readFile removeAttrs splitString;
in { in {
users = optionalAttrs config.isLinux { defaultUserShell = pkgs.nushell; }; users = optionalAttrs config.isLinux { defaultUserShell = pkgs.nushell; };
@ -43,11 +43,111 @@ in {
programs.starship = enabled { programs.starship = enabled {
# No because we are doing it at build time instead of the way # No because we are doing it at build time instead of the way
# this retarded does it. Why the hell do you generate the config # this retarded module does it. Why the hell do you generate
# every time the shell is launched? # the config every time the shell is launched?
enableNushellIntegration = false; enableNushellIntegration = false;
# package = pkgs.starship.overrideAttrs (const {
# src = pkgs.fetchFromGitHub {
# owner = "poliorcetics";
# repo = "starship";
# rev = "19926e1e0aa25eddf63f93ba270d60eef023338f";
# hash = "sha256-mi2O8JzXNLIF0/GuXVyf27JVV7d6zoskIjB29r5fPso=";
# };
# cargoHash = "sha256-sOjCkRHknc0SWNEItEvD6ajk/5W2kfbD1bw8T+wzGeU=";
# });
package = pkgs.callPackage ({
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
installShellFiles,
cmake,
git,
nixosTests,
Security,
Foundation,
Cocoa,
}:
rustPlatform.buildRustPackage {
pname = "starship";
version = "1.22.1";
src = pkgs.fetchFromGitHub {
owner = "poliorcetics";
repo = "starship";
rev = "19926e1e0aa25eddf63f93ba270d60eef023338f";
hash = "sha256-mi2O8JzXNLIF0/GuXVyf27JVV7d6zoskIjB29r5fPso=";
};
nativeBuildInputs = [
installShellFiles
cmake
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
Security
Foundation
Cocoa
];
NIX_LDFLAGS = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
"-framework"
"AppKit"
];
# tries to access HOME only in aarch64-darwin environment when building mac-notification-sys
preBuild = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) ''
export HOME=$TMPDIR
'';
postInstall =
''
presetdir=$out/share/starship/presets/
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)
'';
cargoHash = "sha256-sOjCkRHknc0SWNEItEvD6ajk/5W2kfbD1bw8T+wzGeU=";
nativeCheckInputs = [ git ];
preCheck = ''
HOME=$TMPDIR
'';
passthru.tests = {
inherit (nixosTests) starship;
};
meta = with lib; {
description = "Minimal, blazing fast, and extremely customizable prompt for any shell";
homepage = "https://starship.rs";
license = licenses.isc;
maintainers = with maintainers; [
danth
davidtwco
Br1ght0ne
Frostman
];
mainProgram = "starship";
};
}) {
inherit (pkgs.darwin.apple_sdk.frameworks) Security Foundation Cocoa;
};
settings = { settings = {
vcs.disabled = false;
command_timeout = 100; command_timeout = 100;
scan_timeout = 20; scan_timeout = 20;