From 965466bf7eea411276527833caba5c7306f26751 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 23 Jun 2024 13:21:02 -0400 Subject: [PATCH] feat(git): add config for https github --- common/home/git/default.nix | 41 ++++++++++--------------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/common/home/git/default.nix b/common/home/git/default.nix index 811e5c7..45b0ecd 100644 --- a/common/home/git/default.nix +++ b/common/home/git/default.nix @@ -2,7 +2,13 @@ pkgs, self, ... -}: { +}: let + mkRemoteConf = remote: email: name: { + condition = "hasconfig:remote.*.url:${remote}:*/**"; + contents.user = {inherit email name;}; + }; + mkDefaultRemote = remote: mkRemoteConf remote "matt@nelim.org" "matt1432"; +in { programs = { git = { enable = true; @@ -11,36 +17,11 @@ includes = [ {path = toString self.legacyPackages.${pkgs.system}.dracula.git;} - { - # FIXME: add https config - condition = "hasconfig:remote.*.url:git@github.com:*/**"; - contents = { - user = { - email = "matt@nelim.org"; - name = "matt1432"; - }; - }; - } + (mkDefaultRemote "https://github.com") + (mkDefaultRemote "git@github.com") + (mkDefaultRemote "git@git.nelim.org") - { - condition = "hasconfig:remote.*.url:git@git.nelim.org:*/**"; - contents = { - user = { - email = "matt@nelim.org"; - name = "matt1432"; - }; - }; - } - - { - condition = "hasconfig:remote.*.url:git@gitlab.info.uqam.ca:*/**"; - contents = { - user = { - email = "gj591944@ens.uqam.ca"; - name = "Mathis Hurtubise"; - }; - }; - } + (mkRemoteConf "git@gitlab.info.uqam.ca" "gj591944@ens.uqam.ca" "Mathis Hurtubise") ]; delta = {