From 6e0c2adc1c430b180dce0660688d1ab71b5a0a91 Mon Sep 17 00:00:00 2001 From: reo101 Date: Fri, 19 Jul 2024 01:40:36 +0300 Subject: [PATCH] feat(home-manager): add `scm` module For `git` and `jujutsu` --- .../limonka/home/pavelatanasov.nix | 18 +--- modules/home-manager/reo101-scm/default.nix | 100 ++++++++++++++++++ 2 files changed, 104 insertions(+), 14 deletions(-) create mode 100644 modules/home-manager/reo101-scm/default.nix diff --git a/machines/nix-darwin/aarch64-darwin/limonka/home/pavelatanasov.nix b/machines/nix-darwin/aarch64-darwin/limonka/home/pavelatanasov.nix index 01c6642..698c5f2 100644 --- a/machines/nix-darwin/aarch64-darwin/limonka/home/pavelatanasov.nix +++ b/machines/nix-darwin/aarch64-darwin/limonka/home/pavelatanasov.nix @@ -92,25 +92,15 @@ direnv = true; zoxide = true; }; + scm = { + git.enable = true; + jj.enable = true; + }; wezterm = { enable = true; }; }; - programs.git = { - enable = true; - userName = "reo101"; - # userEmail = "pavel.atanasov@limechain.tech"; - userEmail = "pavel.atanasov2001@gmail.com"; - signing = { - signByDefault = true; - key = "675AA7EF13964ACB"; - }; - lfs = { - enable = true; - }; - }; - home.file.".gnupg/gpg-agent.conf" = { text = '' allow-preset-passphrase diff --git a/modules/home-manager/reo101-scm/default.nix b/modules/home-manager/reo101-scm/default.nix new file mode 100644 index 0000000..8e3f8ca --- /dev/null +++ b/modules/home-manager/reo101-scm/default.nix @@ -0,0 +1,100 @@ +{ lib, pkgs, config, ... }: + +let + cfg = config.reo101.scm; + + inherit (lib) + mkEnableOption + types + mkIf + optionals + mkMerge; +in +{ + imports = + [ + ]; + + options = + { + reo101.scm = { + git = { + enable = mkEnableOption "reo101 git setup"; + }; + jj = { + enable = mkEnableOption "reo101 jj setup"; + }; + }; + }; + + config = let + # TODO: agenix??? + name = "reo101"; + email = "pavel.atanasov2001@gmail.com"; + key = "675AA7EF13964ACB"; + in { + home.packages = with pkgs; + builtins.concatLists [ + (optionals cfg.git.enable [ + git + ]) + (optionals cfg.jj.enable [ + jujutsu + ]) + ]; + + programs.git = mkIf cfg.git.enable { + enable = true; + userName = name; + userEmail = email; + signing = { + signByDefault = true; + inherit key; + }; + lfs = { + enable = true; + }; + extraConfig = { + init.defaultBranch = "master"; + }; + }; + + + programs.jujutsu = mkIf cfg.jj.enable { + enable = true; + package = pkgs.jujutsu; + settings = { + user = { + # name = "reo101"; + # email = "pavel.atanasov2001@gmail.com"; + # name = config.programs.git.userName; + # email = config.programs.git.userEmail; + inherit name email; + }; + git = { + fetch = ["origin" "upstream"]; + push = "github"; + }; + signing = { + backend = "gpg"; + # sign-all = true; + # key = "675AA7EF13964ACB"; + # sign-all = config.programs.git.signing.signByDefault; + # key = config.programs.git.signing.key; + sign-all = true; + inherit key; + }; + core.fsmonitor = "watchman"; + ui = { + color = "always"; + # pager = "nvim"; + editor = "nvim"; + }; + }; + }; + }; + + meta = { + maintainers = with lib.maintainers; [ reo101 ]; + }; +}