1

wrap dconf-editor

This commit is contained in:
2022-08-15 15:09:10 +02:00
parent 90b80ea459
commit 1e0b565621
5 changed files with 47 additions and 33 deletions

View File

@ -0,0 +1,33 @@
# 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
{ pkgs }:
let
find-gsettings-schemas = pkgs.callPackage ./find-gsettings-schemas.nix {};
dconf-editor-wrapped = pkgs.writeShellScriptBin "dconf-editor-wrapped" ''
XDG_DATA_DIRS=$(${find-gsettings-schemas}/bin/find-gsettings-schemas) ${pkgs.gnome.dconf-editor}/bin/dconf-editor
'';
desktop-icon = pkgs.makeDesktopItem {
name = "Dconf Editor (Wrapped)";
desktopName = "Dconf Editor (Wrapped)";
exec = "${dconf-editor-wrapped}/bin/dconf-editor-wrapped";
icon = "ca.desrt.dconf-editor";
comment = "Modify the Gnome/GTK settings database";
genericName = "Desktop application to manage Gnome/GTK settings.";
categories = [ "GNOME" "GTK" "System" ];
};
in
# Combine multiple derivations into a single store path
pkgs.symlinkJoin {
name = "dconf-editor-wrapped";
paths = [
dconf-editor-wrapped
desktop-icon
];
}

View File

@ -5,4 +5,5 @@
cyberdrop-dl = pkgs.callPackage ./cyberdrop-dl {};
firefox-gnome-theme = pkgs.callPackage ./firefox-gnome-theme { src = inputs.firefox-gnome-theme; };
adwaita-for-steam = pkgs.callPackage ./adwaita-for-steam { src = inputs.adwaita-for-steam; };
dconf-editor-wrapped = pkgs.callPackage ./dconf-editor-wrapped {};
}

View File

@ -1,28 +0,0 @@
# 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
'';
})

View File

@ -5,9 +5,14 @@ let
# By specifying this we can just add our derivation to derivations/default.nix and it will land here
additions = final: prev: import ../derivations { inherit inputs; pkgs = final; };
modifications = final: prev: {
# dconf-editor-wrapped = import ./dconf-editor.nix { inherit final prev; }; # Only kept as an example
# Use dconf-editor.nix: { final, prev }: final.<package>.overrideAttrs (oldAttrs: { ... }) or sth similar
};
in
# TODO: I have absolutely no clue what happens here lol
# Basically we need some sort of list of all overlays that can be imported from the flake
# in the overlays = [ ... ] section of the pkgs = import nixpkgs { ... } configuration
# Somehow this library function turns additions into that
nixpkgs.lib.composeManyExtensions [ additions ]
# Somehow this library function turns additions/modifications into that
nixpkgs.lib.composeManyExtensions [ additions modifications ]

View File

@ -287,9 +287,6 @@
SystemMaxUse=50M
'';
# Wiki says needed for appindicators
udev.packages = with pkgs; [ gnome.gnome-settings-daemon ];
acpid.enable = true;
dbus.enable = true;
flatpak.enable = true; # Not quite the nix style but useful for bottles/proprietary stuff
@ -297,6 +294,12 @@
fwupd.enable = true;
locate.enable = true; # Periodically update index
ntp.enable = true;
# TODO: Find a way to organize this better as it's split from the Gnome module
gnome.gnome-keyring.enable = true;
gnome.sushi.enable = true;
gnome.gnome-settings-daemon.enable = true;
gnome.gnome-online-accounts.enable = true; # Probably Gnome enables this
};
# Docker