mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-29 21:51:01 +01:00
systemd: avoid creating an empty user.conf
Due to the defaults in `systemd.user.settings`, the default value when
there are no settings explicitly set is `{ Manager = { }; }`. This
means an empty file is created even when `systemd.user.settings` is
never used in home-manager configuration. Since user’s `user.conf` is
preferred to the global `/etc/systemd/user.conf`, this can cause any
values set in the latter to be discarded.
This commit is contained in:
parent
f5182ffc42
commit
e27be9db7b
3 changed files with 13 additions and 2 deletions
|
|
@ -4,7 +4,9 @@ let
|
|||
|
||||
cfg = config.systemd.user;
|
||||
|
||||
inherit (lib) getAttr hm isBool literalExpression mkIf mkMerge mkOption types;
|
||||
inherit (lib)
|
||||
any attrValues getAttr hm isBool literalExpression mkIf mkMerge mkOption
|
||||
types;
|
||||
|
||||
settingsFormat = pkgs.formats.ini { listsAsDuplicateKeys = true; };
|
||||
|
||||
|
|
@ -93,7 +95,7 @@ let
|
|||
+ "\n";
|
||||
};
|
||||
|
||||
settings = mkIf (cfg.settings != { }) {
|
||||
settings = mkIf (any (v: v != { }) (attrValues cfg.settings)) {
|
||||
"systemd/user.conf".source =
|
||||
settingsFormat.generate "user.conf" cfg.settings;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue