2021-01-09 10:05:03 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2021-12-21 02:18:32 +00:00
|
|
|
, fetchFromSourcehut
|
2021-01-09 10:05:03 +00:00
|
|
|
, asciidoc
|
2020-10-19 23:25:03 +00:00
|
|
|
, cmocka
|
|
|
|
, docbook_xsl
|
2021-01-09 10:05:03 +00:00
|
|
|
, libxslt
|
|
|
|
, meson
|
|
|
|
, ninja
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-10-19 23:25:03 +00:00
|
|
|
, icu
|
2021-01-09 10:05:03 +00:00
|
|
|
, pango
|
|
|
|
, inih
|
|
|
|
, withWindowSystem ? "all"
|
|
|
|
, xorg
|
|
|
|
, libxkbcommon
|
2020-10-19 23:25:03 +00:00
|
|
|
, libGLU
|
2021-01-09 10:05:03 +00:00
|
|
|
, wayland
|
|
|
|
, withBackends ? [ "freeimage" "libtiff" "libjpeg" "libpng" "librsvg" "libnsgif" "libheif" ]
|
|
|
|
, freeimage
|
|
|
|
, libtiff
|
2020-10-19 23:25:03 +00:00
|
|
|
, libjpeg_turbo
|
|
|
|
, libpng
|
|
|
|
, librsvg
|
|
|
|
, netsurf
|
2021-01-09 10:05:03 +00:00
|
|
|
, libheif
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
let
|
|
|
|
windowSystems = {
|
|
|
|
all = windowSystems.x11 ++ windowSystems.wayland;
|
|
|
|
x11 = [ libGLU xorg.libxcb xorg.libX11 ];
|
|
|
|
wayland = [ wayland ];
|
|
|
|
};
|
|
|
|
|
|
|
|
backends = {
|
|
|
|
inherit freeimage libtiff libpng librsvg libheif;
|
|
|
|
libjpeg = libjpeg_turbo;
|
|
|
|
inherit (netsurf) libnsgif;
|
|
|
|
};
|
|
|
|
|
|
|
|
backendFlags = builtins.map
|
|
|
|
(b: if builtins.elem b withBackends
|
|
|
|
then "-D${b}=enabled"
|
|
|
|
else "-D${b}=disabled")
|
|
|
|
(builtins.attrNames backends);
|
|
|
|
in
|
|
|
|
|
|
|
|
# check that given window system is valid
|
|
|
|
assert lib.assertOneOf "withWindowSystem" withWindowSystem
|
|
|
|
(builtins.attrNames windowSystems);
|
|
|
|
# check that every given backend is valid
|
|
|
|
assert builtins.all
|
|
|
|
(b: lib.assertOneOf "each backend" b (builtins.attrNames backends))
|
|
|
|
withBackends;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "imv";
|
2021-12-21 02:18:32 +00:00
|
|
|
version = "4.3.1";
|
|
|
|
outputs = [ "out" "man" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-21 02:18:32 +00:00
|
|
|
src = fetchFromSourcehut {
|
|
|
|
owner = "~exec64";
|
2020-10-19 23:25:03 +00:00
|
|
|
repo = "imv";
|
|
|
|
rev = "v${version}";
|
2021-12-21 02:18:32 +00:00
|
|
|
sha256 = "sha256-gMAd8skst72QT4jGFH7aRdWeAd4tf/uQgXhGaM/Dpgc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
mesonFlags = [
|
|
|
|
"-Dwindows=${withWindowSystem}"
|
|
|
|
"-Dtest=enabled"
|
|
|
|
"-Dman=enabled"
|
|
|
|
] ++ backendFlags;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
asciidoc
|
|
|
|
cmocka
|
|
|
|
docbook_xsl
|
|
|
|
libxslt
|
|
|
|
meson
|
|
|
|
ninja
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2021-01-09 10:05:03 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2020-10-19 23:25:03 +00:00
|
|
|
icu
|
2020-04-24 23:36:52 +00:00
|
|
|
libxkbcommon
|
|
|
|
pango
|
2021-01-09 10:05:03 +00:00
|
|
|
inih
|
|
|
|
] ++ windowSystems."${withWindowSystem}"
|
|
|
|
++ builtins.map (b: backends."${b}") withBackends;
|
2020-10-19 23:25:03 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
postInstall = ''
|
|
|
|
# fix the executable path and install the desktop item
|
|
|
|
substituteInPlace ../files/imv.desktop --replace "imv %F" "$out/bin/imv %F"
|
|
|
|
install -Dm644 ../files/imv.desktop $out/share/applications/
|
|
|
|
'';
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
postFixup = lib.optionalString (withWindowSystem == "all") ''
|
2020-04-24 23:36:52 +00:00
|
|
|
# The `bin/imv` script assumes imv-wayland or imv-x11 in PATH,
|
|
|
|
# so we have to fix those to the binaries we installed into the /nix/store
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
substituteInPlace "$out/bin/imv" \
|
|
|
|
--replace "imv-wayland" "$out/bin/imv-wayland" \
|
|
|
|
--replace "imv-x11" "$out/bin/imv-x11"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A command line image viewer for tiling window managers";
|
2020-10-19 23:25:03 +00:00
|
|
|
homepage = "https://github.com/eXeC64/imv";
|
2021-06-28 23:13:55 +00:00
|
|
|
license = licenses.mit;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ rnhmjoj markus1189 ];
|
2020-10-19 23:25:03 +00:00
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|