imv: use withWindowSystem default value directly

This commit is contained in:
Marcin Serwin
2025-03-10 16:49:20 +01:00
parent 44b7b8bb0e
commit 20aed51958
+5 -14
View File
@@ -13,7 +13,7 @@
icu75,
pango,
inih,
withWindowSystem ? null,
withWindowSystem ? if stdenv.hostPlatform.isLinux then "all" else "x11",
xorg,
libxkbcommon,
libGLU,
@@ -38,15 +38,6 @@
}:
let
# default value of withWindowSystem
withWindowSystem' =
if withWindowSystem != null then
withWindowSystem
else if stdenv.hostPlatform.isLinux then
"all"
else
"x11";
windowSystems = {
all = windowSystems.x11 ++ windowSystems.wayland;
x11 = [
@@ -76,7 +67,7 @@ let
in
# check that given window system is valid
assert lib.assertOneOf "withWindowSystem" withWindowSystem' (builtins.attrNames windowSystems);
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)
@@ -98,7 +89,7 @@ stdenv.mkDerivation rec {
};
mesonFlags = [
"-Dwindows=${withWindowSystem'}"
"-Dwindows=${withWindowSystem}"
"-Dtest=enabled"
"-Dman=enabled"
] ++ backendFlags;
@@ -122,7 +113,7 @@ stdenv.mkDerivation rec {
pango
inih
]
++ windowSystems."${withWindowSystem'}"
++ windowSystems."${withWindowSystem}"
++ builtins.map (b: backends."${b}") withBackends;
patches = [
@@ -138,7 +129,7 @@ stdenv.mkDerivation rec {
install -Dm644 ../files/imv.desktop $out/share/applications/
'';
postFixup = lib.optionalString (withWindowSystem' == "all") ''
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