summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorRyan Trinkle <ryan.trinkle@gmail.com>2019-08-24 10:13:00 -0400
committerMaximilian Bosch <maximilian@mbosch.me>2019-08-24 16:13:00 +0200
commit3bc52453a484b48da72511bb62e5943490bcaec2 (patch)
treee48229974ab51b0390cac28ed6cf8d0db558c194 /pkgs/applications
parentd7d15fb454dab4268e7b99af4f54c0f4a5bc6ba3 (diff)
downloadnixpkgs-3bc52453a484b48da72511bb62e5943490bcaec2.tar
nixpkgs-3bc52453a484b48da72511bb62e5943490bcaec2.tar.gz
nixpkgs-3bc52453a484b48da72511bb62e5943490bcaec2.tar.bz2
nixpkgs-3bc52453a484b48da72511bb62e5943490bcaec2.tar.lz
nixpkgs-3bc52453a484b48da72511bb62e5943490bcaec2.tar.xz
nixpkgs-3bc52453a484b48da72511bb62e5943490bcaec2.tar.zst
nixpkgs-3bc52453a484b48da72511bb62e5943490bcaec2.zip
git-subrepo: init at 0.4.0 (#67217)
* git-subrepo: init at 0.4.0

* Apply suggestions from code review

Co-Authored-By: worldofpeace <worldofpeace@protonmail.ch>
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/version-management/git-and-tools/default.nix2
-rw-r--r--pkgs/applications/version-management/git-and-tools/git-subrepo/default.nix58
-rw-r--r--pkgs/applications/version-management/git-and-tools/git-subrepo/zsh-completion.patch32
3 files changed, 92 insertions, 0 deletions
diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix
index c7d77bf3498..e64254ed29f 100644
--- a/pkgs/applications/version-management/git-and-tools/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/default.nix
@@ -121,6 +121,8 @@ let
 
   git-stree = callPackage ./git-stree { };
 
+  git-subrepo = callPackage ./git-subrepo { };
+
   git-sync = callPackage ./git-sync { };
 
   git-test = callPackage ./git-test { };
diff --git a/pkgs/applications/version-management/git-and-tools/git-subrepo/default.nix b/pkgs/applications/version-management/git-and-tools/git-subrepo/default.nix
new file mode 100644
index 00000000000..24a1e1ac937
--- /dev/null
+++ b/pkgs/applications/version-management/git-and-tools/git-subrepo/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchFromGitHub, git, makeWrapper, which }:
+
+stdenv.mkDerivation rec {
+  pname = "git-subrepo";
+  version = "0.4.0";
+
+  src = fetchFromGitHub {
+    owner = "ingydotnet";
+    repo = "git-subrepo";
+    rev = version;
+    sha256 = "05m2dm9gq2nggwnxxdyq2kjj584sn2lxk66pr1qhjxnk81awj9l7";
+  };
+
+  nativeBuildInputs = [
+    makeWrapper
+    which
+  ];
+
+  buildInputs = [
+    git
+  ];
+
+  makeFlags = [
+    "PREFIX=${placeholder ''out''}"
+    "INSTALL_LIB=${placeholder ''out''}/bin"
+    "INSTALL_MAN=${placeholder ''out''}/share/man/man1"
+  ];
+
+  patches = [
+    # Allow zsh completion to work even though we aren't installing from a git
+    # clone.  Also submitted upstream as
+    # https://github.com/ingydotnet/git-subrepo/pull/420
+    ./zsh-completion.patch
+  ];
+
+  postInstall = ''
+    ZSH_COMP_DIR="$out/share/zsh/vendor-completions"
+    mkdir -p "$ZSH_COMP_DIR"
+    cp share/zsh-completion/_git-subrepo "$ZSH_COMP_DIR/"
+
+    BASH_COMP_DIR="$out/share/bash-completion/completions"
+    mkdir -p "$BASH_COMP_DIR"
+    cp share/completion.bash "$BASH_COMP_DIR/git-subrepo"
+  '';
+
+  postFixup = ''
+    wrapProgram $out/bin/git-subrepo \
+      --prefix PATH : "${git}/bin"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/ingydotnet/git-subrepo;
+    description = "Git submodule alternative";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.ryantrinkle ];
+  };
+}
diff --git a/pkgs/applications/version-management/git-and-tools/git-subrepo/zsh-completion.patch b/pkgs/applications/version-management/git-and-tools/git-subrepo/zsh-completion.patch
new file mode 100644
index 00000000000..dcba5ba6eea
--- /dev/null
+++ b/pkgs/applications/version-management/git-and-tools/git-subrepo/zsh-completion.patch
@@ -0,0 +1,32 @@
+diff --git a/pkg/bin/generate-completion.pl b/pkg/bin/generate-completion.pl
+index 85ae3b8..d3e423c 100644
+--- a/pkg/bin/generate-completion.pl
++++ b/pkg/bin/generate-completion.pl
+@@ -82,11 +82,6 @@ sub generate_zsh {
+ 
+ # DO NOT EDIT. This file generated by pkg/bin/generate-completion.pl.
+ 
+-if [[ -z $GIT_SUBREPO_ROOT ]]; then
+-	echo 'GIT_SUBREPO_ROOT is null; has `/path/to/git-subrepo/.rc` been sourced?'
+-	return 3
+-fi
+-
+ _git-subrepo() {
+     typeset -A opt_args
+     local curcontext="$curcontext" state line context
+diff --git a/share/zsh-completion/_git-subrepo b/share/zsh-completion/_git-subrepo
+index fc82be2..a8069d9 100644
+--- a/share/zsh-completion/_git-subrepo
++++ b/share/zsh-completion/_git-subrepo
+@@ -3,11 +3,6 @@
+ 
+ # DO NOT EDIT. This file generated by pkg/bin/generate-completion.pl.
+ 
+-if [[ -z $GIT_SUBREPO_ROOT ]]; then
+-	echo 'GIT_SUBREPO_ROOT is null; has `/path/to/git-subrepo/.rc` been sourced?'
+-	return 3
+-fi
+-
+ _git-subrepo() {
+     typeset -A opt_args
+     local curcontext="$curcontext" state line context