From 2ec6d701e700ac2189591a6172bc4425f35b74ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Bori?= Date: Tue, 10 Dec 2024 13:22:20 +0100 Subject: [PATCH] :sparkles: Added `git-cliff` home module --- .../home/cli/programs/git-cliff/default.nix | 94 +++++++++++++++++++ modules/home/cli/programs/git/default.nix | 82 ++-------------- modules/home/roles/development/default.nix | 1 + 3 files changed, 101 insertions(+), 76 deletions(-) create mode 100644 modules/home/cli/programs/git-cliff/default.nix diff --git a/modules/home/cli/programs/git-cliff/default.nix b/modules/home/cli/programs/git-cliff/default.nix new file mode 100644 index 0000000..f10cb42 --- /dev/null +++ b/modules/home/cli/programs/git-cliff/default.nix @@ -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 ]; + }; +} diff --git a/modules/home/cli/programs/git/default.nix b/modules/home/cli/programs/git/default.nix index f10cb42..d5a63c6 100644 --- a/modules/home/cli/programs/git/default.nix +++ b/modules/home/cli/programs/git/default.nix @@ -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 ]; }; } diff --git a/modules/home/roles/development/default.nix b/modules/home/roles/development/default.nix index 283277b..7c8d6f8 100644 --- a/modules/home/roles/development/default.nix +++ b/modules/home/roles/development/default.nix @@ -34,6 +34,7 @@ in fzf = enabled; fastfetch = enabled; git = enabled; + git-cliff = enabled; gpg = enabled; htop = enabled; btop = enabled;