Ensure nix channels are functioning
This commit is contained in:
parent
bb441b38d0
commit
229ad0b149
1 changed files with 7 additions and 3 deletions
|
@ -3,10 +3,14 @@ begin
|
||||||
set -l config "$dir/config.fish"
|
set -l config "$dir/config.fish"
|
||||||
set nixPkgsDir "/nix/var/nix/profiles/per-user/root/channels/nixpkgs"
|
set nixPkgsDir "/nix/var/nix/profiles/per-user/root/channels/nixpkgs"
|
||||||
|
|
||||||
|
function __isNixModule -a path
|
||||||
|
nix-instantiate --eval --expr "{ path }: import path" --argstr path "$path" &>/dev/null
|
||||||
|
end
|
||||||
|
|
||||||
function downloadNixPkgs -V config
|
function downloadNixPkgs -V config
|
||||||
source "$config"
|
source "$config"
|
||||||
|
|
||||||
if [ ! -d "$nixPkgsCache" ]
|
if ! __isNixModule "$nixPkgsCache"
|
||||||
mkdir -p "$nixPkgsCache"
|
mkdir -p "$nixPkgsCache"
|
||||||
and git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b "$nixPkgsVersion" "$nixPkgsCache"
|
and git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b "$nixPkgsVersion" "$nixPkgsCache"
|
||||||
and rm -rf "$nixPkgsCache/.git"
|
and rm -rf "$nixPkgsCache/.git"
|
||||||
|
@ -16,8 +20,8 @@ begin
|
||||||
function installNixPkgs -V config -V nixPkgsDir
|
function installNixPkgs -V config -V nixPkgsDir
|
||||||
source "$config"
|
source "$config"
|
||||||
|
|
||||||
if [ ! -d "$nixPkgsDir" ]
|
if ! __isNixModule "$nixPkgsDir"
|
||||||
if [ ! -d "$nixPkgsCache" ]
|
if ! __isNixModule "$nixPkgsCache"
|
||||||
downloadNixPkgs
|
downloadNixPkgs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue