From 930ac600d2b3f18fcfd41c387835332cfb480462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6gler?= Date: Fri, 23 Aug 2019 20:53:57 +0200 Subject: [PATCH] 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. --- .../modules/installer/tools/nixos-install.sh | 3 ++- nixos/tests/nixos-install-simple | 19 ------------------- nixos/tests/systemd-machinectl.nix | 3 ++- 3 files changed, 4 insertions(+), 21 deletions(-) delete mode 100755 nixos/tests/nixos-install-simple diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh index 8685cb345e1..be3b5c0687a 100644 --- a/nixos/modules/installer/tools/nixos-install.sh +++ b/nixos/modules/installer/tools/nixos-install.sh @@ -132,8 +132,9 @@ if [[ -z $noBootLoader ]]; then echo "installing the boot loader..." # Grub needs an 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 +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 # exists (i.e. when mutable user accounts are enabled). diff --git a/nixos/tests/nixos-install-simple b/nixos/tests/nixos-install-simple deleted file mode 100755 index c6044eeffb1..00000000000 --- a/nixos/tests/nixos-install-simple +++ /dev/null @@ -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 diff --git a/nixos/tests/systemd-machinectl.nix b/nixos/tests/systemd-machinectl.nix index f28941bca5a..3438722e321 100644 --- a/nixos/tests/systemd-machinectl.nix +++ b/nixos/tests/systemd-machinectl.nix @@ -17,6 +17,7 @@ import ./make-test.nix (let }).config.system.build.toplevel; containerName = "container"; + containerRoot = "/var/lib/machines/${containerName}"; in { name = "systemd-machinectl"; @@ -39,7 +40,7 @@ in { $machine->waitForUnit("default.target"); $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->waitUntilSucceeds("systemctl -M ${containerName} is-active default.target");