1{ lib
2, resholve
3, fetchFromGitHub
4, fetchpatch
5, bash
6, coreutils
7, git
8, gnugrep
9, gawk
10, curl
11, hostname
12, gnused
13, findutils
14, lftp
15, pandoc
16, man
17}:
18
19resholve.mkDerivation rec {
20 pname = "git-ftp";
21 version = "1.6.0";
22 src = fetchFromGitHub {
23 owner = "git-ftp";
24 repo = "git-ftp";
25 rev = version;
26 sha256 = "1hxkqf7jbrx24q18yxpnd3dxzh4xk6asymwkylp1x7zg6mcci87d";
27 };
28
29 dontBuild = true;
30
31 # fix bug/typo; PRed upstream @
32 # https://github.com/git-ftp/git-ftp/pull/628
33 patches = [
34 (fetchpatch {
35 name = "fix-function-invocation-typo.patch";
36 url = "https://github.com/git-ftp/git-ftp/commit/cddf7cbba80e710758f6aac0ec0d77552ea8cd75.patch";
37 sha256 = "sha256-2B0QaMJi78Bg3bA1jp41aiyql1/LCryoaDs7+xmS1HY=";
38 })
39 ];
40
41 installPhase = ''
42 make install-all prefix=$out
43 '';
44
45 nativeBuildInputs = [ pandoc man ];
46
47 solutions = {
48 git-ftp = {
49 scripts = [ "bin/git-ftp" ];
50 interpreter = "${bash}/bin/bash";
51 inputs = [
52 coreutils
53 git
54 gnugrep
55 gawk
56 curl
57 hostname
58 gnused
59 findutils
60 lftp
61 ];
62 fake = {
63 # don't resolve impure system macOS security
64 # caution: will still be fragile if PATH is bad
65 # TODO: fixable once we figure out how to handle
66 # this entire class of problem...
67 "external" = [ "security" ];
68 };
69 keep = {
70 # looks like run-time user/env/git-config controlled
71 "$GIT_PAGER" = true;
72 "$hook" = true; # presumably git hooks given context
73 };
74 execer = [
75 # TODO: rm when binlore/resholve handle git; manually
76 # checked and see no obvious subexec for now
77 "cannot:${git}/bin/git"
78 /*
79 Mild uncertainty here. There *are* commandlikes in
80 the arguments (especially wait & cd), but I think they are
81 fine as-is, because I'm reading them as:
82 1. ftp commands
83 2. running on the remote anyways
84
85 See https://github.com/git-ftp/git-ftp/blob/057f7d8e9f00ffc5a8c6ceaa4be30af2939df41a/git-ftp#L1214-L1221
86 */
87 "cannot:${lftp}/bin/lftp"
88 ];
89 };
90 };
91
92 meta = with lib; {
93 description = "Git powered FTP client written as shell script";
94 homepage = "https://git-ftp.github.io/";
95 license = licenses.gpl3;
96 maintainers = with maintainers; [ tweber ];
97 platforms = platforms.unix;
98 };
99}