Add exception for system rebuild with copied configuration.

This commit is contained in:
Kevin Baensch 2019-04-18 09:14:39 +02:00
parent db56b42c52
commit f0802397b9

View file

@ -4,17 +4,17 @@ with lib;
let let
cfg = config.system.copySysConf; cfg = config.system.copySysConf;
copySysConf = pkgs.stdenv.mkDerivation rec { cfgPath = ../.;
srcPath = ../.; copySysConf = if (cfgPath == /etc/nixos) then pkgs.stdenv.mkDerivation rec {
name = "NixOS_Configuration-${version}"; name = "NixOS_Configuration-${version}";
version = commitIdFromGitRepo (srcPath + "/.git"); version = commitIdFromGitRepo (cfgPath + "/.git");
src = cleanSource srcPath; src = cleanSource cfgPath;
installPhase = '' installPhase = ''
cp -R ./. $out cp -R ./. $out
''; '';
}; } else ../.;
in { in {
options.system.copySysConf = { options.system.copySysConf = {
@ -33,8 +33,6 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
# probably don't need to add it to systemPackages
environment.systemPackages = [ copySysConf ];
nix = mkIf cfg.addToNixPath { nix = mkIf cfg.addToNixPath {
# Do not use lib.optionals as it would override the default nixPath # Do not use lib.optionals as it would override the default nixPath
nixPath = [ nixPath = [