summary refs log tree commit diff
path: root/pkgs/os-specific/linux/upower
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2023-08-04 00:04:33 +0300
committerArtturin <Artturin@artturin.com>2023-08-04 00:22:11 +0300
commitee197e89088112cae9ec8331c903cd2361beeaf8 (patch)
tree7fb9df6b5da584d7955dce16578320a9438be4c0 /pkgs/os-specific/linux/upower
parentbf170fec12fadd65070e190c0abbe1cca933b5a7 (diff)
downloadnixpkgs-ee197e89088112cae9ec8331c903cd2361beeaf8.tar
nixpkgs-ee197e89088112cae9ec8331c903cd2361beeaf8.tar.gz
nixpkgs-ee197e89088112cae9ec8331c903cd2361beeaf8.tar.bz2
nixpkgs-ee197e89088112cae9ec8331c903cd2361beeaf8.tar.lz
nixpkgs-ee197e89088112cae9ec8331c903cd2361beeaf8.tar.xz
nixpkgs-ee197e89088112cae9ec8331c903cd2361beeaf8.tar.zst
nixpkgs-ee197e89088112cae9ec8331c903cd2361beeaf8.zip
upower: Fix cross
Improve optionals
Diffstat (limited to 'pkgs/os-specific/linux/upower')
-rw-r--r--pkgs/os-specific/linux/upower/default.nix25
1 files changed, 17 insertions, 8 deletions
diff --git a/pkgs/os-specific/linux/upower/default.nix b/pkgs/os-specific/linux/upower/default.nix
index 8772c081e03..a002e1af889 100644
--- a/pkgs/os-specific/linux/upower/default.nix
+++ b/pkgs/os-specific/linux/upower/default.nix
@@ -1,7 +1,6 @@
 { lib
 , stdenv
 , fetchFromGitLab
-, fetchpatch
 , makeWrapper
 , pkg-config
 , rsync
@@ -18,15 +17,20 @@
 , libgudev
 , libusb1
 , glib
-, gobject-introspection
 , gettext
 , systemd
+, nixosTests
 , useIMobileDevice ? true
 , libimobiledevice
-, withDocs ? (stdenv.buildPlatform == stdenv.hostPlatform)
-, nixosTests
+, withDocs ? withIntrospection
+, mesonEmulatorHook
+, withIntrospection ? stdenv.hostPlatform.emulatorAvailable buildPackages
+, buildPackages
+, gobject-introspection
 }:
 
+assert withDocs -> withIntrospection;
+
 stdenv.mkDerivation (finalAttrs: {
   pname = "upower";
   version = "1.90.2";
@@ -60,14 +64,19 @@ stdenv.mkDerivation (finalAttrs: {
     meson
     ninja
     python3
-    gtk-doc
     docbook-xsl-nons
     gettext
-    gobject-introspection
     libxslt
     makeWrapper
     pkg-config
     rsync
+    glib
+  ] ++ lib.optionals withIntrospection [
+    gobject-introspection
+  ] ++ lib.optionals withDocs [
+    gtk-doc
+  ] ++ lib.optionals (withDocs && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
+    mesonEmulatorHook
   ];
 
   buildInputs = [
@@ -110,8 +119,8 @@ stdenv.mkDerivation (finalAttrs: {
     "-Dsystemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
     "-Dudevrulesdir=${placeholder "out"}/lib/udev/rules.d"
     "-Dudevhwdbdir=${placeholder "out"}/lib/udev/hwdb.d"
-    "-Dintrospection=${if (stdenv.buildPlatform == stdenv.hostPlatform) then "auto" else "disabled"}"
-    "-Dgtk-doc=${lib.boolToString withDocs}"
+    (lib.mesonEnable "introspection" withIntrospection)
+    (lib.mesonBool "gtk-doc" withDocs)
     "-Dinstalled_test_prefix=${placeholder "installedTests"}"
   ];