diff options
Diffstat (limited to 'pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix')
-rw-r--r-- | pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix index 5ef613838856..3c5199be3132 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix @@ -9,33 +9,41 @@ , dconf , callPackage , wrapGAppsHook -, writeTextFile +, targetPackages }: makeSetupHook { name = "wrap-gapps-hook"; - deps = lib.optionals (!stdenv.isDarwin) [ - # It is highly probable that a program will use GSettings, - # at minimum through GTK file chooser dialogue. - # Let’s add a GIO module for “dconf” GSettings backend - # to avoid falling back to “memory” backend. This is - # required for GSettings-based settings to be persisted. - # Unfortunately, it also requires the user to have dconf - # D-Bus service enabled globally (e.g. through a NixOS module). - dconf.lib + propagatedBuildInputs = [ + # We use the wrapProgram function. + makeWrapper ] ++ lib.optionals isGraphical [ # TODO: remove this, packages should depend on GTK explicitly. gtk3 + librsvg + ]; + + # depsTargetTargetPropagated will essentially be buildInputs when wrapGAppsHook is placed into nativeBuildInputs + # the librsvg and gtk3 above should be removed but kept to not break anything that implicitly depended on its binaries + depsTargetTargetPropagated = assert (lib.assertMsg (!targetPackages ? raw) "wrapGAppsHook must be in nativeBuildInputs"); lib.optionals isGraphical [ # librsvg provides a module for gdk-pixbuf to allow rendering # SVG icons. Most icon themes are SVG-based and so are some # graphics in GTK (e.g. cross for closing window in window title bar) # so it is pretty much required for applications using GTK. librsvg - ] ++ [ - # We use the wrapProgram function. - makeWrapper + # TODO: remove this, packages should depend on GTK explicitly. + gtk3 + ] ++ lib.optionals (!stdenv.isDarwin) [ + # It is highly probable that a program will use GSettings, + # at minimum through GTK file chooser dialogue. + # Let’s add a GIO module for “dconf” GSettings backend + # to avoid falling back to “memory” backend. This is + # required for GSettings-based settings to be persisted. + # Unfortunately, it also requires the user to have dconf + # D-Bus service enabled globally (e.g. through a NixOS module). + dconf.lib ]; passthru = { tests = let @@ -50,6 +58,7 @@ makeSetupHook { src = sample-project; + strictDeps = true; nativeBuildInputs = [ wrapGAppsHook ]; installFlags = [ "bin-foo" "libexec-bar" ]; @@ -65,12 +74,23 @@ makeSetupHook { '' ); + basic-contains-gdk-pixbuf = let + tested = basic; + in testLib.runTest "basic-contains-gdk-pixbuf" ( + testLib.skip stdenv.isDarwin '' + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GDK_PIXBUF_MODULE_FILE" "${lib.getLib librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GDK_PIXBUF_MODULE_FILE" "${lib.getLib librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"} + '' + ); + # Simple derivation containing a gobject-introspection typelib. typelib-Mahjong = stdenv.mkDerivation { name = "typelib-Mahjong"; src = sample-project; + strictDeps = true; + installFlags = [ "typelib-Mahjong" ]; }; @@ -80,6 +100,7 @@ makeSetupHook { src = sample-project; + strictDeps = true; nativeBuildInputs = [ gobject-introspection wrapGAppsHook @@ -111,6 +132,8 @@ makeSetupHook { src = sample-project; + strictDeps = true; + makeFlags = [ "LIBDIR=${placeholder "lib"}/lib" ]; @@ -124,6 +147,7 @@ makeSetupHook { src = sample-project; + strictDeps = true; nativeBuildInputs = [ gobject-introspection wrapGAppsHook @@ -154,6 +178,7 @@ makeSetupHook { src = sample-project; + strictDeps = true; nativeBuildInputs = [ gobject-introspection wrapGAppsHook |