summaryrefslogtreecommitdiff
path: root/modules/system/etc.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system/etc.nix')
-rw-r--r--modules/system/etc.nix21
1 files changed, 6 insertions, 15 deletions
diff --git a/modules/system/etc.nix b/modules/system/etc.nix
index 1c41526..bc60bef 100644
--- a/modules/system/etc.nix
+++ b/modules/system/etc.nix
@@ -10,7 +10,6 @@ let
};
etc = filter (f: f.enable) (attrValues config.environment.etc);
- etcCopy = filter (f: f.copy) (attrValues config.environment.etc);
in
@@ -20,7 +19,7 @@ in
environment.etc = mkOption {
type = types.attrsOf (types.submodule text);
default = { };
- description = lib.mdDoc ''
+ description = ''
Set of files that have to be linked in {file}`/etc`.
'';
};
@@ -34,9 +33,10 @@ in
''
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}
- ${concatMapStringsSep "\n" (attr: "touch '${attr.target}'.copy") etcCopy}
+ ${concatMapStringsSep "\n" (attr: ''
+ mkdir -p "$(dirname ${escapeShellArg attr.target})"
+ ln -s ${escapeShellArgs [ attr.source attr.target ]}
+ '') etc}
'';
system.activationScripts.etcChecks.text = ''
@@ -55,10 +55,6 @@ in
etcStaticFile=/etc/static/$subPath
etcFile=/etc/$subPath
- if [[ -e $configFile.copy ]]; then
- continue
- fi
-
# We need to check files that exist and aren't already links to
# $etcStaticFile for known hashes.
if [[
@@ -109,11 +105,6 @@ in
mkdir -p "$etcDir"
fi
- if [[ -e $etcStaticFile.copy ]]; then
- cp "$etcStaticFile" "$etcFile"
- continue
- fi
-
if [[ -e $etcFile ]]; then
if [[ $(readlink -- "$etcFile") == "$etcStaticFile" ]]; then
continue
@@ -130,7 +121,7 @@ in
# Delete stale links into /etc/static.
if [[
- $(readlink "$etcFile") == "$etcStaticFile"
+ $(readlink -- "$etcFile") == "$etcStaticFile"
&& ! -e $etcStaticFile
]]; then
rm "$etcFile"