summary refs log tree commit diff
path: root/pkgs/applications/version-management/git-vendor/default.nix
blob: 9d72cc18b94fba8d2aa7076a32268e7780ee01e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib, stdenv, fetchFromGitHub, writeShellScriptBin, skawarePackages
}:

let
  version = "1.3.0";
  sha256 = "sha256-CFv9gZQHeEiZctJFyB6PJ1dVNkrQ7PlVtgZuteQQTJ0=";

in stdenv.mkDerivation {
  pname = "git-vendor";
  inherit version;

  src = fetchFromGitHub {
    owner = "brettlangdon";
    repo = "git-vendor";
    rev = "v${version}";
    inherit sha256;
  };

  outputs = [ "bin" "man" "doc" "out" ];

  PREFIX = (placeholder "out");
  BINPREFIX = "${placeholder "bin"}/bin";
  MANPREFIX = "${placeholder "man"}/share/man/man1";

  buildInputs = [
    # stubbing out a `git config` check that `make install` tries to do
    (writeShellScriptBin "git" "")
  ];

  postInstall = ''
    ${skawarePackages.cleanPackaging.commonFileActions {
        docFiles = [
          "LICENSE"
          "README.md"
        ];
        noiseFiles = [
          "bin/git-vendor"
          "Makefile"
          "etc/bash_completion.sh"
          "man"
          "install.sh"
        ];
      }} $doc/share/doc/git-vendor
  '';

  postFixup = ''
    ${skawarePackages.cleanPackaging.checkForRemainingFiles}
  '';

  meta = {
    description = "A git command for managing vendored dependencies";
    longDescription = ''
      git-vendor is a wrapper around git-subtree commands for checking out and updating vendored dependencies.

      By default git-vendor conforms to the pattern used for vendoring golang dependencies:
        * Dependencies are stored under vendor/ directory in the repo.
        * Dependencies are stored under the fully qualified project path.
            e.g. https://github.com/brettlangdon/forge will be stored under vendor/github.com/brettlangdon/forge.
    '';
    homepage = "https://github.com/brettlangdon/git-vendor";
    license = lib.licenses.mit;
    maintainers = [ ];
    platforms = lib.platforms.all;
  };

}