nixos/home/scripts/age.nix
2024-03-15 21:26:34 +01:00

13 lines
362 B
Nix

{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;
add-secrets = pkgs.writeShellScriptBin "add-secrets" ''
file=$1
pubkey=$(cat ~/nixy.key | grep "public key" | cut -d':' -f2 | sed 's/ //g')
${pkgs.age}/bin/age -r $pubkey -o ~/.config/nixos/home/secrets/$file.age -a $file
'';
in { home.packages = with pkgs; [ add-secrets ]; }