summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-02-28 10:06:27 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-02-28 10:08:42 +0100
commitf8516a0717569f496653821d5fa286da59854550 (patch)
treeea6164a78fceb85f840c0b7a95e6bf410c7d2254 /nixos
parent3c84ae406d80ba01f96a6da27de954b61f0e735b (diff)
downloadnixlib-f8516a0717569f496653821d5fa286da59854550.tar
nixlib-f8516a0717569f496653821d5fa286da59854550.tar.gz
nixlib-f8516a0717569f496653821d5fa286da59854550.tar.bz2
nixlib-f8516a0717569f496653821d5fa286da59854550.tar.lz
nixlib-f8516a0717569f496653821d5fa286da59854550.tar.xz
nixlib-f8516a0717569f496653821d5fa286da59854550.tar.zst
nixlib-f8516a0717569f496653821d5fa286da59854550.zip
nixos copySystemConfiguration: fix when chrooted
Fixes #7974. Also makes the description more informative.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/activation/top-level.nix11
1 files changed, 7 insertions, 4 deletions
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index d66580b7b9be..2d1b0ffb54ce 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -178,9 +178,10 @@ in
       default = false;
       description = ''
         If enabled, copies the NixOS configuration file
-        <literal>$NIXOS_CONFIG</literal> (usually
-        <filename>/etc/nixos/configuration.nix</filename>)
-        to the system store path.
+        (usually <filename>/etc/nixos/configuration.nix</filename>)
+        and links it from the resulting system
+        (getting to <filename>/run/current-system/configuration.nix</filename>).
+        Note that only this single file is copied, even if it imports others.
       '';
     };
 
@@ -238,7 +239,9 @@ in
     system.extraSystemBuilderCmds =
       optionalString
         config.system.copySystemConfiguration
-        "cp ${maybeEnv "NIXOS_CONFIG" "/etc/nixos/configuration.nix"} $out";
+        ''ln -s '${import ../../../lib/from-env.nix "NIXOS_CONFIG" <nixos-config>}' \
+            "$out/configuration.nix"
+        '';
 
     system.build.toplevel = system;