dotfiles/nix/home-manager/modules/gpg.nix

30 lines
718 B
Nix
Raw Normal View History

2021-02-28 18:14:01 +01:00
{ nixpkgs, nixpkgs-unstable, nixpkgs-master, custom, hostname, rlib }:
{ config, lib, ... }:
{
home.packages = [
custom.gpg-key
2021-02-28 20:00:05 +01:00
nixpkgs.gnupg
2021-02-28 18:14:01 +01:00
];
home.file.".gpg-agent.conf".text = (pinentryFlavor: ''
enable-ssh-support
pinentry-program ${nixpkgs.pinentry.${pinentryFlavor}}/bin/pinentry
'') "gtk2";
2021-02-28 20:00:05 +01:00
home.file.".profile".text = ''
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
'';
2021-02-28 18:14:01 +01:00
home.activation.gnupghome = config.lib.dag.entryAfter ["writeBoundary"] ''
2021-02-28 20:00:05 +01:00
if [ ! -e ~/.gnupg ]
then
ln -sf /mnt/key/gnupg ~/.gnupg
fi
if [ ! -e ~/.gnupg/gpg-agent.conf ]
then
ln -sf ~/.gpg-agent.conf /mnt/key/gnupg/gpg-agent.conf
2021-02-28 20:00:05 +01:00
fi
2021-02-28 18:14:01 +01:00
'';
}