From 1e0b565621ba4bd8fb09bf901330a086b8ed519d Mon Sep 17 00:00:00 2001 From: ChUrl Date: Mon, 15 Aug 2022 15:09:10 +0200 Subject: [PATCH] wrap dconf-editor --- derivations/dconf-editor-wrapped/default.nix | 33 ++++++++++++++++++++ derivations/default.nix | 1 + overlays/dconf-editor.nix | 28 ----------------- overlays/default.nix | 9 ++++-- system/default.nix | 9 ++++-- 5 files changed, 47 insertions(+), 33 deletions(-) create mode 100644 derivations/dconf-editor-wrapped/default.nix delete mode 100644 overlays/dconf-editor.nix diff --git a/derivations/dconf-editor-wrapped/default.nix b/derivations/dconf-editor-wrapped/default.nix new file mode 100644 index 00000000..8af85fe2 --- /dev/null +++ b/derivations/dconf-editor-wrapped/default.nix @@ -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 + ]; + } \ No newline at end of file diff --git a/derivations/default.nix b/derivations/default.nix index 52e8849e..669dd26a 100644 --- a/derivations/default.nix +++ b/derivations/default.nix @@ -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 {}; } \ No newline at end of file diff --git a/overlays/dconf-editor.nix b/overlays/dconf-editor.nix deleted file mode 100644 index d7804789..00000000 --- a/overlays/dconf-editor.nix +++ /dev/null @@ -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 - ''; -}) diff --git a/overlays/default.nix b/overlays/default.nix index 1b788d6d..be04318f 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -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..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 ] \ No newline at end of file + # Somehow this library function turns additions/modifications into that + nixpkgs.lib.composeManyExtensions [ additions modifications ] \ No newline at end of file diff --git a/system/default.nix b/system/default.nix index 9484cd4f..baae0c88 100644 --- a/system/default.nix +++ b/system/default.nix @@ -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