diff --git a/nix/repo/home-modules/default.nix b/nix/repo/home-modules/default.nix index 176fc2a..40aa4f7 100644 --- a/nix/repo/home-modules/default.nix +++ b/nix/repo/home-modules/default.nix @@ -20,8 +20,8 @@ in { c = "commit"; ca = "commit --amend"; cm = "commit -m"; - lol = "log --graph --decorate --pretty=oneline --abbrev-commit"; - lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all"; + # lol = "log --graph --decorate --pretty=oneline --abbrev-commit"; + # lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all"; sts = "status"; co = "checkout"; b = "branch"; diff --git a/nix/repo/home-profiles/default.nix b/nix/repo/home-profiles/default.nix index 3da955b..0dd5304 100644 --- a/nix/repo/home-profiles/default.nix +++ b/nix/repo/home-profiles/default.nix @@ -151,11 +151,26 @@ in { ''; example = [".direnv" "node_modules"]; }; + plugins = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = [ + cell.packages.git-plus + ]; + description = '' + Git plugins are just programs that are exposed to git-custom-command. + Git takes the responsibility to do map it into `git custom-command` + ''; + example = '' + [ pkgs.git-filter-repo ] + ''; + }; }; - # WARNING: This should be completed wtf - config."${namespace}".git = { - inherit (cfg) name email ignores aliases; - enable = true; + config = { + "${namespace}".git = { + inherit (cfg) name email ignores aliases; + enable = true; + }; + home.packages = cfg.plugins; }; }; diff --git a/nix/repo/home-profiles/shells.nix b/nix/repo/home-profiles/shells.nix index 0e6c27e..3bc1c8b 100644 --- a/nix/repo/home-profiles/shells.nix +++ b/nix/repo/home-profiles/shells.nix @@ -89,40 +89,7 @@ in { enableCompletion = true; initExtra = cfg.shellInitExtra or ""; shellAliases = - { - git-lol = '' - git log --graph --decorate --color=always --abbrev-commit \ - --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | - while IFS= read -r line; do - # Format the relative time - line=$(echo "$line" | sed -e 's/ minute/ min/' \ - -e 's/ week/ wk/' \ - -e 's/ hour/ hr/' \ - -e 's/ month/ mo/' \ - -e 's/ year/ yr/' \ - -e 's/ ago//') - - # Print the formatted line - echo "$line" - done | less -R - ''; - git-lola = '' - git log --graph --decorate --color=always --abbrev-commit --all\ - --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | - while IFS= read -r line; do - # Format the relative time - line=$(echo "$line" | sed -e 's/ minute/ min/' \ - -e 's/ week/ wk/' \ - -e 's/ hour/ hr/' \ - -e 's/ month/ mo/' \ - -e 's/ year/ yr/' \ - -e 's/ ago//') - - # Print the formatted line - echo "$line" - done | less -R - ''; - } + { } // (cfg.shellAliases or {}); }; programs.zsh = { @@ -133,38 +100,6 @@ in { { nix-rebuild = "sudo nixos-rebuild switch"; hm-switch = "home-manager switch --flake"; - git-lol = '' - git log --graph --decorate --color=always --abbrev-commit \ - --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | - while IFS= read -r line; do - # Format the relative time - line=$(echo "$line" | sed -e 's/ minute/ min/' \ - -e 's/ week/ wk/' \ - -e 's/ hour/ hr/' \ - -e 's/ month/ mo/' \ - -e 's/ year/ yr/' \ - -e 's/ ago//') - - # Print the formatted line - echo "$line" - done | less -R - ''; - git-lola = '' - git log --graph --decorate --color=always --abbrev-commit --all\ - --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | - while IFS= read -r line; do - # Format the relative time - line=$(echo "$line" | sed -e 's/ minute/ min/' \ - -e 's/ week/ wk/' \ - -e 's/ hour/ hr/' \ - -e 's/ month/ mo/' \ - -e 's/ year/ yr/' \ - -e 's/ ago//') - - # Print the formatted line - echo "$line" - done | less -R - ''; } // (cfg.shellAliases or {}); history = { diff --git a/nix/repo/packages/default.nix b/nix/repo/packages/default.nix index e679714..faf618a 100644 --- a/nix/repo/packages/default.nix +++ b/nix/repo/packages/default.nix @@ -41,4 +41,42 @@ in { pixi-edit = inputs.cells.dev.packages.pixi-edit; nil = inputs.nixpkgs.nil; + + git-plus = pkgs.symlinkJoin { + name = "pegasust-git-plus"; + paths = [ + (pkgs.writeShellScriptBin "git-lola" '' + git log --graph --decorate --color=always --abbrev-commit --all\ + --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | + while IFS= read -r line; do + # Format the relative time + line=$(echo "$line" | sed -e 's/ minute/ min/' \ + -e 's/ week/ wk/' \ + -e 's/ hour/ hr/' \ + -e 's/ month/ mo/' \ + -e 's/ year/ yr/' \ + -e 's/ ago//') + + # Print the formatted line + echo "$line" + done | less -R + '') + (pkgs.writeShellScriptBin "git-lol" '' + git log --graph --decorate --color=always --abbrev-commit \ + --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | + while IFS= read -r line; do + # Format the relative time + line=$(echo "$line" | sed -e 's/ minute/ min/' \ + -e 's/ week/ wk/' \ + -e 's/ hour/ hr/' \ + -e 's/ month/ mo/' \ + -e 's/ year/ yr/' \ + -e 's/ ago//') + + # Print the formatted line + echo "$line" + done | less -R + '') + ]; + }; }