tree-wide: deduplicate git identity

This commit is contained in:
Primrose 2025-11-02 16:43:48 +08:00
parent 432efd430c
commit 50db96001e
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
4 changed files with 73 additions and 127 deletions

View file

@ -35,74 +35,15 @@
signing.signByDefault = true;
maintenance = {
enable = true;
repositories =
lib.map (path: config.home.homeDirectory + "/${path}")
[
"r/nixos/nixpkgs"
];
repositories = lib.map (path: config.home.homeDirectory + "/${path}") [
"r/nixos/nixpkgs"
];
};
includes = let
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";
user.name = "Léana Jiang";
};
universityIdentity = {
init.defaultBranch = "main";
user = {
name = "Léana CHIANG";
email = "leana.chiang@etudiant.univ-rennes1.fr";
signingKey = "0x32035DB97E777EEB";
};
};
blameIgnore = {
blame.ignoreRevsFile = ".git-blame-ignore-revs";
};
fromList = import ../../../git-identities/git-compat.nix;
identities = import ../../../git-identities/list.nix;
in
builtins.concatMap hasconfigRemoteCondition [
# Univ stuff
{
url = "gitlab.istic.univ-rennes1.fr";
contents = universityIdentity;
}
{
url = "gitlab2.istic.univ-rennes1.fr";
contents = universityIdentity;
}
# Haskell
{
url = "gitlab.haskell.org";
contents = haskellIdentity;
}
# Blame
# Turning this on globally will fail if the file doesn't exist
{
url = "github.com";
path = "nixos/nixpkgs.git";
contents = blameIgnore;
}
{
url = "gitlab.haskell.org";
path = "ghc/ghc.git";
contents = blameIgnore;
}
{
url = "github.com";
path = "haskell/cabal.git";
contents = blameIgnore;
}
];
fromList identities;
};
programs.gpg.enable = true;