mirror of
https://github.com/nmasur/dotfiles
synced 2025-03-14 21:37:04 +00:00
12 lines
387 B
Nix
12 lines
387 B
Nix
|
{ pkgs, ... }:
|
||
|
|
||
|
pkgs.writeShellScriptBin "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 ${builtins.toString ../../../../misc/public-keys} $tmpfile
|
||
|
rm $tmpfile
|
||
|
''
|