54 lines
1.6 KiB
Nix
54 lines
1.6 KiB
Nix
{...}: {
|
|
config.flake.modules.homeManager.encryption = {
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}: {
|
|
options.azos.encryption.enable = lib.mkOption {
|
|
default = true;
|
|
type = lib.types.bool;
|
|
};
|
|
config = lib.mkIf config.azos.encryption.enable {
|
|
programs.password-store = {
|
|
enable = true;
|
|
settings = {
|
|
PASSWORD_STORE_KEY = "26B851F81F8F7C55";
|
|
};
|
|
};
|
|
home.packages = with pkgs; [
|
|
yubikey-personalization
|
|
];
|
|
programs.gpg = {
|
|
enable = true;
|
|
};
|
|
programs.browserpass = {
|
|
enable = true;
|
|
browsers = ["chromium"];
|
|
};
|
|
services.gpg-agent = {
|
|
enable = true;
|
|
enableSshSupport = true;
|
|
grabKeyboardAndMouse = false;
|
|
pinentry.package = pkgs.pinentry-emacs;
|
|
extraConfig = ''
|
|
allow-emacs-pinentry
|
|
allow-loopback-pinentry
|
|
'';
|
|
};
|
|
home.file.".ssh/config".source = ./ssh-config;
|
|
home.file.".ssh/gpg-as-ssh.pub".source = ./gpg-as-ssh.pub;
|
|
home.file.".gnupg/sshcontrol".source = ./sshcontrol;
|
|
|
|
# home-manager creates ~/.gnupg (via the files above) with the default
|
|
# umask, which can leave it group/other-readable. gpg refuses to trust
|
|
# a homedir like that and prints an "unsafe permissions" warning on
|
|
# every invocation, which pollutes anything that captures gpg/pass
|
|
# output (e.g. shell-command-to-string). Enforce 700 on every switch.
|
|
home.activation.gnupgPerms = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
|
$DRY_RUN_CMD chmod 700 "$HOME/.gnupg"
|
|
'';
|
|
};
|
|
};
|
|
}
|