2022-10-16 01:32:39 +00:00
|
|
|
{ pkgs, ... }: {
|
|
|
|
|
|
|
|
# nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age
|
|
|
|
|
|
|
|
type = "app";
|
|
|
|
|
|
|
|
program = builtins.toString (pkgs.writeShellScript "encrypt-secret" ''
|
|
|
|
printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2
|
|
|
|
read -p "Secret: " secret
|
|
|
|
printf "\nEncrypting...\n\n" 1>&2
|
|
|
|
tmpfile=$(mktemp)
|
|
|
|
echo "''${secret}" > ''${tmpfile}
|
|
|
|
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${
|
2023-08-05 20:55:37 +00:00
|
|
|
builtins.toString ../misc/public-keys
|
2022-10-16 01:32:39 +00:00
|
|
|
} $tmpfile
|
|
|
|
rm $tmpfile
|
|
|
|
'');
|
|
|
|
|
|
|
|
}
|