diff options
author | Ben Sima <ben@bsima.me> | 2022-04-21 14:38:59 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2022-04-21 14:39:22 -0400 |
commit | faa3ffcd9f11578badaa6dd44dd7fe454d2fa23d (patch) | |
tree | 7fd08ccefe7f296898d0db6a007357af2931e0cf | |
parent | 240b9ced293902425b7061a2310d55909993d300 (diff) |
Add forgit
-rw-r--r-- | default.nix | 4 | ||||
-rw-r--r-- | lib/common.nix | 10 | ||||
-rw-r--r-- | lib/packages.nix | 1 | ||||
-rw-r--r-- | overlay.nix | 5 | ||||
-rw-r--r-- | pkgs/forgit.nix | 36 |
5 files changed, 55 insertions, 1 deletions
diff --git a/default.nix b/default.nix index 7e9cbcb..2268a4f 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,8 @@ let nixpkgs = builtins.fetchTarball (import ./nixpkgs.nix); - pkgs = import "${nixpkgs}" {}; + pkgs = import "${nixpkgs}" { + overlays = [./overlay.nix]; + }; hm-src = pkgs.home-manager.src; in rec { diff --git a/lib/common.nix b/lib/common.nix index 7059cba..4b189a7 100644 --- a/lib/common.nix +++ b/lib/common.nix @@ -6,6 +6,7 @@ let homedir = builtins.getEnv "HOME"; in { + nixpkgs.overlays = [ (import ../overlay.nix) ]; home = { sessionVariables = { GPGID = gpgid; @@ -25,6 +26,12 @@ in FZF_DEFAULT_COMMAND = "git ls-files --cached --others --exclude-standard | fd --type f --type l $FD_OPTIONS"; FZF_CTRL_T_COMMAND = "fd $FD_OPTIONS"; FZF_ALT_C_COMMAND = "fd --type d $FD_OPTIONS"; + FORGIT_FZF_DEFAULT_OPTS = '' + --exact + --border + --cycle + --reverse + ''; }; # From the command line: @@ -287,6 +294,9 @@ in [[ -f "$DIR/nix.sh" ]] && . "$DIR/nix.sh" [[ -f "$DIR/hm-session-vars.sh" ]] && . "$DIR/hm-session-vars.sh" [[ -f "${homedir}/.bashrc.local" ]] && . "${homedir}/.bashrc.local" + + source "${pkgs.forgit}/share/bash/forgit.plugin.zsh" + function cd() { builtin cd "$@" && ls } diff --git a/lib/packages.nix b/lib/packages.nix index 4fdb0d0..1bc8c49 100644 --- a/lib/packages.nix +++ b/lib/packages.nix @@ -75,6 +75,7 @@ in { figlet file font-awesome_5 + forgit gcal git-lfs git-revise diff --git a/overlay.nix b/overlay.nix new file mode 100644 index 0000000..b43d9ed --- /dev/null +++ b/overlay.nix @@ -0,0 +1,5 @@ +self: super: + +{ + forgit = super.callPackage ./pkgs/forgit.nix {}; +} diff --git a/pkgs/forgit.nix b/pkgs/forgit.nix new file mode 100644 index 0000000..07cad43 --- /dev/null +++ b/pkgs/forgit.nix @@ -0,0 +1,36 @@ +{ lib, stdenv, fetchFromGitHub, bash, fzf, git }: + +stdenv.mkDerivation rec { + pname = "forgit"; + version = "unstable-2022-4-20"; + + src = fetchFromGitHub { + owner = "wfxr"; + repo = "forgit"; + rev = "fa9fd624398643d53ea9cea61d66eca77ca7c46c"; + sha256 = "sha256:1hq1qbpfj0kfld8rvqf7mhh83mll6baq26p1cp0sr68cf66nl51q"; + }; + + buildInputs = [ bash fzf ]; + dontBuild = true; + + installPhase = '' + runHook preInstall + + substituteInPlace forgit.plugin.zsh \ + --replace \$FORGIT_INSTALL_DIR $out/share/bash + + install -Dt "$out/bin/" -m744 bin/git-forgit + install -Dt "$out/share/bash/" -m444 forgit.plugin.zsh + + runHook postInstall + ''; + + meta = with lib; { + description = "A utility tool powered by fzf for using git interactively"; + homepage = "https://github.com/wfxr/forgit"; + license = licenses.mit; + platforms = platforms.all; + maintainers = with maintainers; [ bsima ]; + }; +} |