nixos copySystemConfiguration: fix when chrooted

Fixes #7974. Also makes the description more informative.

+7 -4
+7 -4
nixos/modules/system/activation/top-level.nix
··· 178 default = false; 179 description = '' 180 If enabled, copies the NixOS configuration file 181 - <literal>$NIXOS_CONFIG</literal> (usually 182 - <filename>/etc/nixos/configuration.nix</filename>) 183 - to the system store path. 184 ''; 185 }; 186 ··· 238 system.extraSystemBuilderCmds = 239 optionalString 240 config.system.copySystemConfiguration 241 - "cp ${maybeEnv "NIXOS_CONFIG" "/etc/nixos/configuration.nix"} $out"; 242 243 system.build.toplevel = system; 244
··· 178 default = false; 179 description = '' 180 If enabled, copies the NixOS configuration file 181 + (usually <filename>/etc/nixos/configuration.nix</filename>) 182 + and links it from the resulting system 183 + (getting to <filename>/run/current-system/configuration.nix</filename>). 184 + Note that only this single file is copied, even if it imports others. 185 ''; 186 }; 187 ··· 239 system.extraSystemBuilderCmds = 240 optionalString 241 config.system.copySystemConfiguration 242 + ''ln -s '${import ../../../lib/from-env.nix "NIXOS_CONFIG" <nixos-config>}' \ 243 + "$out/configuration.nix" 244 + ''; 245 246 system.build.toplevel = system; 247