mirror of
https://github.com/Mic92/sops-nix.git
synced 2025-12-26 14:14:58 +08:00
{nixos,home-manager}: shell escape age key paths
This commit is contained in:
parent
8ae477955d
commit
ab2d1ffeb5
2 changed files with 12 additions and 8 deletions
|
|
@ -344,12 +344,14 @@ in {
|
|||
supportsDryActivation = true;
|
||||
});
|
||||
|
||||
generate-age-key = lib.mkIf (cfg.age.generateKey) (lib.stringAfter [] ''
|
||||
if [[ ! -f '${cfg.age.keyFile}' ]]; then
|
||||
generate-age-key = let
|
||||
escapedKeyFile = lib.escapeShellArg cfg.age.keyFile;
|
||||
in lib.mkIf cfg.age.generateKey (lib.stringAfter [] ''
|
||||
if [[ ! -f ${escapedKeyFile} ]]; then
|
||||
echo generating machine-specific age key...
|
||||
mkdir -p $(dirname ${cfg.age.keyFile})
|
||||
mkdir -p $(dirname ${escapedKeyFile})
|
||||
# age-keygen sets 0600 by default, no need to chmod.
|
||||
${pkgs.age}/bin/age-keygen -o ${cfg.age.keyFile}
|
||||
${pkgs.age}/bin/age-keygen -o ${escapedKeyFile}
|
||||
fi
|
||||
'');
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue