From 4cc165fd7fc4dfbb2e3733b1322112d52f72d94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Thu, 31 Jul 2025 23:57:05 +0200 Subject: [PATCH] vanadium/git: generate git conditional config for both https and git --- nix/configurations/vanadium/home/dev.nix | 30 +++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/nix/configurations/vanadium/home/dev.nix b/nix/configurations/vanadium/home/dev.nix index ec2b7820..ce6abd68 100644 --- a/nix/configurations/vanadium/home/dev.nix +++ b/nix/configurations/vanadium/home/dev.nix @@ -41,8 +41,13 @@ ]; }; includes = let - hasconfigRemoteCondition = cfg: - cfg // {condition = "hasconfig:remote.*.url:" + cfg.condition;}; + hasconfigRemoteCondition = cfg: let + cfg' = builtins.removeAttrs cfg ["url" "path"]; + path = cfg.path or "*/**"; + in [ + (cfg' // {condition = "hasconfig:remote.*.url:git@${cfg.url}:${path}";}) + (cfg' // {condition = "hasconfig:remote.*.url:https://${cfg.url}/${path}";}) + ]; haskellIdentity = { init.defaultBranch = "main"; @@ -62,30 +67,33 @@ blame.ignoreRevsFile = ".git-blame-ignore-revs"; }; in - map hasconfigRemoteCondition [ + builtins.concatMap hasconfigRemoteCondition [ # Univ stuff { - condition = "git@gitlab.istic.univ-rennes1.fr"; + url = "gitlab.istic.univ-rennes1.fr"; contents = universityIdentity; } { - condition = "git@gitlab2.istic.univ-rennes1.fr"; + url = "gitlab2.istic.univ-rennes1.fr"; contents = universityIdentity; } # Haskell { - condition = "git@gitlab.haskell.org:*/**"; - contents = lib.mkMerge [ - haskellIdentity - blameIgnore - ]; + url = "gitlab.haskell.org"; + contents = haskellIdentity; } # Blame # Turning this on globally will fail if the file doesn't exist { - condition = "git@github.com:nixos/nixpkgs.git"; + url = "github.com"; + path = "nixos/nixpkgs.git"; + contents = blameIgnore; + } + { + url = "gitlab.haskell.org"; + path = "ghc/ghc.git"; contents = blameIgnore; } ];