-
-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/modules/programs/dconf: redesign profiles #189099
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: |
@@ -3703,6 +3703,8 @@ with pkgs; | |||
|
|||
dconf = callPackage ../development/libraries/dconf { }; | |||
|
|||
dconf-utils = callPackage ../development/libraries/dconf/utils.nix { }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very tiny, please move it into dconf itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} // (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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we rather fix those or is the overhead so big, that we rather not wrap this at all?
in | ||
{ | ||
###### 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We canno use mkRenamedOption here?
@@ -212,6 +217,8 @@ Available as [services.patroni](options.html#opt-services.patroni.enable). | |||
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can definitely be a mkRenamedOption
@@ -125,6 +125,18 @@ | |||
would in NixOS 22.05 and earlier. | |||
</para> | |||
</listitem> | |||
<listitem> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need this here? Why not put it into the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
extraGSettingsOverrides
that 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 = true
set 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.sh
to update generated release notes