configuration.nix/home/users.nix
Jalil David Salamé Messina b3b4b78660
feat: Move home.nix into this repo
This makes it much easier to test and apply changes.
2024-01-21 20:56:00 +01:00

30 lines
700 B
Nix

{ config, lib, ... }:
let
inherit (config) jhome;
inherit (cfg.defaultIdentity) gpgKey;
cfg = jhome.user;
hasConfig = jhome.enable && cfg != null;
hasKey = gpgKey != null;
gpgHome = config.programs.gpg.homedir;
unlockKey = hasConfig && cfg.unlockGpgKeyOnLogin && hasKey;
in
{
config = lib.mkMerge [
(lib.mkIf hasConfig {
programs.git.userName = cfg.defaultIdentity.name;
programs.git.userEmail = cfg.defaultIdentity.email;
programs.git.signing = lib.mkIf hasKey {
signByDefault = true;
key = gpgKey;
};
})
(lib.mkIf unlockKey {
xdg.configFile.pam-gnupg.text = ''
${gpgHome}
${gpgKey}
'';
})
];
}