mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
tree-wide: deduplicate git identity
This commit is contained in:
parent
432efd430c
commit
50db96001e
4 changed files with 73 additions and 127 deletions
|
|
@ -7,68 +7,6 @@
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
signing.signByDefault = false; # no need to setup the key
|
signing.signByDefault = false; # no need to setup the key
|
||||||
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";
|
|
||||||
};
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.gpg.enable = true;
|
programs.gpg.enable = true;
|
||||||
|
|
|
||||||
|
|
@ -35,74 +35,15 @@
|
||||||
signing.signByDefault = true;
|
signing.signByDefault = true;
|
||||||
maintenance = {
|
maintenance = {
|
||||||
enable = true;
|
enable = true;
|
||||||
repositories =
|
repositories = lib.map (path: config.home.homeDirectory + "/${path}") [
|
||||||
lib.map (path: config.home.homeDirectory + "/${path}")
|
"r/nixos/nixpkgs"
|
||||||
[
|
];
|
||||||
"r/nixos/nixpkgs"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
includes = let
|
includes = let
|
||||||
hasconfigRemoteCondition = cfg: let
|
fromList = import ../../../git-identities/git-compat.nix;
|
||||||
cfg' = builtins.removeAttrs cfg ["url" "path"];
|
identities = import ../../../git-identities/list.nix;
|
||||||
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";
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
builtins.concatMap hasconfigRemoteCondition [
|
fromList identities;
|
||||||
# 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;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.gpg.enable = true;
|
programs.gpg.enable = true;
|
||||||
|
|
|
||||||
14
nix/git-identities/git-compat.nix
Normal file
14
nix/git-identities/git-compat.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
let
|
||||||
|
hasconfigRemoteCondition = {
|
||||||
|
# Custom arguments
|
||||||
|
url,
|
||||||
|
path ? "*/**",
|
||||||
|
...
|
||||||
|
} @ cfg: let
|
||||||
|
cfg' = builtins.removeAttrs cfg ["url" "path"];
|
||||||
|
in [
|
||||||
|
(cfg' // {condition = "hasconfig:remote.*.url:git@${url}:${path}";})
|
||||||
|
(cfg' // {condition = "hasconfig:remote.*.url:https://${url}/${path}";})
|
||||||
|
];
|
||||||
|
in
|
||||||
|
builtins.concatMap hasconfigRemoteCondition
|
||||||
53
nix/git-identities/list.nix
Normal file
53
nix/git-identities/list.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
let
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
in [
|
||||||
|
# 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;
|
||||||
|
}
|
||||||
|
]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue