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