nixpkgs/pkgs/applications/misc/far2l/default.nix

87 lines
3.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper, cmake, pkg-config, wxGTK30, glib, pcre, m4, bash,
2021-02-01 09:05:09 +01:00
xdg-utils, gvfs, zip, unzip, gzip, bzip2, gnutar, p7zip, xz, imagemagick, darwin }:
2017-03-21 03:52:35 +01:00
2019-12-16 17:53:46 +01:00
let
newer-colorer-schemes = fetchFromGitHub {
owner = "colorer";
repo = "Colorer-schemes";
rev = "7c831f5e94a90530ace8b2bb9916210e3a2fcda6"; # 2019-11-28 (far2l has older Colorer-schemes)
sha256 = "18vaahdz5i7xdf00c9h9kjjswm4jszywm8zkhva4c4ivr4qqnv2c";
};
in
2017-03-21 03:52:35 +01:00
stdenv.mkDerivation rec {
2019-12-16 17:53:46 +01:00
pname = "far2l";
version = "2019-12-14.git${builtins.substring 0 7 src.rev}";
2017-03-21 03:52:35 +01:00
src = fetchFromGitHub {
owner = "elfmz";
repo = "far2l";
2018-07-21 18:31:05 +02:00
rev = "dceaa3918ea2c5e43600bad3fc63f861b8d26fc4";
sha256 = "1ssd3hwz4b7vl4r858d9whl61cn23pgcamcjmvfa6ysf4x2b7sgi";
2017-03-21 03:52:35 +01:00
};
nativeBuildInputs = [ cmake pkg-config m4 makeWrapper imagemagick ];
2017-03-21 03:52:35 +01:00
2017-09-27 00:28:51 +02:00
buildInputs = [ wxGTK30 glib pcre ]
2021-01-15 06:42:41 +01:00
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Cocoa;
2017-03-21 03:52:35 +01:00
2021-01-15 06:42:41 +01:00
postPatch = lib.optionalString stdenv.isLinux ''
2018-07-21 18:31:05 +02:00
substituteInPlace far2l/bootstrap/trash.sh \
2017-03-21 03:52:35 +01:00
--replace 'gvfs-trash' '${gvfs}/bin/gvfs-trash'
2021-01-15 06:42:41 +01:00
'' + lib.optionalString stdenv.isDarwin ''
2017-09-27 00:28:51 +02:00
substituteInPlace far2l/CMakeLists.txt \
--replace "-framework System" -lSystem
'' + ''
2019-12-16 17:53:46 +01:00
echo 'echo ${version}' > far2l/bootstrap/scripts/vbuild.sh
2017-03-21 03:52:35 +01:00
substituteInPlace far2l/bootstrap/open.sh \
2021-02-01 09:05:09 +01:00
--replace 'xdg-open' '${xdg-utils}/bin/xdg-open'
2017-03-21 03:52:35 +01:00
substituteInPlace far2l/vtcompletor.cpp \
--replace '"/bin/bash"' '"${bash}/bin/bash"'
substituteInPlace multiarc/src/formats/zip/zip.cpp \
--replace '"unzip ' '"${unzip}/bin/unzip ' \
--replace '"zip ' '"${zip}/bin/zip '
substituteInPlace multiarc/src/formats/7z/7z.cpp \
--replace '"^7z ' '"^${p7zip}/lib/p7zip/7z ' \
--replace '"7z ' '"${p7zip}/lib/p7zip/7z '
substituteInPlace multiarc/src/formats/targz/targz.cpp \
--replace '"xz ' '"${xz}/bin/xz ' \
--replace '"gzip ' '"${gzip}/bin/gzip ' \
--replace '"bzip2 ' '"${bzip2}/bin/bzip2 ' \
--replace '"tar ' '"${gnutar}/bin/tar '
2018-07-21 18:31:05 +02:00
2019-12-16 17:53:46 +01:00
cp ${newer-colorer-schemes}/hrc/hrc/base/nix.hrc colorer/configs/base/hrc/base/
cp ${newer-colorer-schemes}/hrc/hrc/base/cpp.hrc colorer/configs/base/hrc/base/
cp ${newer-colorer-schemes}/hrc/hrc/inet/jscript.hrc colorer/configs/base/hrc/base/
2017-03-21 03:52:35 +01:00
'';
installPhase = ''
2017-05-02 12:18:04 +02:00
mkdir -p $out/bin $out/share/applications $out/share/icons/hicolor/scalable/apps
cp -dpR install $out/share/far2l
mv $out/share/far2l/far2l $out/bin/
ln -s -r --force $out/bin/far2l $out/share/far2l/far2l_askpass
ln -s -r --force $out/bin/far2l $out/share/far2l/far2l_sudoapp
2020-01-18 18:50:37 +01:00
cp ../far2l/DE/far2l.desktop $out/share/applications/far2l.desktop
substituteInPlace $out/share/applications/far2l.desktop --replace \''${CMAKE_INSTALL_PREFIX} "$out"
2017-05-02 12:18:04 +02:00
cp ../far2l/DE/icons/hicolor/1024x1024/apps/far2l.svg $out/share/icons/hicolor/scalable/apps/
convert -size 128x128 ../far2l/DE/icons/far2l.svg $out/share/icons/far2l.png
for size in 16x16 24x24 32x32 48x48 64x64 72x72 96x96 128x128 192x192 256x256 512x512 1024x1024; do
mkdir -p $out/share/icons/hicolor/$size/apps
convert -size $size ../far2l/DE/icons/hicolor/$size/apps/far2l.svg $out/share/icons/hicolor/$size/apps/far2l.png
done
2021-01-15 06:42:41 +01:00
'' + lib.optionalString stdenv.isDarwin ''
wrapProgram $out/bin/far2l --argv0 $out/bin/far2l
2017-03-21 03:52:35 +01:00
'';
stripDebugList = [ "bin" "share" ];
2017-03-21 03:52:35 +01:00
meta = with lib; {
2017-03-21 03:52:35 +01:00
description = "An orthodox file manager";
homepage = "https://github.com/elfmz/far2l";
2017-03-21 03:52:35 +01:00
license = licenses.gpl2;
maintainers = [ maintainers.volth ];
platforms = platforms.all;
};
}