tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
far2l: 2020-12-30 → 2.4.0, enable on darwin
Nikolay Korotkiy
4 years ago
b375c243
bc59ba15
+74
-53
3 changed files
expand all
collapse all
unified
split
pkgs
applications
misc
far2l
default.nix
python_prebuild.patch
top-level
all-packages.nix
+53
-53
pkgs/applications/misc/far2l/default.nix
···
1
1
-
{ lib, stdenv, fetchFromGitHub, makeWrapper, cmake, pkg-config, wxGTK30, glib, pcre, m4, bash
2
2
-
, xdg-utils, gvfs, zip, unzip, gzip, bzip2, gnutar, p7zip, xz, imagemagick
3
3
-
, libuchardet, spdlog, xercesc, openssl, libssh, samba, neon, libnfs, libarchive }:
1
1
+
{ lib, stdenv, fetchFromGitHub, makeWrapper, cmake, ninja, pkg-config, m4, bash
2
2
+
, xdg-utils, zip, unzip, gzip, bzip2, gnutar, p7zip, xz
3
3
+
, IOKit, Carbon, Cocoa, AudioToolbox, OpenGL
4
4
+
, withTTYX ? true, libX11
5
5
+
, withGUI ? true, wxGTK30, wxmac
6
6
+
, withUCD ? true, libuchardet
7
7
+
8
8
+
# Plugins
9
9
+
, withColorer ? true, spdlog, xercesc
10
10
+
, withMultiArc ? true, libarchive, pcre
11
11
+
, withNetRocks ? true, openssl, libssh, samba, libnfs, neon
12
12
+
, withPython ? false, python3Packages
13
13
+
}:
4
14
15
15
+
let
16
16
+
wxWidgets = (if stdenv.isDarwin then wxmac else wxGTK30);
17
17
+
in
5
18
stdenv.mkDerivation rec {
6
19
pname = "far2l";
7
7
-
version = "2020-12-30.git${builtins.substring 0 7 src.rev}";
20
20
+
version = "2.4.0";
8
21
9
22
src = fetchFromGitHub {
10
23
owner = "elfmz";
11
24
repo = "far2l";
12
12
-
rev = "52c1372441443aafd1a7dff6f17969a6ec19885d";
13
13
-
sha256 = "0s7427fgxzj5zkyy6mhb4y5hqa6adsr30m0bigycp12b0495ryx0";
25
25
+
rev = "v_${version}";
26
26
+
sha256 = "sha256-nfoAElPLQ97lj65MBX4JMEdgTFbkdEbR1BazYZgV/lg=";
14
27
};
15
28
16
16
-
nativeBuildInputs = [ cmake pkg-config m4 makeWrapper imagemagick ];
29
29
+
patches = [ ./python_prebuild.patch ];
30
30
+
31
31
+
nativeBuildInputs = [ cmake ninja pkg-config m4 makeWrapper ];
17
32
18
18
-
buildInputs = [ wxGTK30 glib pcre libuchardet spdlog xercesc ] # base requirements of the build
19
19
-
++ [ openssl libssh samba neon libnfs libarchive ]; # optional feature packages, like protocol support for Network panel, or archive formats
20
20
-
#++ lib.optional stdenv.isDarwin Cocoa # Mac support -- disabled, see "meta.broken" below
33
33
+
buildInputs = lib.optional withTTYX libX11
34
34
+
++ lib.optional withGUI wxWidgets
35
35
+
++ lib.optional withUCD libuchardet
36
36
+
++ lib.optionals withColorer [ spdlog xercesc ]
37
37
+
++ lib.optionals withMultiArc [ libarchive pcre ]
38
38
+
++ lib.optionals withNetRocks [ openssl libssh libnfs neon ]
39
39
+
++ lib.optional (withNetRocks && !stdenv.isDarwin) samba # broken on darwin
40
40
+
++ lib.optionals withPython (with python3Packages; [ python cffi debugpy pcpp ])
41
41
+
++ lib.optionals stdenv.isDarwin [ IOKit Carbon Cocoa AudioToolbox OpenGL ];
21
42
22
22
-
postPatch = lib.optionalString stdenv.isLinux ''
23
23
-
substituteInPlace far2l/bootstrap/trash.sh \
24
24
-
--replace 'gvfs-trash' '${gvfs}/bin/gvfs-trash'
43
43
+
postPatch = ''
44
44
+
patchShebangs python/src/prebuild.sh
45
45
+
substituteInPlace far2l/src/vt/vtcompletor.cpp \
46
46
+
--replace '"/bin/bash"' '"${bash}/bin/bash"'
47
47
+
substituteInPlace far2l/src/cfg/config.cpp \
48
48
+
--replace '"/bin/bash"' '"${bash}/bin/bash"'
25
49
'' + lib.optionalString stdenv.isDarwin ''
26
26
-
substituteInPlace far2l/CMakeLists.txt \
50
50
+
substituteInPlace WinPort/src/Backend/WX/CMakeLists.txt \
27
51
--replace "-framework System" -lSystem
28
28
-
'' + ''
29
29
-
echo 'echo ${version}' > far2l/bootstrap/scripts/vbuild.sh
30
30
-
substituteInPlace far2l/bootstrap/open.sh \
31
31
-
--replace 'xdg-open' '${xdg-utils}/bin/xdg-open'
32
32
-
substituteInPlace far2l/vtcompletor.cpp \
33
33
-
--replace '"/bin/bash"' '"${bash}/bin/bash"'
34
34
-
substituteInPlace multiarc/src/formats/zip/zip.cpp \
35
35
-
--replace '"unzip ' '"${unzip}/bin/unzip ' \
36
36
-
--replace '"zip ' '"${zip}/bin/zip '
37
37
-
substituteInPlace multiarc/src/formats/7z/7z.cpp \
38
38
-
--replace '"^7z ' '"^${p7zip}/lib/p7zip/7z ' \
39
39
-
--replace '"7z ' '"${p7zip}/lib/p7zip/7z '
40
40
-
substituteInPlace multiarc/src/formats/targz/targz.cpp \
41
41
-
--replace '"xz ' '"${xz}/bin/xz ' \
42
42
-
--replace '"gzip ' '"${gzip}/bin/gzip ' \
43
43
-
--replace '"bzip2 ' '"${bzip2}/bin/bzip2 ' \
44
44
-
--replace '"tar ' '"${gnutar}/bin/tar '
45
52
'';
46
53
47
47
-
installPhase = ''
48
48
-
mkdir -p $out/bin $out/share/applications $out/share/icons/hicolor/scalable/apps
49
49
-
cp -dpR install $out/share/far2l
50
50
-
mv $out/share/far2l/far2l $out/bin/
51
51
-
ln -s -r --force $out/bin/far2l $out/share/far2l/far2l_askpass
52
52
-
ln -s -r --force $out/bin/far2l $out/share/far2l/far2l_sudoapp
54
54
+
cmakeFlags = lib.mapAttrsToList (k: v: "-D${k}=${if v then "yes" else "no"}") {
55
55
+
TTYX = withTTYX;
56
56
+
USEWX = withGUI;
57
57
+
USEUCD = withUCD;
58
58
+
COLORER = withColorer;
59
59
+
MULTIARC = withMultiArc;
60
60
+
NETROCKS = withNetRocks;
61
61
+
PYTHON = withPython;
62
62
+
};
53
63
54
54
-
cp ../far2l/DE/far2l.desktop $out/share/applications/far2l.desktop
55
55
-
substituteInPlace $out/share/applications/far2l.desktop --replace \''${CMAKE_INSTALL_PREFIX} "$out"
64
64
+
runtimeDeps = [ unzip zip p7zip xz gzip bzip2 gnutar xdg-utils ];
56
65
57
57
-
cp ../far2l/DE/icons/hicolor/1024x1024/apps/far2l.svg $out/share/icons/hicolor/scalable/apps/
58
58
-
convert -size 128x128 ../far2l/DE/icons/far2l.svg $out/share/icons/far2l.png
59
59
-
for size in 16x16 24x24 32x32 48x48 64x64 72x72 96x96 128x128 192x192 256x256 512x512 1024x1024; do
60
60
-
mkdir -p $out/share/icons/hicolor/$size/apps
61
61
-
convert -size $size ../far2l/DE/icons/hicolor/$size/apps/far2l.svg $out/share/icons/hicolor/$size/apps/far2l.png
62
62
-
done
63
63
-
'' + lib.optionalString stdenv.isDarwin ''
64
64
-
wrapProgram $out/bin/far2l --argv0 $out/bin/far2l
66
66
+
postInstall = ''
67
67
+
wrapProgram $out/bin/far2l \
68
68
+
--argv0 $out/bin/far2l \
69
69
+
--prefix PATH : ${lib.makeBinPath runtimeDeps}
65
70
'';
66
71
67
67
-
stripDebugList = [ "bin" "share" ];
68
68
-
69
72
meta = with lib; {
70
73
description = "Linux port of FAR Manager v2, a program for managing files and archives in Windows operating systems";
71
74
homepage = "https://github.com/elfmz/far2l";
72
75
license = licenses.gpl2Plus; # NOTE: might change in far2l repo soon, check next time
73
76
maintainers = with maintainers; [ volth hypersw ];
74
74
-
platforms = platforms.all;
75
75
-
# fails to compile with:
76
76
-
# error: no member named 'st_ctim' in 'stat'
77
77
-
broken = stdenv.isDarwin;
77
77
+
platforms = platforms.unix;
78
78
};
79
79
}
+20
pkgs/applications/misc/far2l/python_prebuild.patch
···
1
1
+
diff --git i/python/src/prebuild.sh w/python/src/prebuild.sh
2
2
+
index d2847ee5..aa1ecc53 100755
3
3
+
--- i/python/src/prebuild.sh
4
4
+
+++ w/python/src/prebuild.sh
5
5
+
@@ -12,9 +12,6 @@ mkdir -p "$DST/incpy"
6
6
+
if [ ! -f "$DST/python/.prepared" ]; then
7
7
+
echo "Preparing python virtual env at $DST/python using $PYTHON"
8
8
+
mkdir -p "$DST/python"
9
9
+
- $PYTHON -m venv --system-site-packages "$DST/python"
10
10
+
- "$DST/python/bin/python" -m pip install --upgrade pip || true
11
11
+
- "$DST/python/bin/python" -m pip install --ignore-installed cffi debugpy pcpp
12
12
+
$PREPROCESSOR "$SRC/python/src/consts.gen" | sh > "${DST}/incpy/consts.h"
13
13
+
14
14
+
echo "1" > "$DST/python/.prepared"
15
15
+
@@ -26,4 +23,4 @@ cp -f -R \
16
16
+
"$SRC/python/configs/plug/far2l/"* \
17
17
+
"$DST/incpy/"
18
18
+
19
19
+
-"$DST/python/bin/python" "$SRC/python/src/pythongen.py" "${SRC}" "${DST}/incpy"
20
20
+
+"python" "$SRC/python/src/pythongen.py" "${SRC}" "${DST}/incpy"
+1
pkgs/top-level/all-packages.nix
···
16331
16331
16332
16332
far2l = callPackage ../applications/misc/far2l {
16333
16333
stdenv = if stdenv.cc.isClang then llvmPackages.stdenv else stdenv;
16334
16334
+
inherit (darwin.apple_sdk.frameworks) IOKit Carbon Cocoa AudioToolbox OpenGL;
16334
16335
};
16335
16336
16336
16337
farbfeld = callPackage ../development/libraries/farbfeld { };