2024-11-01 13:13:41 +00:00
|
|
|
begin
|
|
|
|
set -l dir (status dirname)
|
|
|
|
set -l config "$dir/config.fish"
|
|
|
|
set nixPkgsDir "/nix/var/nix/profiles/per-user/root/channels/nixpkgs"
|
|
|
|
|
|
|
|
function downloadNixPkgs -V config
|
|
|
|
source "$config"
|
|
|
|
|
|
|
|
if [ ! -d "$nixPkgsCache" ]
|
|
|
|
mkdir -p "$nixPkgsCache"
|
|
|
|
and git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b "$nixPkgsVersion" "$nixPkgsCache"
|
|
|
|
and rm -rf "$nixPkgsCache/.git"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function installNixPkgs -V config -V nixPkgsDir
|
|
|
|
source "$config"
|
2024-11-02 23:39:23 +00:00
|
|
|
|
2024-11-03 21:37:33 +00:00
|
|
|
if [ ! -d "$nixPkgsDir" ]
|
|
|
|
if [ ! -d "$nixPkgsCache" ]
|
|
|
|
downloadNixPkgs
|
|
|
|
end
|
|
|
|
|
2024-11-03 21:37:22 +00:00
|
|
|
sudo mkdir -p "$nixPkgsDir"
|
|
|
|
sudo cp -r "$nixPkgsCache"/* "$nixPkgsDir"
|
2024-11-02 23:39:23 +00:00
|
|
|
end
|
2024-11-01 13:13:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function uninstallNixPkgs -V nixPkgsDir
|
2024-11-03 21:37:22 +00:00
|
|
|
sudo rm -rf (dirname "$nixPkgsDir")
|
2024-11-01 13:13:41 +00:00
|
|
|
end
|
|
|
|
end
|