feat(home-manager): manage git config from upstream dotfiles repository

This commit is contained in:
transcaffeine 2024-12-02 20:44:26 +01:00
parent e85351d49e
commit 20cc8bee1b
Signed by: transcaffeine
GPG Key ID: 03624C433676E465
3 changed files with 37 additions and 1 deletions

View File

@ -22,5 +22,5 @@
nix-diff nix-diff
]; ];
}; };
home-manager.users.transcaffeine = import ./home-manager.nix; home-manager.users.transcaffeine = import ./home-manager/default.nix;
} }

View File

@ -1,4 +1,7 @@
{ lib, pkgs, ... }: { { lib, pkgs, ... }: {
imports = [
./git.nix
];
home.stateVersion = "24.11"; home.stateVersion = "24.11";
services.darkman = { services.darkman = {
enable = true; enable = true;
@ -9,4 +12,6 @@
dbusserver = true; dbusserver = true;
}; };
}; };
home.preferXdgDirectories = true;
} }

View File

@ -0,0 +1,31 @@
{ lib, ... }: {
programs.git = let
gitconfig = builtins.fromTOML (
lib.readFile
((builtins.fetchGit {
url = "https://git.finally.coffee/transcaffeine/dotfiles.git";
ref = "main";
rev = "3811febee134e62d3539c472005f04710d913611";
shallow = false;
}).outPath + "/config/git/gitconfig")
);
key = gitconfig.user.signingKey;
aliases = gitconfig.alias;
in {
enable = true;
userName = gitconfig.user.name;
userEmail = gitconfig.user.email;
signing = {
signByDefault = true;
inherit key;
};
inherit aliases;
extraConfig = {
format = gitconfig.format;
commit = gitconfig.commit;
tag = gitconfig.tag;
pull = gitconfig.pull;
rebase = gitconfig.rebase;
};
};
}