Skip to content

Commit

Permalink
✨ Added git-cliff home module
Browse files Browse the repository at this point in the history
  • Loading branch information
theobori committed Dec 10, 2024
1 parent 1a261d4 commit 2ec6d70
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 76 deletions.
94 changes: 94 additions & 0 deletions modules/home/cli/programs/git-cliff/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
config,
lib,
pkgs,
namespace,
...
}:
let
inherit (lib) mkIf types;
inherit (lib.${namespace}) mkOpt mkBoolOpt enabled;
inherit (config.${namespace}) user;

cfg = config.${namespace}.cli.programs.git;
in
{
options.${namespace}.cli.programs.git = with types; {
enable = mkBoolOpt false "Whether or not to enable git.";

signByDefault = mkOpt bool true "Whether to sign commits by default.";
signingKey =
mkOpt str "EEFBCC3AC529CFD1943DA75CBDD57BE99D555965"
"The GnuPG signing key fingerprint sign commits with.";
userName = mkOpt str user.fullName "The name to configure git with.";
userEmail = mkOpt str user.email "The email to configure git with.";
};

config = mkIf cfg.enable {
${namespace}.editors.emacs = enabled;

programs.git = {
enable = true;
package = pkgs.gitFull;
inherit (cfg) userName userEmail;

signing = {
key = cfg.signingKey;
inherit (cfg) signByDefault;
};

extraConfig = {
commit.gpgsign = true;

core = {
editor = "emacs";
pager = "delta";
filemode = "false";
};

color = {
ui = true;
};

fetch = {
prune = true;
};

interactive = {
diffFitler = "delta --color-only";
};

delta = {
enable = true;
navigate = true;
light = false;
side-by-side = false;
line-numbers = true;
options.syntax-theme = "dracula";
};

pull = {
ff = "only";
};

push = {
default = "current";
autoSetupRemote = true;
};

safe = {
directory = [
"~/${namespace}/"
"/etc/nixos"
];
};

init = {
defaultBranch = "main";
};
};
};

home.packages = with pkgs; [ gitmoji-cli ];
};
}
82 changes: 6 additions & 76 deletions modules/home/cli/programs/git/default.nix
Original file line number Diff line number Diff line change
@@ -1,94 +1,24 @@
{
config,
lib,
pkgs,
namespace,
...
}:
let
inherit (lib) mkIf types;
inherit (lib.${namespace}) mkOpt mkBoolOpt enabled;
inherit (config.${namespace}) user;
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;

cfg = config.${namespace}.cli.programs.git;
cfg = config.${namespace}.cli.programs.git-cliff;
in
{
options.${namespace}.cli.programs.git = with types; {
enable = mkBoolOpt false "Whether or not to enable git.";
options.${namespace}.cli.programs.git-cliff = {
enable = mkBoolOpt false "Whether or not to enable git-cliff.";

signByDefault = mkOpt bool true "Whether to sign commits by default.";
signingKey =
mkOpt str "EEFBCC3AC529CFD1943DA75CBDD57BE99D555965"
"The GnuPG signing key fingerprint sign commits with.";
userName = mkOpt str user.fullName "The name to configure git with.";
userEmail = mkOpt str user.email "The email to configure git with.";
};

config = mkIf cfg.enable {
${namespace}.editors.emacs = enabled;

programs.git = {
programs.git-cliff = {
enable = true;
package = pkgs.gitFull;
inherit (cfg) userName userEmail;

signing = {
key = cfg.signingKey;
inherit (cfg) signByDefault;
};

extraConfig = {
commit.gpgsign = true;

core = {
editor = "emacs";
pager = "delta";
filemode = "false";
};

color = {
ui = true;
};

fetch = {
prune = true;
};

interactive = {
diffFitler = "delta --color-only";
};

delta = {
enable = true;
navigate = true;
light = false;
side-by-side = false;
line-numbers = true;
options.syntax-theme = "dracula";
};

pull = {
ff = "only";
};

push = {
default = "current";
autoSetupRemote = true;
};

safe = {
directory = [
"~/${namespace}/"
"/etc/nixos"
];
};

init = {
defaultBranch = "main";
};
};
};

home.packages = with pkgs; [ gitmoji-cli ];
};
}
1 change: 1 addition & 0 deletions modules/home/roles/development/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ in
fzf = enabled;
fastfetch = enabled;
git = enabled;
git-cliff = enabled;
gpg = enabled;
htop = enabled;
btop = enabled;
Expand Down

0 comments on commit 2ec6d70

Please sign in to comment.