2021-01-04 15:07:52 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, asciidoc
|
2020-10-17 15:12:00 +02:00
|
|
|
, cmocka
|
|
|
|
, docbook_xsl
|
2021-01-04 15:07:52 +01:00
|
|
|
, libxslt
|
2020-10-17 15:12:00 +02:00
|
|
|
, fontconfig
|
2021-01-04 15:07:52 +01:00
|
|
|
, meson
|
|
|
|
, ninja
|
2021-01-19 07:50:56 +01:00
|
|
|
, pkg-config
|
2020-10-17 15:12:00 +02:00
|
|
|
, icu
|
2021-01-04 15:07:52 +01:00
|
|
|
, pango
|
|
|
|
, inih
|
|
|
|
, withWindowSystem ? "all"
|
|
|
|
, xorg
|
|
|
|
, libxkbcommon
|
2020-10-17 15:12:00 +02:00
|
|
|
, libGLU
|
2021-01-04 15:07:52 +01:00
|
|
|
, wayland
|
|
|
|
, withBackends ? [ "freeimage" "libtiff" "libjpeg" "libpng" "librsvg" "libnsgif" "libheif" ]
|
|
|
|
, freeimage
|
|
|
|
, libtiff
|
2020-10-17 15:12:00 +02:00
|
|
|
, libjpeg_turbo
|
|
|
|
, libpng
|
|
|
|
, librsvg
|
|
|
|
, netsurf
|
2021-01-04 15:07:52 +01:00
|
|
|
, libheif
|
2018-09-03 14:22:32 +02:00
|
|
|
}:
|
2015-11-12 19:40:00 +01:00
|
|
|
|
2021-01-04 15:07:52 +01: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;
|
|
|
|
|
2015-11-12 19:40:00 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "imv";
|
2021-01-03 12:52:03 +01:00
|
|
|
version = "4.2.0";
|
2015-11-12 19:40:00 +01:00
|
|
|
|
2018-09-03 14:22:32 +02:00
|
|
|
src = fetchFromGitHub {
|
2020-10-17 15:12:00 +02:00
|
|
|
owner = "eXeC64";
|
|
|
|
repo = "imv";
|
|
|
|
rev = "v${version}";
|
2021-01-03 12:52:03 +01:00
|
|
|
sha256 = "07pcpppmfvvj0czfvp1cyq03ha0jdj4whl13lzvw37q3vpxs5qqh";
|
2015-11-12 19:40:00 +01:00
|
|
|
};
|
|
|
|
|
2021-01-04 15:07:52 +01:00
|
|
|
mesonFlags = [
|
|
|
|
"-Dwindows=${withWindowSystem}"
|
|
|
|
"-Dtest=enabled"
|
|
|
|
"-Dman=enabled"
|
|
|
|
] ++ backendFlags;
|
|
|
|
|
2021-01-03 12:52:03 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
asciidoc
|
|
|
|
cmocka
|
|
|
|
docbook_xsl
|
|
|
|
libxslt
|
|
|
|
meson
|
|
|
|
ninja
|
2021-01-19 07:50:56 +01:00
|
|
|
pkg-config
|
2021-01-03 12:52:03 +01:00
|
|
|
];
|
2019-09-06 10:01:47 +02:00
|
|
|
|
2018-09-03 14:22:32 +02:00
|
|
|
buildInputs = [
|
2020-10-17 15:12:00 +02:00
|
|
|
icu
|
2019-09-06 10:01:47 +02:00
|
|
|
libxkbcommon
|
|
|
|
pango
|
2021-01-03 12:52:03 +01:00
|
|
|
inih
|
2021-01-04 15:07:52 +01:00
|
|
|
] ++ windowSystems."${withWindowSystem}"
|
|
|
|
++ builtins.map (b: backends."${b}") withBackends;
|
2015-11-12 19:40:00 +01:00
|
|
|
|
2021-01-04 15:07:52 +01:00
|
|
|
postFixup = lib.optionalString (withWindowSystem == "all") ''
|
2019-09-06 10:01:47 +02: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-04 14:41:45 +01:00
|
|
|
substituteInPlace "$out/bin/imv" \
|
|
|
|
--replace "imv-wayland" "$out/bin/imv-wayland" \
|
|
|
|
--replace "imv-x11" "$out/bin/imv-x11"
|
2019-09-06 10:01:47 +02:00
|
|
|
'';
|
|
|
|
|
2019-07-19 08:40:54 +02:00
|
|
|
doCheck = true;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2015-11-12 19:40:00 +01:00
|
|
|
description = "A command line image viewer for tiling window managers";
|
2020-10-17 15:12:00 +02:00
|
|
|
homepage = "https://github.com/eXeC64/imv";
|
|
|
|
license = licenses.gpl2;
|
2019-07-19 08:40:54 +02:00
|
|
|
maintainers = with maintainers; [ rnhmjoj markus1189 ];
|
2020-10-17 15:12:00 +02:00
|
|
|
platforms = platforms.all;
|
2015-11-12 19:40:00 +01:00
|
|
|
};
|
|
|
|
}
|