nixos/modules/programs/dconf: redesign profiles#189099
nixos/modules/programs/dconf: redesign profiles#189099kekrby wants to merge 1 commit intoNixOS:masterfrom
Conversation
6226f18 to
090a42e
Compare
376408a to
df82365
Compare
64c4a6d to
fd906fb
Compare
|
@kekrby: Can you rebase please? |
f7cf907 to
05927ee
Compare
05927ee to
ced2d66
Compare
|
|
5e0698b to
ab3bcd3
Compare
|
It looks like I missed that. It should now correctly create an |
This redesign allows proper creation and management of dconf profiles using NixOS and provides a way to solve the problems noted in issue 54150.
ab3bcd3 to
0967cce
Compare
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
|
||
| dconf = callPackage ../development/libraries/dconf { }; | ||
|
|
||
| dconf-utils = callPackage ../development/libraries/dconf/utils.nix { }; |
There was a problem hiding this comment.
This is very tiny, please move it into dconf itself.
There was a problem hiding this comment.
It is only tiny because it is very incomplete. We will eventually want something like https://github.com/nix-community/home-manager/blob/ec06f419af79207b33d797064dfb3fc9dbe1df4a/modules/lib/gvariant.nix Never mind, was looking at a wrong file.
| sleep-inactive-battery-timeout=0 | ||
| ''} | ||
| ''; | ||
| programs.dconf.profiles.gdm.databases = [ "${gdm}/share/gdm/greeter-dconf-defaults" ] ++ lib.lists.optional cfg.gdm.autoSuspend { |
There was a problem hiding this comment.
| programs.dconf.profiles.gdm.databases = [ "${gdm}/share/gdm/greeter-dconf-defaults" ] ++ lib.lists.optional cfg.gdm.autoSuspend { | |
| programs.dconf.profiles.gdm.databases = [ "${gdm}/share/gdm/greeter-dconf-defaults" ] | |
| ++ lib.lists.optional cfg.gdm.autoSuspend { |
| environment.sessionVariables = { | ||
| # Needed for unwrapped applications | ||
| GIO_EXTRA_MODULES = [ "${pkgs.dconf.lib}/lib/gio/modules" ]; | ||
| } // (if cfg.defaultProfile != null then { DCONF_PROFILE = cfg.defaultProfile; } else {}); |
There was a problem hiding this comment.
| } // (if cfg.defaultProfile != null then { DCONF_PROFILE = cfg.defaultProfile; } else {}); | |
| } // lib.optionalAttrs (cfg.defaultProfile != null) { DCONF_PROFILE = cfg.defaultProfile; }; |
| # Needed for unwrapped applications | ||
| environment.sessionVariables.GIO_EXTRA_MODULES = mkIf cfg.enable [ "${pkgs.dconf.lib}/lib/gio/modules" ]; | ||
| environment.sessionVariables = { | ||
| # Needed for unwrapped applications |
There was a problem hiding this comment.
Shouldn't we rather fix those or is the overhead so big, that we rather not wrap this at all?
| { | ||
| ###### interface | ||
| imports = [ | ||
| (lib.mkRemovedOptionModule [ "programs" "dconf" "packages" ] "This option is not supported anymore, you should use `programs.dconf.profiles.<profile>.databases` instead.") |
There was a problem hiding this comment.
We canno use mkRenamedOption here?
| - Emacs now uses the Lucid toolkit by default instead of GTK because of stability and compatibility issues. | ||
| Users who still wish to remain using GTK can do so by using `emacs-gtk`. | ||
|
|
||
| - The option `programs.dconf.packages` has been removed, use `programs.dconf.profiles.user.databases` instead. |
There was a problem hiding this comment.
This can definitely be a mkRenamedOption
| would in NixOS 22.05 and earlier. | ||
| </para> | ||
| </listitem> | ||
| <listitem> |
There was a problem hiding this comment.
We no longer do xml files in nixos/* . Also please carry over the other changelog to 23.05
| rec { | ||
| types = { | ||
| tuple = "_tuple"; | ||
| }; | ||
|
|
||
| mkTuple = _elements: { | ||
| inherit _elements; | ||
|
|
||
| _type = types.tuple; | ||
| }; | ||
| } |
There was a problem hiding this comment.
Do we even need this here? Why not put it into the module.
There was a problem hiding this comment.
This incomplete implementation of GVariant type system. Ideally, we would have a full implementation like home-manager has and having it separately is nicer for using it in different context, including tests.
There was a problem hiding this comment.
If that is the full one, we should keep it separate. Maybe add a comment, that it isn't complete and maybe with a ref to hm.
| org.gnome.settings-daemon.plugins.power = { | ||
| sleep-inactive-ac-type = "nothing"; | ||
| sleep-inactive-battery-type = "nothing"; | ||
| sleep-inactive-ac-timeout = 0; |
There was a problem hiding this comment.
I wonder if we should require an explicit integer type (eg. lib.gvariant.mkInt). For example, org.gnome.desktop.session’s idle-delay requires uint32 and people regularly trip on it, passing it a Nix number in home-manager, which implicitly gets turned into an int.
Alternative would be making the dconf module internal and creating a separate GSettings module that would also perform validation against schema.
| databases = lib.mkOption { | ||
| type = with lib.types; listOf (oneOf [ attrs str path package ]); | ||
| default = []; | ||
| description = lib.mdDoc "List of data sources for the profile. An element can be an attrset, or the path of an already compiled database."; |
There was a problem hiding this comment.
Missing explanation of string argument.
I wrote this before realizing that there's a good implementation of this in `home-manager`: - https://github.com/nix-community/home-manager/blob/master/modules/lib/gvariant.nix - https://github.com/nix-community/home-manager/blob/master/tests/lib/types/gvariant-merge.nix - https://github.com/nix-community/home-manager/blob/master/modules/misc/dconf.nix And that there's an INI based adapter for `dconf` in this nixpkgs PR (which will hopefully be merged soon): - NixOS/nixpkgs#189099 Even so, I'm going to keep this for now so that I can set gnome settings in NixOS configs without needing to wait for that PR or resort to embedding gschema files.
|
Suppressed by #234615. |
Description of changes
This PR is a redesign of the NixOS dconf module and provides a way to solve the issues noted in #54150.
If merged, it presents an alternative to
extraGSettingsOverridesthat is more reliable as the user can disable overriding options withenableUserDb = false;. Users can store their configurations both as dconf keyfiles or as Nix expressions.This is how the module can be used:
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes