Fix installing the Nixpkgs channel on the installation media
And test that it got installed correctly.
This commit is contained in:
parent
8c6f9223d0
commit
cc2eeef4ab
@ -26,8 +26,8 @@
|
|||||||
<replaceable>root</replaceable>
|
<replaceable>root</replaceable>
|
||||||
</arg>
|
</arg>
|
||||||
<arg>
|
<arg>
|
||||||
<arg choice='plain'><option>--closure</option></arg>
|
<arg choice='plain'><option>--system</option></arg>
|
||||||
<replaceable>closure</replaceable>
|
<replaceable>path</replaceable>
|
||||||
</arg>
|
</arg>
|
||||||
<arg>
|
<arg>
|
||||||
<arg choice='plain'><option>--no-channel-copy</option></arg>
|
<arg choice='plain'><option>--no-channel-copy</option></arg>
|
||||||
@ -118,7 +118,7 @@ it.</para>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--closure</option></term>
|
<term><option>--system</option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>If this option is provided, <command>nixos-install</command> will install the specified closure
|
<para>If this option is provided, <command>nixos-install</command> will install the specified closure
|
||||||
rather than attempt to build one from <filename>/mnt/etc/nixos/configuration.nix</filename>.</para>
|
rather than attempt to build one from <filename>/mnt/etc/nixos/configuration.nix</filename>.</para>
|
||||||
|
@ -181,7 +181,8 @@ let format' = format; in let
|
|||||||
nix-store --load-db < ${closureInfo}/registration
|
nix-store --load-db < ${closureInfo}/registration
|
||||||
|
|
||||||
echo "running nixos-install..."
|
echo "running nixos-install..."
|
||||||
nixos-install --root $root --no-bootloader --no-root-passwd --closure ${config.system.build.toplevel} --substituters ""
|
nixos-install --root $root --no-bootloader --no-root-passwd \
|
||||||
|
--system ${config.system.build.toplevel} --channel ${channelSources} --substituters ""
|
||||||
|
|
||||||
echo "copying staging root to image..."
|
echo "copying staging root to image..."
|
||||||
cptofs -p ${optionalString (partitionTableType != "none") "-P ${rootPartition}"} -t ${fsType} -i $diskImage $root/* /
|
cptofs -p ${optionalString (partitionTableType != "none") "-P ${rootPartition}"} -t ${fsType} -i $diskImage $root/* /
|
||||||
|
@ -12,6 +12,7 @@ umask 0022
|
|||||||
extraBuildFlags=()
|
extraBuildFlags=()
|
||||||
|
|
||||||
mountPoint=/mnt
|
mountPoint=/mnt
|
||||||
|
channelPath=
|
||||||
|
|
||||||
while [ "$#" -gt 0 ]; do
|
while [ "$#" -gt 0 ]; do
|
||||||
i="$1"; shift 1
|
i="$1"; shift 1
|
||||||
@ -28,10 +29,12 @@ while [ "$#" -gt 0 ]; do
|
|||||||
--root)
|
--root)
|
||||||
mountPoint="$1"; shift 1
|
mountPoint="$1"; shift 1
|
||||||
;;
|
;;
|
||||||
--closure)
|
--system|--closure)
|
||||||
# FIXME: --closure is a misnomer
|
|
||||||
system="$1"; shift 1
|
system="$1"; shift 1
|
||||||
;;
|
;;
|
||||||
|
--channel)
|
||||||
|
channelPath="$1"; shift 1
|
||||||
|
;;
|
||||||
--no-channel-copy)
|
--no-channel-copy)
|
||||||
noChannelCopy=1
|
noChannelCopy=1
|
||||||
;;
|
;;
|
||||||
@ -104,7 +107,9 @@ nix-env --store "$mountPoint" "${extraBuildFlags[@]}" \
|
|||||||
# Copy the NixOS/Nixpkgs sources to the target as the initial contents
|
# Copy the NixOS/Nixpkgs sources to the target as the initial contents
|
||||||
# of the NixOS channel.
|
# of the NixOS channel.
|
||||||
if [[ -z $noChannelCopy ]]; then
|
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
|
if [[ -n $channelPath ]]; then
|
||||||
echo "copying channel..."
|
echo "copying channel..."
|
||||||
mkdir -p $mountPoint/nix/var/nix/profiles/per-user/root
|
mkdir -p $mountPoint/nix/var/nix/profiles/per-user/root
|
||||||
|
@ -25,6 +25,11 @@ let
|
|||||||
$machine->start;
|
$machine->start;
|
||||||
$machine->waitForUnit("multi-user.target");
|
$machine->waitForUnit("multi-user.target");
|
||||||
$machine->succeed("nix verify -r --no-trust /run/current-system");
|
$machine->succeed("nix verify -r --no-trust /run/current-system");
|
||||||
|
|
||||||
|
# Test whether the channel got installed correctly.
|
||||||
|
$machine->succeed("nix-instantiate --dry-run '<nixpkgs>' -A hello");
|
||||||
|
$machine->succeed("nix-env --dry-run -iA nixos.procps");
|
||||||
|
|
||||||
$machine->shutdown;
|
$machine->shutdown;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user