From 6b05ff00e95fc7eb446952468c3c0e677eea73c3 Mon Sep 17 00:00:00 2001 From: xd1le Date: Thu, 31 Aug 2017 12:33:12 +1000 Subject: [PATCH 1/2] deer: init at 1.4 I wrote the patch. Unfortunately it's Nix specific because upstream rejected it because Ubuntu Trusty's version of realpath doesn't seem to have the `--relative-to` option. (Upstream used to use realpath before). But for Nix, our version of realpath is recent enough. Also, upstream will probably use realpath again anyway in May 2019 when Ubuntu Trusty becomes unsupported, so this patch should probably be used. --- pkgs/shells/zsh-deer/default.nix | 36 +++++++++++++++++++++++++++++ pkgs/shells/zsh-deer/realpath.patch | 28 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 66 insertions(+) create mode 100644 pkgs/shells/zsh-deer/default.nix create mode 100644 pkgs/shells/zsh-deer/realpath.patch diff --git a/pkgs/shells/zsh-deer/default.nix b/pkgs/shells/zsh-deer/default.nix new file mode 100644 index 000000000000..3f39edfd9632 --- /dev/null +++ b/pkgs/shells/zsh-deer/default.nix @@ -0,0 +1,36 @@ +{ stdenv, fetchFromGitHub, perl }: + +let + version = "1.4"; + name = "deer-${version}"; +in stdenv.mkDerivation { + inherit name; + + src = fetchFromGitHub { + owner = "Vifon"; + repo = "deer"; + rev = "v${version}"; + sha256 = "1xnbnbi0zk2xsyn8dqsmyxqlfnl36pb1wwibnlp0dxixw6sfymyl"; + }; + + prePatch = '' + sed -i '157s/perl/'\ + "$(echo ${perl}/bin/perl | sed 's/\//\\\//g')"'/' \ + deer + ''; + + patches = [ ./realpath.patch ]; + + installPhase = '' + mkdir -p $out/share/zsh/site-functions/ + cp deer $out/share/zsh/site-functions/ + ''; + + meta = with stdenv.lib; { + description = "Ranger-like file navigation for zsh"; + homepage = "https://github.com/Vifon/deer"; + license = licenses.gpl3Plus; + maintainers = maintainers.vyp; + platforms = platforms.unix; + }; +} diff --git a/pkgs/shells/zsh-deer/realpath.patch b/pkgs/shells/zsh-deer/realpath.patch new file mode 100644 index 000000000000..03850d7e5c12 --- /dev/null +++ b/pkgs/shells/zsh-deer/realpath.patch @@ -0,0 +1,28 @@ +From ceadb2f11119143af4f590ea6b05a531483219b5 Mon Sep 17 00:00:00 2001 +From: xd1le +Date: Wed, 30 Aug 2017 17:27:20 +1000 +Subject: [PATCH] use realpath instead of python to calculate relative path + +--- + deer | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/deer b/deer +index 3d89dea..804a871 100644 +--- a/deer ++++ b/deer +@@ -259,10 +259,7 @@ deer-get-relative() + { + local TMP + TMP=${1:-${DEER_DIRNAME%/}/$DEER_BASENAME[$DEER_DIRNAME]} +- TMP="`python -c ' +-import sys, os +-print(os.path.relpath(sys.argv[1], sys.argv[2])) +-' $TMP ${DEER_STARTDIR:-$PWD}`" ++ TMP="`realpath --relative-to=${DEER_STARTDIR:-$PWD} $TMP`" + print -R $TMP:q + } + +-- +2.14.1 + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6684d0accd0e..937064e5ed7c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1597,6 +1597,8 @@ with pkgs; debootstrap = callPackage ../tools/misc/debootstrap { }; + deer = callPackage ../shells/zsh-deer { }; + detox = callPackage ../tools/misc/detox { }; devilspie2 = callPackage ../applications/misc/devilspie2 { From 6d988e5e568d0804083d1faff2e367348d9a1072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 31 Aug 2017 07:05:18 +0100 Subject: [PATCH 2/2] deer: simpler perl patch --- pkgs/shells/zsh-deer/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/shells/zsh-deer/default.nix b/pkgs/shells/zsh-deer/default.nix index 3f39edfd9632..3fa941c08c39 100644 --- a/pkgs/shells/zsh-deer/default.nix +++ b/pkgs/shells/zsh-deer/default.nix @@ -14,9 +14,8 @@ in stdenv.mkDerivation { }; prePatch = '' - sed -i '157s/perl/'\ - "$(echo ${perl}/bin/perl | sed 's/\//\\\//g')"'/' \ - deer + substituteInPlace deer \ + --replace " perl " " ${perl}/bin/perl " ''; patches = [ ./realpath.patch ];