1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/pkgs/nix-tools/default.nix
2024-11-18 10:43:28 +11:00

50 lines
1.2 KiB
Nix

{ lib
, coreutils
, jq
, git
, substituteAll
, stdenv
, profile ? "/nix/var/nix/profiles/system"
, nixPackage ? "/nix/var/nix/profiles/default"
, systemPath ? "$HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"
}:
let
extraPath = lib.makeBinPath [ nixPackage coreutils jq git ];
writeProgram = name: env: src:
substituteAll ({
inherit name src;
dir = "bin";
isExecutable = true;
meta.mainProgram = name;
} // env);
path = "${extraPath}:${systemPath}";
in
{
darwin-option = writeProgram "darwin-option"
{
inherit path;
inherit (stdenv) shell;
}
./darwin-option.sh;
darwin-rebuild = writeProgram "darwin-rebuild"
{
inherit path profile;
inherit (stdenv) shell;
postInstall = ''
mkdir -p $out/share/zsh/site-functions
cp ${./darwin-rebuild.zsh-completions} $out/share/zsh/site-functions/_darwin-rebuild
'';
}
./darwin-rebuild.sh;
darwin-version = writeProgram "darwin-version"
{
inherit (stdenv) shell;
path = lib.makeBinPath [ jq ];
}
./darwin-version.sh;
}