Merge pull request #161739 from Artturin/gsettingsfhsenv

Artturi b54e7571 3239fd2b

Changed files
+56
doc
builders
pkgs
build-support
appimage
build-fhs-userenv
build-fhs-userenv-bubblewrap
+2
doc/builders/special/fhs-environments.section.md
···
```
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.
+
+
Additionally, 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`.
+2
pkgs/build-support/appimage/default.nix
···
xdg-utils
iana-etc
krb5
+
gsettings-desktop-schemas
+
hicolor-icon-theme # dont show a gtk warning about hicolor not being installed
];
# list of libraries expected in an appimage environment:
+26
pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix
···
paths = [ etcPkg ldconfig ] ++ basePkgs ++ targetPaths;
extraOutputsToInstall = [ "out" "lib" "bin" ] ++ extraOutputsToInstall;
ignoreCollisions = true;
+
postBuild = ''
+
if [[ -d $out/share/gsettings-schemas/ ]]; then
+
# Recreate the standard schemas directory if its a symlink to make it writable
+
if [[ -L $out/share/glib-2.0 ]]; then
+
ln -s $(readlink $out/share/glib-2.0) $out/share/glib-2.0.old
+
rm -rf $out/share/glib-2.0
+
fi
+
+
mkdir -p $out/share/glib-2.0/schemas
+
+
# symlink any schema files or overrides to the standard schema directory
+
if [[ -e $out/share/glib-2.0.old/schemas ]]; then
+
ln -fs $out/share/glib-2.0.old/schemas/*.xml $out/share/glib-2.0/schemas
+
ln -fs $out/share/glib-2.0.old/schemas/*.gsettings-schemas.override $out/share/glib-2.0/schemas
+
fi
+
+
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 {
+26
pkgs/build-support/build-fhs-userenv/env.nix
···
paths = [ etcPkg ] ++ basePkgs ++ targetPaths;
extraOutputsToInstall = [ "out" "lib" "bin" ] ++ extraOutputsToInstall;
ignoreCollisions = true;
+
postBuild = ''
+
if [[ -d $out/share/gsettings-schemas/ ]]; then
+
# Recreate the standard schemas directory if its a symlink to make it writable
+
if [[ -L $out/share/glib-2.0 ]]; then
+
ln -s $(readlink $out/share/glib-2.0) $out/share/glib-2.0.old
+
rm -rf $out/share/glib-2.0
+
fi
+
+
mkdir -p $out/share/glib-2.0/schemas
+
+
# symlink any schema files or overrides to the standard schema directory
+
if [[ -e $out/share/glib-2.0.old/schemas ]]; then
+
ln -fs $out/share/glib-2.0.old/schemas/*.xml $out/share/glib-2.0/schemas
+
ln -fs $out/share/glib-2.0.old/schemas/*.gsettings-schemas.override $out/share/glib-2.0/schemas
+
fi
+
+
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 {