nixos-install: ensure activation script is always called
The activation script is needed to get the missing files in etc/ created. Needed for container manager like systemd-nspawn.
This commit is contained in:
parent
65792923af
commit
930ac600d2
@ -132,8 +132,9 @@ if [[ -z $noBootLoader ]]; then
|
|||||||
echo "installing the boot loader..."
|
echo "installing the boot loader..."
|
||||||
# Grub needs an mtab.
|
# Grub needs an mtab.
|
||||||
ln -sfn /proc/mounts $mountPoint/etc/mtab
|
ln -sfn /proc/mounts $mountPoint/etc/mtab
|
||||||
NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root "$mountPoint" -- /run/current-system/bin/switch-to-configuration boot
|
export NIXOS_INSTALL_BOOTLOADER=1
|
||||||
fi
|
fi
|
||||||
|
nixos-enter --root "$mountPoint" -- /run/current-system/bin/switch-to-configuration boot
|
||||||
|
|
||||||
# Ask the user to set a root password, but only if the passwd command
|
# Ask the user to set a root password, but only if the passwd command
|
||||||
# exists (i.e. when mutable user accounts are enabled).
|
# exists (i.e. when mutable user accounts are enabled).
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
#!/bin/sh -eux
|
|
||||||
|
|
||||||
mkdir -p "$1"
|
|
||||||
|
|
||||||
ROOT="$(readlink -f $1)"
|
|
||||||
SYSTEM="$(readlink -f ${2:-./result})"
|
|
||||||
|
|
||||||
# create root folders
|
|
||||||
mkdir -p "$ROOT/etc" "$ROOT/boot"
|
|
||||||
|
|
||||||
# install NixOS
|
|
||||||
nix-env --store "$ROOT" \
|
|
||||||
--extra-substituters "auto?trusted=1" \
|
|
||||||
-p "$ROOT/nix/var/nix/profiles/system" --set "$SYSTEM"
|
|
||||||
|
|
||||||
# activate NixOS
|
|
||||||
touch "$ROOT/etc/NIXOS"
|
|
||||||
nixos-enter --root "$ROOT" \
|
|
||||||
-- /run/current-system/bin/switch-to-configuration boot
|
|
@ -17,6 +17,7 @@ import ./make-test.nix (let
|
|||||||
}).config.system.build.toplevel;
|
}).config.system.build.toplevel;
|
||||||
|
|
||||||
containerName = "container";
|
containerName = "container";
|
||||||
|
containerRoot = "/var/lib/machines/${containerName}";
|
||||||
|
|
||||||
in {
|
in {
|
||||||
name = "systemd-machinectl";
|
name = "systemd-machinectl";
|
||||||
@ -39,7 +40,7 @@ in {
|
|||||||
|
|
||||||
$machine->waitForUnit("default.target");
|
$machine->waitForUnit("default.target");
|
||||||
$machine->succeed("mkdir -p ${containerRoot}");
|
$machine->succeed("mkdir -p ${containerRoot}");
|
||||||
$machine->succeed("${./nixos-install-simple} /var/lib/machines/${containerName} ${containerSystem}");
|
$machine->succeed("nixos-install --root ${containerRoot} --system ${containerSystem} --no-channel-copy --no-root-passwd --no-bootloader");
|
||||||
|
|
||||||
$machine->succeed("machinectl start ${containerName}");
|
$machine->succeed("machinectl start ${containerName}");
|
||||||
$machine->waitUntilSucceeds("systemctl -M ${containerName} is-active default.target");
|
$machine->waitUntilSucceeds("systemctl -M ${containerName} is-active default.target");
|
||||||
|
Loading…
Reference in New Issue
Block a user