From 20cc8bee1b8eed7072b88c9f2503364591f66173 Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Mon, 2 Dec 2024 20:44:26 +0100 Subject: [PATCH] feat(home-manager): manage git config from upstream dotfiles repository --- users/transcaffeine/default.nix | 2 +- .../default.nix} | 5 +++ users/transcaffeine/home-manager/git.nix | 31 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) rename users/transcaffeine/{home-manager.nix => home-manager/default.nix} (75%) create mode 100644 users/transcaffeine/home-manager/git.nix diff --git a/users/transcaffeine/default.nix b/users/transcaffeine/default.nix index 61c5080..4af72da 100644 --- a/users/transcaffeine/default.nix +++ b/users/transcaffeine/default.nix @@ -22,5 +22,5 @@ nix-diff ]; }; - home-manager.users.transcaffeine = import ./home-manager.nix; + home-manager.users.transcaffeine = import ./home-manager/default.nix; } diff --git a/users/transcaffeine/home-manager.nix b/users/transcaffeine/home-manager/default.nix similarity index 75% rename from users/transcaffeine/home-manager.nix rename to users/transcaffeine/home-manager/default.nix index d3047d2..bb4f6e5 100644 --- a/users/transcaffeine/home-manager.nix +++ b/users/transcaffeine/home-manager/default.nix @@ -1,4 +1,7 @@ { lib, pkgs, ... }: { + imports = [ + ./git.nix + ]; home.stateVersion = "24.11"; services.darkman = { enable = true; @@ -9,4 +12,6 @@ dbusserver = true; }; }; + + home.preferXdgDirectories = true; } diff --git a/users/transcaffeine/home-manager/git.nix b/users/transcaffeine/home-manager/git.nix new file mode 100644 index 0000000..7494b43 --- /dev/null +++ b/users/transcaffeine/home-manager/git.nix @@ -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; + }; + }; +}