From 1f72e287eb7411621d2227858372ede358a1d8fc Mon Sep 17 00:00:00 2001 From: ChUrl Date: Mon, 15 Aug 2022 12:31:08 +0200 Subject: [PATCH] dconf-editor xdg_data_dirs overlay --- overlays/dconf-editor.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 overlays/dconf-editor.nix diff --git a/overlays/dconf-editor.nix b/overlays/dconf-editor.nix new file mode 100644 index 00000000..d7804789 --- /dev/null +++ b/overlays/dconf-editor.nix @@ -0,0 +1,28 @@ +# We need to wrap the dconf-editor to use the correct XDG_DATA_DIRS +# By default XDG_DATA_DIRS on NixOS contains paths to the gsettings-schemas like +# /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3 +# but this is the wrong path for dconf-editor to find the schema, correct one would be +# /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3/glib-2.0/schemas + +# override derivation attributes +prev.gnome.dconf-editor.overrideAttrs (oldAttrs: { + # add `makeWrapper` to existing dependencies + buildInputs = oldAttrs.buildInputs ++ [ final.makeWrapper ]; + + # wrap the binary in a script where the appropriate env var is set + postInstall = oldAttrs.postInstall or "" + '' + schemas="" + for p in $NIX_PROFILES; do + if [[ -d "$p" ]]; then + for d in $(nix-store --query --references "$p"); do + schemas_dir=$(echo "$d"/share/gsettings-schemas/*/glib-2.0/schemas) + if [[ -d "$schemas_dir" ]]; then + schemas="$schemas''${schemas:+:}$schemas_dir" + fi + done + fi + done + + wrapProgram "$out/bin/dconf-editor" --set XDG_DATA_DIRS $schemas + ''; +})