diff --git a/doc/builders/special/fhs-environments.xml b/doc/builders/special/fhs-environments.xml index e7b81e97a23f9..6adb4b03302e5 100644 --- a/doc/builders/special/fhs-environments.xml +++ b/doc/builders/special/fhs-environments.xml @@ -119,4 +119,8 @@ Running nix-shell would then drop you into a shell with these libraries and binaries available. You can use this to run closed-source applications which expect FHS structure without hassles: simply change runScript to the application path, e.g. ./bin/start.sh -- relative paths are supported. + + + Additonally, the FHS builder links all relocated gsettings-schemas (the glib setup-hook moves them to share/gsettings-schemas/${name}/glib-2.0/schemas) to their standard FHS location. This means you don't need to wrap binaries with wrapGAppsHook. + diff --git a/pkgs/build-support/build-fhs-userenv/env.nix b/pkgs/build-support/build-fhs-userenv/env.nix index 8de43d5a9195d..ace4193971bc7 100644 --- a/pkgs/build-support/build-fhs-userenv/env.nix +++ b/pkgs/build-support/build-fhs-userenv/env.nix @@ -124,6 +124,25 @@ let paths = [ etcPkg ] ++ basePkgs ++ targetPaths; extraOutputsToInstall = [ "out" "lib" "bin" ] ++ extraOutputsToInstall; ignoreCollisions = true; + postBuild = '' + if [[ -d $out/share/gsettings-schemas/ ]]; then + # Create the standard schemas directory if needed + if [[ -L $out/share/glib-2.0 ]]; then + rm -rf $out/share/glib-2.0 + mkdir -p $out/share/glib-2.0/schemas + fi + + # symlink any schema files or overrides to the standard schema directory + for d in $out/share/gsettings-schemas/*; do + # Force symlink, in case there are duplicates + ln -fs $d/glib-2.0/schemas/*.xml $out/share/glib-2.0/schemas + ln -fs $d/glib-2.0/schemas/*.gschema.override $out/share/glib-2.0/schemas + done + + # and compile them + ${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas + fi + ''; }; staticUsrProfileMulti = buildEnv {