From 9bf75a27f46f6b330b02ce25ac34d4d2ede3ba4a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 7 May 2020 12:38:12 +0200 Subject: [PATCH 1/3] Revert "nix-daemon.nix: Use 'nix ping-store' to initialize directories" This reverts commits 9d0de0dc57ce97ab9cc3d73a66e914d718e4af3b, 27d2857a9927aa197b9679b9a2dcf59b97c06907. 'nix ping-store' is an experimental command so it doesn't work in Nix 2.4 unless you set 'experimental-features = nix-command' in nix.conf. --- nixos/modules/services/misc/nix-daemon.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index b28e3679d1c..2577cb78e96 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -510,8 +510,7 @@ in system.activationScripts.nix = stringAfter [ "etc" "users" ] '' - # Create directories in /nix. - ${nix}/bin/nix ping-store --no-net + install -m 0755 -d /nix/var/nix/{gcroots,profiles}/per-user # Subscribe the root user to the NixOS channel by default. if [ ! -e "/root/.nix-channels" ]; then From ecdb5c4320c6897484f6f11ee05b2eaca3382cd2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 7 May 2020 13:12:29 +0200 Subject: [PATCH 2/3] nixos-install: 'nix build' -> nix-build 'nix build' is an experimental command so we shouldn't use it yet. (nixos-rebuild also uses 'nix', but only when using flakes, which are themselves an experimental feature.) --- nixos/doc/manual/man-nixos-install.xml | 16 ---------------- nixos/modules/installer/tools/nixos-install.sh | 8 ++------ 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/nixos/doc/manual/man-nixos-install.xml b/nixos/doc/manual/man-nixos-install.xml index 9255ce763ef..84849282e9a 100644 --- a/nixos/doc/manual/man-nixos-install.xml +++ b/nixos/doc/manual/man-nixos-install.xml @@ -24,16 +24,6 @@ - - - - - - - - - - @@ -178,12 +168,6 @@ Please note that this option may be specified repeatedly. - - / - - Print the full build logs of nix build to stderr. - - diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh index a3ff3fe2c0c..6e1d56af2ae 100644 --- a/nixos/modules/installer/tools/nixos-install.sh +++ b/nixos/modules/installer/tools/nixos-install.sh @@ -15,7 +15,6 @@ mountPoint=/mnt channelPath= system= verbosity=() -buildLogs= while [ "$#" -gt 0 ]; do i="$1"; shift 1 @@ -60,9 +59,6 @@ while [ "$#" -gt 0 ]; do -v*|--verbose) verbosity+=("$i") ;; - -L|--print-build-logs) - buildLogs="$i" - ;; *) echo "$0: unknown option \`$i'" exit 1 @@ -100,9 +96,9 @@ sub="auto?trusted=1" if [[ -z $system ]]; then echo "building the configuration in $NIXOS_CONFIG..." outLink="$tmpdir/system" - nix build --out-link "$outLink" --store "$mountPoint" "${extraBuildFlags[@]}" \ + nix-build --out-link "$outLink" --store "$mountPoint" "${extraBuildFlags[@]}" \ --extra-substituters "$sub" \ - -f '' system -I "nixos-config=$NIXOS_CONFIG" ${verbosity[@]} ${buildLogs} + '' -A system -I "nixos-config=$NIXOS_CONFIG" ${verbosity[@]} system=$(readlink -f $outLink) fi From 78f2a830291eb19af6306476b186b585f4d9cd37 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 7 May 2020 15:20:34 +0200 Subject: [PATCH 3/3] test-driver.py: Fix deadlock when the log queue gets full If a program (e.g. nixos-install) writes more than 1000 lines to stderr during execute(), then process_serial_output() deadlocks waiting for the queue to be processed. So use an unbounded queue instead. We should probably get rid of the structured log output (log.xml), since then we don't need the log queue anymore. --- nixos/lib/test-driver/test-driver.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py index d96600b3c99..84661a4a758 100644 --- a/nixos/lib/test-driver/test-driver.py +++ b/nixos/lib/test-driver/test-driver.py @@ -143,7 +143,7 @@ class Logger: self.logfile = os.environ.get("LOGFILE", "/dev/null") self.logfile_handle = codecs.open(self.logfile, "wb") self.xml = XMLGenerator(self.logfile_handle, encoding="utf-8") - self.queue: "Queue[Dict[str, str]]" = Queue(1000) + self.queue: "Queue[Dict[str, str]]" = Queue() self.xml.startDocument() self.xml.startElement("logfile", attrs={}) @@ -391,11 +391,11 @@ class Machine: def execute(self, command: str) -> Tuple[int, str]: self.connect() - out_command = "( {} ); echo '|!EOF' $?\n".format(command) + out_command = "( {} ); echo '|!=EOF' $?\n".format(command) self.shell.send(out_command.encode()) output = "" - status_code_pattern = re.compile(r"(.*)\|\!EOF\s+(\d+)") + status_code_pattern = re.compile(r"(.*)\|\!=EOF\s+(\d+)") while True: chunk = self.shell.recv(4096).decode(errors="ignore")