diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
commit | c4625b175f8200f643fd6e11010932ea44c78433 (patch) | |
tree | bce3f89888c8ac3991fa5569a878a9eab6801ccc /infra/libkookie/nixpkgs/pkgs/applications/version-management/git-and-tools/gitstatus | |
parent | 49f735974dd103039ddc4cb576bb76555164a9e7 (diff) | |
parent | d661aa56a8843e991261510c1bb28fdc2f6975ae (diff) |
Add 'infra/libkookie/' from commit 'd661aa56a8843e991261510c1bb28fdc2f6975ae'
git-subtree-dir: infra/libkookie
git-subtree-mainline: 49f735974dd103039ddc4cb576bb76555164a9e7
git-subtree-split: d661aa56a8843e991261510c1bb28fdc2f6975ae
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/applications/version-management/git-and-tools/gitstatus')
2 files changed, 104 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/applications/version-management/git-and-tools/gitstatus/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/version-management/git-and-tools/gitstatus/default.nix new file mode 100644 index 000000000000..5b7dbc521f6a --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/version-management/git-and-tools/gitstatus/default.nix @@ -0,0 +1,82 @@ +{ callPackage, stdenv, fetchFromGitHub, git, zsh, ...}: + +stdenv.mkDerivation rec { + pname = "gitstatus"; + version = "1.3.0"; + + src = fetchFromGitHub { + owner = "romkatv"; + repo = "gitstatus"; + rev = "v${version}"; + sha256 = "0zan1sa8c24hpqwj66y9srd4n15f4nk64fc5jrd4smgfgn22wph8"; + }; + + buildInputs = [ (callPackage ./romkatv_libgit2.nix {}) ]; + patchPhase = '' + sed -i '1i GITSTATUS_AUTO_INSTALL=''${GITSTATUS_AUTO_INSTALL-0}' gitstatus.plugin.sh + sed -i '1i GITSTATUS_AUTO_INSTALL=''${GITSTATUS_AUTO_INSTALL-0}' gitstatus.plugin.zsh + sed -i "1a GITSTATUS_DAEMON=$out/bin/gitstatusd" install + ''; + installPhase = '' + install -Dm755 usrbin/gitstatusd $out/bin/gitstatusd + install -Dm444 gitstatus.plugin.sh $out + install -Dm444 gitstatus.plugin.zsh $out + install -Dm555 install $out + install -Dm444 build.info $out + ''; + # Don't install the "install" and "build.info" files, which the end user + # should not need to worry about. + pathsToLink = [ + "/bin/gitstatusd" + "/gitstatus.plugin.sh" + "/gitstatus.plugin.zsh" + ]; + + # The install check sets up an empty Git repository and a minimal zshrc that + # invokes gitstatus.plugin.zsh. It runs zsh against this zshrc and verifies + # that the script was sourced successfully and that the "gitstatus_query" + # command ran successfully. This tests the binary itself and the zsh + # integration. + installCheckInputs = [ git zsh ]; + doInstallCheck = true; + installCheckPhase = '' + TEMP=$(mktemp -d) + cd "$TEMP" + + git init + + echo ' + GITSTATUS_LOG_LEVEL=DEBUG + . $out/gitstatus.plugin.zsh || exit 1 + + gitstatus_stop NIX_TEST && gitstatus_start NIX_TEST + gitstatus_query NIX_TEST + if [[ $? -ne 0 ]]; then + print -- "Something went wrong with gitstatus" + exit 1 + elif [[ $VCS_STATUS_RESULT != "ok-sync" ]]; then + print -- "Not in a Git repo" + exit 1 + else + print -- "OK" + exit 0 + fi + ' > .zshrc + + # If we try to run zsh like "zsh -i -c true" or "zsh -i > output" then job + # control will be disabled in the shell and the gitstatus plugin script + # will fail when it tries to set the MONITOR option. As a workaround, we + # run zsh as a full-fledged independent process and then wait for it to + # exit. (The "exit" statements in the zshrc ensure that zsh will exit + # almost immediately after starting.) + ZDOTDIR=. zsh -i & + wait $! + ''; + + meta = with stdenv.lib; { + description = "10x faster implementation of `git status` command"; + homepage = "https://github.com/romkatv/gitstatus"; + license = [ licenses.gpl3 ]; + maintainers = with maintainers; [ mmlb hexa ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/applications/version-management/git-and-tools/gitstatus/romkatv_libgit2.nix b/infra/libkookie/nixpkgs/pkgs/applications/version-management/git-and-tools/gitstatus/romkatv_libgit2.nix new file mode 100644 index 000000000000..2f99c88a37bc --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/version-management/git-and-tools/gitstatus/romkatv_libgit2.nix @@ -0,0 +1,22 @@ +{ fetchFromGitHub, libgit2, ...}: + +libgit2.overrideAttrs (oldAttrs: { + cmakeFlags = oldAttrs.cmakeFlags ++ [ + "-DBUILD_CLAR=OFF" + "-DBUILD_SHARED_LIBS=OFF" + "-DREGEX_BACKEND=builtin" + "-DUSE_BUNDLED_ZLIB=ON" + "-DUSE_GSSAPI=OFF" + "-DUSE_HTTPS=OFF" + "-DUSE_HTTP_PARSER=builtin" # overwritten from libgit2 + "-DUSE_NTLMCLIENT=OFF" + "-DUSE_SSH=OFF" + "-DZERO_NSEC=ON" + ]; + src = fetchFromGitHub { + owner = "romkatv"; + repo = "libgit2"; + rev = "tag-005f77dca6dbe8788e55139fa1199fc94cc04f9a"; + sha256 = "1h5bnisk4ljdpfzlv8g41m8js9841xyjhfywc5cn8pmyv58c50il"; + }; +}) |