feat(home-manager): add scm module

For `git` and `jujutsu`
This commit is contained in:
reo101 2024-07-19 01:40:36 +03:00
parent 3dc5d9ac6c
commit 6e0c2adc1c
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
2 changed files with 104 additions and 14 deletions

View file

@ -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

View file

@ -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 ];
};
}