From f78770d4f1f163ec8129c4c372c3a28bafa29f61 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 7 Jul 2025 09:47:46 +0800 Subject: [PATCH] feat(git): add git module, set user config --- nix/homes/rafiq/git.nix | 1 - nix/manifest.nix | 2 +- nix/modules/git.nix | 12 ++++++++++++ nix/modules/home-manager.nix | 1 + nix/modules/hosts.nix | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 nix/modules/git.nix diff --git a/nix/homes/rafiq/git.nix b/nix/homes/rafiq/git.nix index 8745879..62bb79b 100644 --- a/nix/homes/rafiq/git.nix +++ b/nix/homes/rafiq/git.nix @@ -1,6 +1,5 @@ { flake.homes.rafiq = { - # Testing the import in home-manager.nix home.shellAliases = { gs = "git status"; gc = "git commit"; diff --git a/nix/manifest.nix b/nix/manifest.nix index f3cd69c..cd305e2 100644 --- a/nix/manifest.nix +++ b/nix/manifest.nix @@ -15,7 +15,7 @@ in flake.manifest = { users.rafiq = { primary = true; - username = "rafiq"; # If we don't set this here we have to do some weird shit + name = "Mohammad Rafiq"; email = "rafiq@rrv.sh"; shell = "fish"; pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq"; diff --git a/nix/modules/git.nix b/nix/modules/git.nix new file mode 100644 index 0000000..aee5432 --- /dev/null +++ b/nix/modules/git.nix @@ -0,0 +1,12 @@ +{ + flake.modules.homeManager.default = + { manifest, config, ... }: + { + home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config"; + programs.git = { + userName = manifest.users.${config.home.username}.name; + userEmail = manifest.users.${config.home.username}.email; + signing.key = "~/.ssh/id_ed25519.pub"; + }; + }; +} diff --git a/nix/modules/home-manager.nix b/nix/modules/home-manager.nix index 8726798..7b11f4d 100644 --- a/nix/modules/home-manager.nix +++ b/nix/modules/home-manager.nix @@ -6,6 +6,7 @@ let globalCfg = { useGlobalPkgs = true; useUserPackages = true; + extraSpecialArgs = { inherit (cfg) manifest; }; sharedModules = [ (flattenAttrs (cfg.modules.homeManager or { })) ]; diff --git a/nix/modules/hosts.nix b/nix/modules/hosts.nix index ddcdf3c..c2a87e0 100644 --- a/nix/modules/hosts.nix +++ b/nix/modules/hosts.nix @@ -18,6 +18,7 @@ let nixosSystem { specialArgs = { inherit inputs; + inherit (cfg) manifest; hostName = name; }; modules = [