modules(home-manager): add git module
This commit is contained in:
parent
c4a79b5ad0
commit
8b82fab3b7
@ -7,7 +7,6 @@
|
||||
# Reusable modules
|
||||
"${modules_hm_path}/alacritty.nix"
|
||||
"${modules_hm_path}/zsh.nix"
|
||||
"${modules_hm_path}/git.nix"
|
||||
"${modules_hm_path}/ssh.nix"
|
||||
"${modules_hm_path}/go.nix"
|
||||
"${modules_hm_path}/utils.nix"
|
||||
@ -26,7 +25,7 @@
|
||||
|
||||
# Host specific
|
||||
./services.nix
|
||||
];
|
||||
] ++ (import ../../../modules/home-manager { });
|
||||
|
||||
# Almost static information
|
||||
home = {
|
||||
@ -75,10 +74,16 @@
|
||||
];
|
||||
};
|
||||
|
||||
# Custom modules (./modules/home-manager)
|
||||
hm = {
|
||||
git = {
|
||||
enable = true;
|
||||
signingKey = "A12925470298BFEE7EE092B3946E2D0C410C7B3D";
|
||||
};
|
||||
};
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
cava.enable = true;
|
||||
git.signing.key = "A12925470298BFEE7EE092B3946E2D0C410C7B3D";
|
||||
|
||||
gpg = {
|
||||
enable = true;
|
||||
|
4
modules/home-manager/default.nix
Normal file
4
modules/home-manager/default.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{ ... }:
|
||||
[
|
||||
./git.nix
|
||||
]
|
@ -1,27 +1,61 @@
|
||||
{ ... }:
|
||||
{ config, lib, options, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.hm.git;
|
||||
|
||||
enable = mkEnableOption "git";
|
||||
signingKey = mkOption {
|
||||
type = types.nonEmptyStr;
|
||||
description = "The GPG key to use for signing commits";
|
||||
example = "A12925470298BFEE7EE092B3946E2D0C410C7B3D";
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.attrs;
|
||||
description = "user information for git";
|
||||
default = {
|
||||
name = "DataHearth";
|
||||
email = "dev@antoine-langlois.net";
|
||||
};
|
||||
};
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
description = "Extra git configuration";
|
||||
default = {};
|
||||
};
|
||||
extraAliases = mkOption {
|
||||
type = types.attrs;
|
||||
description = "Extra git aliases";
|
||||
default = {};
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
aliases = {
|
||||
co = "checkout";
|
||||
p = "push";
|
||||
a = "add";
|
||||
c = "commit";
|
||||
s = "status";
|
||||
pu = "pull";
|
||||
logs = "log --graph --oneline";
|
||||
remote-update = "remote update origin --prune";
|
||||
};
|
||||
difftastic.enable = true;
|
||||
lfs.enable = true;
|
||||
signing = {
|
||||
signByDefault = true;
|
||||
};
|
||||
userEmail = "dev@antoine-langlois.net";
|
||||
userName = "DataHearth";
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
safe.directory = [ "/etc/nixos" ];
|
||||
options.hm.git = {
|
||||
inherit enable signingKey user extraConfig extraAliases;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
aliases = {
|
||||
co = "checkout";
|
||||
p = "push";
|
||||
c = "commit";
|
||||
s = "status";
|
||||
pu = "pull";
|
||||
logs = "log --graph --oneline";
|
||||
remote-update = "remote update origin --prune";
|
||||
} // cfg.extraAliases;
|
||||
difftastic.enable = true;
|
||||
lfs.enable = true;
|
||||
signing = mkIf (builtins.hasAttr "signingKey" cfg) {
|
||||
signByDefault = true;
|
||||
key = cfg.signingKey;
|
||||
};
|
||||
userName = cfg.user.name;
|
||||
userEmail = cfg.user.email;
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
} // cfg.extraConfig;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user