@@ -1,4 +1,4 @@
1−{ callPackage, lib, stdenv, fetchFromGitHub, git, zsh, ...}:
1+{ callPackage, lib, stdenv, fetchFromGitHub, git, zsh }:
22
33stdenv.mkDerivation rec {
44 pname = "gitstatus";
@@ -11,25 +11,33 @@ stdenv.mkDerivation rec {
1111 sha256 = "sha256-MQG4thW73gDqY68bKP2FO8z5uc2R/tED+/X9qas/GOA=";
1212 };
1313
14− buildInputs = [ (callPackage ./romkatv_libgit2.nix {}) ];
15− patchPhase = ''
14+ buildInputs = [ (callPackage ./romkatv_libgit2.nix { }) ];
15+
16+ postPatch = ''
1617 sed -i '1i GITSTATUS_AUTO_INSTALL=''${GITSTATUS_AUTO_INSTALL-0}' gitstatus.plugin.sh
1718 sed -i '1i GITSTATUS_AUTO_INSTALL=''${GITSTATUS_AUTO_INSTALL-0}' gitstatus.plugin.zsh
1819 sed -i "1a GITSTATUS_DAEMON=$out/bin/gitstatusd" install
1920 '';
21+
2022 installPhase = ''
2123 install -Dm755 usrbin/gitstatusd $out/bin/gitstatusd
22− install -Dm444 gitstatus.plugin.sh $out
23− install -Dm444 gitstatus.plugin.zsh $out
24− install -Dm555 install $out
25− install -Dm444 build.info $out
24+ install -Dm444 gitstatus.plugin.sh -t $out/share/gitstatus/
25+ install -Dm444 gitstatus.plugin.zsh -t $out/share/gitstatus/
26+ install -Dm555 install -t $out/share/gitstatus/
27+ install -Dm444 build.info -t $out/share/gitstatus/
28+
29+ # the fallback path is wrong in the case of home-manager
30+ # because the FHS directories don't start at /
31+ substituteInPlace install \
32+ --replace "_gitstatus_install_main ." "_gitstatus_install_main $out"
2633 '';
34+
2735 # Don't install the "install" and "build.info" files, which the end user
2836 # should not need to worry about.
2937 pathsToLink = [
3038 "/bin/gitstatusd"
31− "/gitstatus.plugin.sh"
32− "/gitstatus.plugin.zsh"
39+ "/share/gitstatus/gitstatus.plugin.sh"
40+ "/share/gitstatus/gitstatus.plugin.zsh"
3341 ];
3442
3543 # The install check sets up an empty Git repository and a minimal zshrc that
@@ -47,7 +55,7 @@ stdenv.mkDerivation rec {
4755
4856 echo '
4957 GITSTATUS_LOG_LEVEL=DEBUG
50− . $out/gitstatus.plugin.zsh || exit 1
58+ . $out/share/gitstatus/gitstatus.plugin.zsh || exit 1
5159
5260 gitstatus_stop NIX_TEST && gitstatus_start NIX_TEST
5361 gitstatus_query NIX_TEST
@@ -77,6 +85,6 @@ stdenv.mkDerivation rec {
7785 description = "10x faster implementation of `git status` command";
7886 homepage = "https://github.com/romkatv/gitstatus";
7987 license = licenses.gpl3Only;
80− maintainers = with maintainers; [ mmlb hexa ];
88+ maintainers = with maintainers; [ mmlb hexa SuperSandro2000 ];
8189 };
8290}