feat: Move home.nix into this repo

This makes it much easier to test and apply changes.
This commit is contained in:
Jalil David Salamé Messina 2024-01-21 20:56:00 +01:00
parent 9b1fb2432a
commit b3b4b78660
Signed by: jalil
GPG key ID: F016B9E770737A0B
10 changed files with 703 additions and 224 deletions

30
home/users.nix Normal file
View file

@ -0,0 +1,30 @@
{ 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}
'';
})
];
}