1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 makeWrapper,
6 cmake,
7 ninja,
8 pkg-config,
9 m4,
10 perl,
11 bash,
12 xdg-utils,
13 zip,
14 unzip,
15 gzip,
16 bzip2,
17 gnutar,
18 p7zip,
19 xz,
20 withTTYX ? true,
21 libX11,
22 withGUI ? true,
23 wxGTK32,
24 withUCD ? true,
25 libuchardet,
26
27 # Plugins
28 withColorer ? true,
29 spdlog,
30 libxml2,
31 withMultiArc ? true,
32 libarchive,
33 pcre,
34 withNetRocks ? true,
35 openssl,
36 libssh,
37 samba,
38 libnfs,
39 neon,
40 withPython ? false,
41 python3Packages,
42}:
43
44stdenv.mkDerivation rec {
45 pname = "far2l";
46 version = "2.6.5";
47
48 src = fetchFromGitHub {
49 owner = "elfmz";
50 repo = "far2l";
51 rev = "v_${version}";
52 sha256 = "sha256-a/k36O19z/lHnETOGIbTJ7BNAI5zOQxVUSp+nIM08i4=";
53 };
54
55 nativeBuildInputs = [
56 cmake
57 ninja
58 pkg-config
59 m4
60 perl
61 makeWrapper
62 ];
63
64 buildInputs =
65 lib.optional withTTYX libX11
66 ++ lib.optional withGUI wxGTK32
67 ++ lib.optional withUCD libuchardet
68 ++ lib.optionals withColorer [
69 spdlog
70 libxml2
71 ]
72 ++ lib.optionals withMultiArc [
73 libarchive
74 pcre
75 ]
76 ++ lib.optionals withNetRocks [
77 openssl
78 libssh
79 libnfs
80 neon
81 ]
82 ++ lib.optional (withNetRocks && !stdenv.hostPlatform.isDarwin) samba # broken on darwin
83 ++ lib.optionals withPython (
84 with python3Packages;
85 [
86 python
87 cffi
88 debugpy
89 pcpp
90 ]
91 );
92
93 postPatch = ''
94 patchShebangs python/src/prebuild.sh
95 patchShebangs far2l/bootstrap/view.sh
96 '';
97
98 cmakeFlags = [
99 (lib.cmakeBool "TTYX" withTTYX)
100 (lib.cmakeBool "USEWX" withGUI)
101 (lib.cmakeBool "USEUCD" withUCD)
102 (lib.cmakeBool "COLORER" withColorer)
103 (lib.cmakeBool "MULTIARC" withMultiArc)
104 (lib.cmakeBool "NETROCKS" withNetRocks)
105 (lib.cmakeBool "PYTHON" withPython)
106 ]
107 ++ lib.optionals withPython [
108 (lib.cmakeFeature "VIRTUAL_PYTHON" "python")
109 (lib.cmakeFeature "VIRTUAL_PYTHON_VERSION" "python")
110 ];
111
112 runtimeDeps = [
113 unzip
114 zip
115 p7zip
116 xz
117 gzip
118 bzip2
119 gnutar
120 ];
121
122 postInstall = ''
123 wrapProgram $out/bin/far2l \
124 --prefix PATH : ${lib.makeBinPath runtimeDeps} \
125 --suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
126 '';
127
128 meta = with lib; {
129 description = "Linux port of FAR Manager v2, a program for managing files and archives in Windows operating systems";
130 homepage = "https://github.com/elfmz/far2l";
131 license = licenses.gpl2Only;
132 maintainers = with maintainers; [ hypersw ];
133 platforms = platforms.unix;
134 };
135}