Fix installing the Nixpkgs channel on the installation media

And test that it got installed correctly.
This commit is contained in:
Eelco Dolstra
2018-02-27 19:58:23 +01:00
parent 8c6f9223d0
commit cc2eeef4ab
4 changed files with 18 additions and 7 deletions
@@ -12,6 +12,7 @@ umask 0022
extraBuildFlags=()
mountPoint=/mnt
channelPath=
while [ "$#" -gt 0 ]; do
i="$1"; shift 1
@@ -28,10 +29,12 @@ while [ "$#" -gt 0 ]; do
--root)
mountPoint="$1"; shift 1
;;
--closure)
# FIXME: --closure is a misnomer
--system|--closure)
system="$1"; shift 1
;;
--channel)
channelPath="$1"; shift 1
;;
--no-channel-copy)
noChannelCopy=1
;;
@@ -104,7 +107,9 @@ nix-env --store "$mountPoint" "${extraBuildFlags[@]}" \
# Copy the NixOS/Nixpkgs sources to the target as the initial contents
# of the NixOS channel.
if [[ -z $noChannelCopy ]]; then
channelPath="$(nix-env -p /nix/var/nix/profiles/per-user/root/channels -q nixos --no-name --out-path 2>/dev/null || echo -n "")"
if [[ -z $channelPath ]]; then
channelPath="$(nix-env -p /nix/var/nix/profiles/per-user/root/channels -q nixos --no-name --out-path 2>/dev/null || echo -n "")"
fi
if [[ -n $channelPath ]]; then
echo "copying channel..."
mkdir -p $mountPoint/nix/var/nix/profiles/per-user/root