webkitgtk: make it easier to disable avahi globally by fixing enableGeoLocation option

The problem with enableGeoLocation was that it didn't compose well with
.overrideAttrs and setting geoclue2=null at the overlay level
because of the assert statement.

Thus, when combined with disabling libsecret, the resulting override code was:
  avahi = null;
  geoclue2 = { outPath = throw "geoclue is disabled"; };
  webkitgtk = prev.lib.pipe prev.webkitgtk [
    (x: x.override { enableGeoLocation = false; geoclue2 = prev.geoclue2; })
    (x: x.overrideAttrs (old: { cmakeFlags = old.cmakeFlags ++ [ "-DUSE_LIBSECRET=OFF" ]; }))
    (x: x.override { enableGeoLocation = false; geoclue2 = null; libsecret = null; })
  ];

It works, but is unnecessarily complex.

: detailed motviation
libsecret and geoclue2 are actually completely independent,
the real conflict is between assert and override/overrideAttrs which
don't work as expected; e.g. you can pass an updated parameter, but the
original parameter at callPackage "calltime" after recusion through overlays
gets used, so when globally setting "geoclue2=null;" in an overlay,
the assert is always hit without any way to work around that
main
zseri 3 years ago
parent 9a93279738
commit bed1ee0548
  1. 32
      pkgs/development/libraries/webkitgtk/default.nix

@ -1,4 +1,5 @@
{ lib, stdenv
{ lib
, stdenv
, runCommand
, fetchurl
, perl
@ -44,7 +45,6 @@
, lcms2
, libmanette
, openjpeg
, enableGeoLocation ? true
, geoclue2
, sqlite
, enableGLES ? true
@ -58,10 +58,10 @@
, substituteAll
, glib
, addOpenGLRunpath
, enableGeoLocation ? true
, withLibsecret ? true
}:
assert enableGeoLocation -> geoclue2 != null;
stdenv.mkDerivation rec {
pname = "webkitgtk";
version = "2.34.6";
@ -125,12 +125,8 @@ stdenv.mkDerivation rec {
libidn
libintl
lcms2
] ++ lib.optionals stdenv.isLinux [
libmanette
] ++ [
libnotify
libpthreadstubs
libsecret
libtasn1
libwebp
libxkbcommon
@ -155,28 +151,36 @@ stdenv.mkDerivation rec {
# (We pick just that one because using the other headers from `sdk` is not
# compatible with our C++ standard library. This header is already in
# the standard library on aarch64)
runCommand "${pname}_headers" {} ''
runCommand "${pname}_headers" { } ''
install -Dm444 "${lib.getDev apple_sdk.sdk}"/include/libproc.h "$out"/include/libproc.h
''
) ++ lib.optionals stdenv.isLinux [
bubblewrap
libseccomp
libmanette
systemd
wayland
xdg-dbus-proxy
] ++ lib.optional enableGeoLocation geoclue2;
] ++ lib.optionals enableGeoLocation [
geoclue2
] ++ lib.optionals withLibsecret [
libsecret
];
propagatedBuildInputs = [
gtk3
libsoup
];
cmakeFlags = [
cmakeFlags = let
cmakeBool = x: if x then "ON" else "OFF";
in [
"-DENABLE_INTROSPECTION=ON"
"-DPORT=GTK"
"-DUSE_LIBHYPHEN=OFF"
"-DUSE_WPE_RENDERER=OFF"
"-DUSE_SOUP2=${if lib.versions.major libsoup.version == "2" then "ON" else "OFF"}"
"-DUSE_SOUP2=${cmakeBool (lib.versions.major libsoup.version == "2")}"
"-DUSE_LIBSECRET=${cmakeBool withLibsecret}"
] ++ lib.optionals stdenv.isDarwin [
"-DENABLE_GAMEPAD=OFF"
"-DENABLE_GTKDOC=OFF"
@ -191,7 +195,9 @@ stdenv.mkDerivation rec {
"-DUSE_SYSTEM_MALLOC=ON"
] ++ lib.optionals (!stdenv.isLinux) [
"-DUSE_SYSTEMD=OFF"
] ++ lib.optional (stdenv.isLinux && enableGLES) "-DENABLE_GLES2=ON";
] ++ lib.optionals (stdenv.isLinux && enableGLES) [
"-DENABLE_GLES2=ON"
];
postPatch = ''
patchShebangs .

Loading…
Cancel
Save