summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2023-05-15 11:59:31 +0100
committerGitHub <noreply@github.com>2023-05-15 11:59:31 +0100
commit0dbf1c2fb1a5a0372a324eff1ba44f9da66febd2 (patch)
tree535d771ee4325f365365e9093a04e411fe2480e8 /modules/system
parent252541bd05a7f55f3704a3d014ad1badc1e3360d (diff)
parent3d22883cdb4226306be7583f5513b3ca23a72e24 (diff)
Merge pull request #654 from shivaraj-bh/authorized-keys
Manage SSH authorized keys for users
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/etc.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/system/etc.nix b/modules/system/etc.nix
index cccb2b0..4b45e3a 100644
--- a/modules/system/etc.nix
+++ b/modules/system/etc.nix
@@ -12,6 +12,7 @@ let
hasDir = path: length (splitString "/" path) > 1;
etc = filter (f: f.enable) (attrValues config.environment.etc);
+ etcCopy = filter (f: f.copy) (attrValues config.environment.etc);
etcDirs = filter (attr: hasDir attr.target) (attrValues config.environment.etc);
in
@@ -38,6 +39,7 @@ in
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}
'';
system.activationScripts.etc.text = ''
@@ -55,6 +57,10 @@ in
if [ ! -e "$d" ]; then
mkdir -p "$d"
fi
+ if [ -e "$f".copy ]; then
+ cp "$f" "$l"
+ continue
+ fi
if [ -e "$l" ]; then
if [ "$(readlink "$l")" != "$f" ]; then
if ! grep -q /etc/static "$l"; then