2023-06-20 12:54:31 +00:00
|
|
|
{ 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"
|
|
|
|
}:
|
2023-06-09 14:23:02 +00:00
|
|
|
|
|
|
|
let
|
2023-06-20 12:54:31 +00:00
|
|
|
extraPath = lib.makeBinPath [ nixPackage coreutils jq git ];
|
|
|
|
|
|
|
|
writeProgram = name: env: src:
|
|
|
|
substituteAll ({
|
|
|
|
inherit name src;
|
|
|
|
dir = "bin";
|
|
|
|
isExecutable = true;
|
2024-11-16 10:53:32 +00:00
|
|
|
meta.mainProgram = name;
|
2023-06-20 12:54:31 +00:00
|
|
|
} // 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;
|
2024-01-28 03:33:54 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/zsh/site-functions
|
|
|
|
cp ${./darwin-rebuild.zsh-completions} $out/share/zsh/site-functions/_darwin-rebuild
|
|
|
|
'';
|
2023-06-20 12:54:31 +00:00
|
|
|
}
|
|
|
|
./darwin-rebuild.sh;
|
2023-07-01 15:11:16 +00:00
|
|
|
|
|
|
|
darwin-version = writeProgram "darwin-version"
|
|
|
|
{
|
|
|
|
inherit (stdenv) shell;
|
|
|
|
path = lib.makeBinPath [ jq ];
|
|
|
|
}
|
|
|
|
./darwin-version.sh;
|
2023-06-09 14:23:02 +00:00
|
|
|
}
|