From 370c98a9f930efe8e408cf6a639b4eca3b6e11e8 Mon Sep 17 00:00:00 2001 From: tea Date: Tue, 10 Sep 2024 23:56:24 +0200 Subject: [PATCH] fix: fix _agenix_generation being empty if readlink fails --- modules/age.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/age.nix b/modules/age.nix index e49d9d8..787a3dd 100644 --- a/modules/age.nix +++ b/modules/age.nix @@ -29,7 +29,7 @@ with lib; let mount -t ramfs none "${cfg.secretsMountPoint}" -o nodev,nosuid,mode=0751 ''; newGeneration = '' - _agenix_generation="$(basename "$(readlink ${cfg.secretsDir})" || echo 0)" + _agenix_generation="$(basename "$(readlink "${cfg.secretsDir}" || echo 0)")" (( ++_agenix_generation )) echo "[agenix] creating new generation in ${cfg.secretsMountPoint}/$_agenix_generation" mkdir -p "${cfg.secretsMountPoint}" @@ -100,7 +100,7 @@ with lib; let cfg.identityPaths; cleanupAndLink = '' - _agenix_generation="$(basename "$(readlink ${cfg.secretsDir})" || echo 0)" + _agenix_generation="$(basename "$(readlink "${cfg.secretsDir}" || echo 0)")" (( ++_agenix_generation )) echo "[agenix] symlinking new secrets to ${cfg.secretsDir} (generation $_agenix_generation)..." ln -sfT "${cfg.secretsMountPoint}/$_agenix_generation" ${cfg.secretsDir}