···
stdenv.mkDerivation rec {
-
sha256 = "0gk8g178i961nn3bls75a8qpv6wvfvav6hd9lxca1skaikd33zdx";
-
nativeBuildInputs = [ asciidoc cmocka docbook_xsl libxslt ];
-
installFlags = [ "PREFIX=$(out)" "CONFIGPREFIX=$(out)/etc" ];
-
makeFlags = [ "BACKEND_LIBJPEG=yes" "BACKEND_LIBNSGIF=yes" ];
# 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
-
sed -i "s|\bimv-wayland\b|$out/bin/imv-wayland|" $out/bin/imv
-
sed -i "s|\bimv-x11\b|$out/bin/imv-x11|" $out/bin/imv
···
+
, withWindowSystem ? "all"
+
, withBackends ? [ "freeimage" "libtiff" "libjpeg" "libpng" "librsvg" "libnsgif" "libheif" ]
+
all = windowSystems.x11 ++ windowSystems.wayland;
+
x11 = [ libGLU xorg.libxcb xorg.libX11 ];
+
inherit freeimage libtiff libpng librsvg libheif;
+
libjpeg = libjpeg_turbo;
+
inherit (netsurf) libnsgif;
+
backendFlags = builtins.map
+
(b: if builtins.elem b withBackends
+
else "-D${b}=disabled")
+
(builtins.attrNames backends);
+
# check that given window system is valid
+
assert lib.assertOneOf "withWindowSystem" withWindowSystem
+
(builtins.attrNames windowSystems);
+
# check that every given backend is valid
+
(b: lib.assertOneOf "each backend" b (builtins.attrNames backends))
stdenv.mkDerivation rec {
+
sha256 = "07pcpppmfvvj0czfvp1cyq03ha0jdj4whl13lzvw37q3vpxs5qqh";
+
"-Dwindows=${withWindowSystem}"
+
] ++ windowSystems."${withWindowSystem}"
+
++ builtins.map (b: backends."${b}") withBackends;
+
postFixup = lib.optionalString (withWindowSystem == "all") ''
# 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
+
substituteInPlace "$out/bin/imv" \
+
--replace "imv-wayland" "$out/bin/imv-wayland" \
+
--replace "imv-x11" "$out/bin/imv-x11"