From bd33b3e756ffe6320e592d83cc5879d0eab68956 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 4 Jun 2008 09:01:54 +0000 Subject: [PATCH] * Build through the Nix daemon if it's running. svn path=/nixos/trunk/; revision=11966 --- installer/nixos-rebuild.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/installer/nixos-rebuild.sh b/installer/nixos-rebuild.sh index 4183741b202b..f36d22c0e4d5 100644 --- a/installer/nixos-rebuild.sh +++ b/installer/nixos-rebuild.sh @@ -29,6 +29,17 @@ NIXPKGS=${NIXPKGS:-$NIXOS/pkgs} NIXOS_CONFIG=${NIXOS_CONFIG:-/etc/nixos/configuration.nix} +# If the Nix daemon is running, then use it. This allows us to use +# the latest Nix from Nixpkgs (below) for expression evaluation, while +# still using the old Nix (via the daemon) for actual store access. +# This matters if the new Nix in Nixpkgs has a schema change. It +# would upgrade the schema, which should only happen once we actually +# switch to the new configuration. +if initctl status nix-daemonn 2>&1 | grep -q ' running'; then + export NIX_REMOTE=${NIX_REMOTE:-daemon} +fi + + # Pull the manifests defined in the configuration (the "manifests" # attribute). Wonderfully hacky. if test "${NIXOS_PULL:-1}" != 0; then