From 6543588596d1f1f5fc4e2f9b5e819ff0cc6df972 Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Wed, 29 May 2024 21:59:06 -0700 Subject: [PATCH] git is a proper module now --- home.nix | 1 - home/modules/default.nix | 2 ++ home/modules/git.nix | 76 ++++++++++++++++++++++------------------ 3 files changed, 44 insertions(+), 35 deletions(-) diff --git a/home.nix b/home.nix index 4dd7180..f3fcdc6 100644 --- a/home.nix +++ b/home.nix @@ -3,7 +3,6 @@ { imports = [ ./home/modules - ./home/modules/git.nix ]; # Home Manager needs a bit of information about you and the paths it should diff --git a/home/modules/default.nix b/home/modules/default.nix index 3ea12a0..8b84cee 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -4,7 +4,9 @@ ./neovim.nix ./alacritty.nix ./fish.nix + ./git.nix ]; snowhawk.fish.enable = lib.mkDefault true; + snowhawk.git.enable = lib.mkDefault true; } diff --git a/home/modules/git.nix b/home/modules/git.nix index b88aafa..0c8d561 100644 --- a/home/modules/git.nix +++ b/home/modules/git.nix @@ -1,39 +1,47 @@ -{ ... }: +{ lib, config, ... }: +let + cfg = config.snowhawk.git; +in { - programs.git = { - enable = true; - userName = "Zynh Ludwig"; - userEmail = "zynh0722@gmail.com"; - ignores = [ - "Session.vim" - ]; - aliases = { - co = "checkout"; - ci = "commit"; - st = "status"; - br = "branch"; - hist = "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"; - type = "cat-file -t"; - dump = "cat-file -p"; - graph = "log --graph --decorate --pretty=oneline --abbrev-commit"; - }; - extraConfig = { - init.defaultBranch = "main"; - core = { - editor = "nvim"; - autocrlf = "input"; - safecrlf = true; + options.snowhawk.git = { + enable = lib.mkEnableOption "git"; + }; + config = lib.mkIf cfg.enable { + programs.git = { + enable = true; + userName = "Zynh Ludwig"; + userEmail = "zynh0722@gmail.com"; + ignores = [ + "Session.vim" + ]; + aliases = { + co = "checkout"; + ci = "commit"; + st = "status"; + br = "branch"; + hist = "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"; + type = "cat-file -t"; + dump = "cat-file -p"; + graph = "log --graph --decorate --pretty=oneline --abbrev-commit"; }; - credential = { - helper = [ - "cache --timeout 7200" - "oauth" - ]; - "https://git.zynh.me" = { - oauthClientId = "13d5b95d-565d-4264-8961-c45cc38eaa8a"; - oauthScopes = "read_repository write_repository"; - oauthAuthURL = "/login/oauth/authorize"; - oauthTokenURL = "/login/oauth/access_token"; + extraConfig = { + init.defaultBranch = "main"; + core = { + editor = "nvim"; + autocrlf = "input"; + safecrlf = true; + }; + credential = { + helper = [ + "cache --timeout 7200" + "oauth" + ]; + "https://git.zynh.me" = { + oauthClientId = "13d5b95d-565d-4264-8961-c45cc38eaa8a"; + oauthScopes = "read_repository write_repository"; + oauthAuthURL = "/login/oauth/authorize"; + oauthTokenURL = "/login/oauth/access_token"; + }; }; }; };