vanadium/git: generate git conditional config for both https and git

This commit is contained in:
Primrose 2025-07-31 23:57:05 +02:00
parent bdf7dd7122
commit 4cc165fd7f
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -41,8 +41,13 @@
]; ];
}; };
includes = let includes = let
hasconfigRemoteCondition = cfg: hasconfigRemoteCondition = cfg: let
cfg // {condition = "hasconfig:remote.*.url:" + cfg.condition;}; 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 = { haskellIdentity = {
init.defaultBranch = "main"; init.defaultBranch = "main";
@ -62,30 +67,33 @@
blame.ignoreRevsFile = ".git-blame-ignore-revs"; blame.ignoreRevsFile = ".git-blame-ignore-revs";
}; };
in in
map hasconfigRemoteCondition [ builtins.concatMap hasconfigRemoteCondition [
# Univ stuff # Univ stuff
{ {
condition = "git@gitlab.istic.univ-rennes1.fr"; url = "gitlab.istic.univ-rennes1.fr";
contents = universityIdentity; contents = universityIdentity;
} }
{ {
condition = "git@gitlab2.istic.univ-rennes1.fr"; url = "gitlab2.istic.univ-rennes1.fr";
contents = universityIdentity; contents = universityIdentity;
} }
# Haskell # Haskell
{ {
condition = "git@gitlab.haskell.org:*/**"; url = "gitlab.haskell.org";
contents = lib.mkMerge [ contents = haskellIdentity;
haskellIdentity
blameIgnore
];
} }
# Blame # Blame
# Turning this on globally will fail if the file doesn't exist # 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; contents = blameIgnore;
} }
]; ];