From 3b08e5d3011c644fd362ab03e6892236452008e0 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sun, 29 Mar 2020 14:33:41 -0400 Subject: [PATCH 1/3] buildFHSChrootEnv: link gsettings-schemas to FHS location We shouldn't need to use wrapGAppsHook in expressions that use this builder. The code to do this is from https://github.com/NixOS/nixpkgs/pull/54083. --- pkgs/build-support/build-fhs-userenv/env.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkgs/build-support/build-fhs-userenv/env.nix b/pkgs/build-support/build-fhs-userenv/env.nix index 8de43d5a9195d..48d76571449ef 100644 --- a/pkgs/build-support/build-fhs-userenv/env.nix +++ b/pkgs/build-support/build-fhs-userenv/env.nix @@ -124,6 +124,24 @@ 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 + rm -rf $out/share/glib-2.0 + mkdir -p $out/share/glib-2.0/schemas + + # symlink any schema files 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 + done + + # and compile them + if [ -w $out/share/glib-2.0/schemas ]; then + ${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas + fi + fi + ''; }; staticUsrProfileMulti = buildEnv { From f5ff64c2e0f4568f4e3982f0ddcd2bc93d509ed4 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sun, 29 Mar 2020 15:07:52 -0400 Subject: [PATCH 2/3] fixup! buildFHSChrootEnv: link gsettings-schemas to FHS location --- pkgs/build-support/build-fhs-userenv/env.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkgs/build-support/build-fhs-userenv/env.nix b/pkgs/build-support/build-fhs-userenv/env.nix index 48d76571449ef..ace4193971bc7 100644 --- a/pkgs/build-support/build-fhs-userenv/env.nix +++ b/pkgs/build-support/build-fhs-userenv/env.nix @@ -125,21 +125,22 @@ let extraOutputsToInstall = [ "out" "lib" "bin" ] ++ extraOutputsToInstall; ignoreCollisions = true; postBuild = '' - if [ -d $out/share/gsettings-schemas/ ]; then - # Create the standard schemas directory - rm -rf $out/share/glib-2.0 - mkdir -p $out/share/glib-2.0/schemas + 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 to the standard schema directory + # 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 - if [ -w $out/share/glib-2.0/schemas ]; then - ${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas - fi + ${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas fi ''; }; From 35faf0ae9cc60cffe32ec333e3b9bd4e5e4aa1be Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sun, 29 Mar 2020 15:08:48 -0400 Subject: [PATCH 3/3] doc/fhs-environments: note that you don't need wrapGAppsHook --- doc/builders/special/fhs-environments.xml | 4 ++++ 1 file changed, 4 insertions(+) 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. +