mirror of
https://github.com/RGBCube/agenix
synced 2025-07-29 17:57:45 +00:00
add flake
This commit is contained in:
parent
c77d82e784
commit
4c2fd23693
3 changed files with 30 additions and 5 deletions
|
@ -8,13 +8,14 @@ let
|
|||
|
||||
identities = builtins.concatStringsSep " " (map (path: "-i ${path}") cfg.sshKeyPaths);
|
||||
installSecret = secretType: ''
|
||||
TMP_DIR=$(mktemp -d)
|
||||
TMP_FILE="$TMP_DIR/file"
|
||||
TMP_FILE="${secretType.path}.tmp"
|
||||
(umask 0400; ${pkgs.age}/bin/age --decrypt ${identities} -o "$TMP_FILE" "${secretType.file}")
|
||||
install -o '${secretType.owner}' -g '${secretType.group}' -m '${secretType.mode}' "$TMP_FILE" '${secretType.path}'
|
||||
rm -rf "$TMP_DIR"
|
||||
chmod ${secretType.mode} "$TMP_FILE"
|
||||
chown ${secretType.owner}:${secretType.group} "$TMP_FILE"
|
||||
mv -f "$TMP_FILE" '${secretType.path}'
|
||||
|
||||
'';
|
||||
installAllSecrets = builtins.concatStringsSep (map installSecret (builtins.attrValues cfg.secrets));
|
||||
installAllSecrets = builtins.concatStringsSep "\n" (map installSecret (builtins.attrValues cfg.secrets));
|
||||
|
||||
secretType = types.submodule ({ config, ... }: {
|
||||
options = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue