From f3d2da344f42afd9c62952a089b6607ff06035cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20K=C3=A4nner?= Date: Sat, 18 May 2024 20:22:28 +0200 Subject: [PATCH] 312 current 1970-01-01 01:00:00 23.11.20240514.9ddcaff 6.1.90 * --- hosts/MaxNixosLaptop/home.nix | 1 + modules/home/git/default.nix | 52 ++++++++++++++++++++++------------- modules/home/git/lazygit.nix | 28 +++++++++++++------ rebuild.sh | 33 ---------------------- 4 files changed, 54 insertions(+), 60 deletions(-) delete mode 100755 rebuild.sh diff --git a/hosts/MaxNixosLaptop/home.nix b/hosts/MaxNixosLaptop/home.nix index 66c6de6..f9b988a 100644 --- a/hosts/MaxNixosLaptop/home.nix +++ b/hosts/MaxNixosLaptop/home.nix @@ -11,6 +11,7 @@ sway.laptop = true; shell.enable = true; + git.enable = true; # Home Manager needs a bit of information about you and the paths it should # manage. diff --git a/modules/home/git/default.nix b/modules/home/git/default.nix index 2862edf..d060c8f 100644 --- a/modules/home/git/default.nix +++ b/modules/home/git/default.nix @@ -1,26 +1,40 @@ -{...}: { +{ + lib, + config, + ... +}: let + cfg = config.git; +in { imports = [./lazygit.nix]; - programs.git = { - enable = true; - extraConfig = { - fetch.parallel = 0; - init.defaultBranch = "main"; - pull.rebase = true; - }; - delta = { + options = { + git.enable = lib.mkEnableOption "git"; + }; + + config = lib.mkIf cfg.enable { + git.lazygit.enable = lib.mkDefault true; + + programs.git = { enable = true; - options = { - decorations = { - commit-decoration-style = "bold yellow box ul"; - file-decoration-style = "none"; - file-style = "bold yellow ul"; - }; - features = "decorations"; - whitespace-error-style = "22 reverse"; + extraConfig = { + fetch.parallel = 0; + init.defaultBranch = "main"; + pull.rebase = true; }; + delta = { + enable = true; + options = { + decorations = { + commit-decoration-style = "bold yellow box ul"; + file-decoration-style = "none"; + file-style = "bold yellow ul"; + }; + features = "decorations"; + whitespace-error-style = "22 reverse"; + }; + }; + userEmail = "max.kaenner@gmail.com"; + userName = "Max Känner"; }; - userEmail = "max.kaenner@gmail.com"; - userName = "Max Känner"; }; } diff --git a/modules/home/git/lazygit.nix b/modules/home/git/lazygit.nix index f29954c..c0e5ed8 100644 --- a/modules/home/git/lazygit.nix +++ b/modules/home/git/lazygit.nix @@ -1,11 +1,23 @@ -{...}: { - programs.lazygit = { - enable = true; - settings = { - gui = { - shwoRandomTip = false; - nerdFontsVersion = "3"; - border = "rounded"; +{ + lib, + config, + ... +}: let + cfg = config.git.lazygit; +in { + options = { + git.lazygit.enable = lib.mkEnableOption "lazygit, a git tui"; + }; + + config = lib.mkIf cfg.enable { + programs.lazygit = { + enable = true; + settings = { + gui = { + shwoRandomTip = false; + nerdFontsVersion = "3"; + border = "rounded"; + }; }; }; }; diff --git a/rebuild.sh b/rebuild.sh deleted file mode 100755 index 9601368..0000000 --- a/rebuild.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -# A rebuild script that commits on a successful build -set -e - -# cd to your config dir -pushd ~/dotfiles/nixos/ - -# Edit your config -$EDITOR - -# Autoformat your nix files -alejandra . #&>/dev/null - -# Shows your changes -git diff -U0 *.nix - -echo "NixOS Rebuilding..." - -# Rebuild, output simplified errors, log trackebacks -sudo nixos-rebuild switch &>nixos-switch.log || (cat nixos-switch.log | grep --color error && false) - -# Get current generation metadata -current=$(nixos-rebuild list-generations | grep current) - -# Commit all changes with the gereation metadata -git commit -am "$current" - -# Back to where you were -popd - -# Notify all OK! -notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available