diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2016-12-15 14:08:48 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2016-12-15 14:08:48 +0100 |
| commit | 8ffe2020dd7a440233a6a11893f71b178e657266 (patch) | |
| tree | 916bb0b359c7918501112006f642e60250b7d97a /modules/system | |
| parent | 125dcb48b02819f84e8393e3a901906d164e89bc (diff) | |
fix etc files in directories
Diffstat (limited to 'modules/system')
| -rw-r--r-- | modules/system/etc.nix | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/system/etc.nix b/modules/system/etc.nix index 9999c1e..e2f9ef2 100644 --- a/modules/system/etc.nix +++ b/modules/system/etc.nix @@ -9,7 +9,10 @@ let mkTextDerivation = name: text: pkgs.writeText "etc-${name}" text; }; + hasDir = path: length (splitString "/" path) > 1; + etc = filter (f: f.enable) (attrValues config.environment.etc); + etcDirs = filter (attr: hasDir attr.target) (attrValues config.environment.etc); in @@ -31,6 +34,7 @@ in system.build.etc = pkgs.runCommand "etc" {} '' mkdir -p $out/etc cd $out/etc + ${concatMapStringsSep "\n" (attr: "mkdir -p $(dirname '${attr.target}')") etc} ${concatMapStringsSep "\n" (attr: "ln -s '${attr.source}' '${attr.target}'") etc} ''; @@ -43,7 +47,7 @@ in for link in $(ls /etc/static/); do if [ -e "/etc/$link" ]; then if [ ! -L "/etc/$link" ]; then - echo "warning: /etc/$link is a file, skipping..." >&2 + echo "warning: /etc/$link exists, skipping..." >&2 fi else ln -sfn "/etc/static/$link" "/etc/$link" |
