From 65ddb0ef06abcd733bbed124ea2594b6491abd73 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 17 Nov 2022 16:02:34 +0100 Subject: [PATCH 1/3] nixos/dbus: Remove socketActivated option removal warning It has been removed since 21.05: https://github.com/NixOS/nixpkgs/commit/f292a27f442d10de4827800d064a3a8c64d05cee --- nixos/modules/services/system/dbus.nix | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index c0de00bb914c..3cfdd74ea38e 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -1,6 +1,6 @@ # D-Bus configuration and system bus daemon. -{ config, lib, options, pkgs, ... }: +{ config, lib, pkgs, ... }: with lib; @@ -65,30 +65,12 @@ in ''; default = "disabled"; }; - - socketActivated = mkOption { - type = types.nullOr types.bool; - default = null; - visible = false; - description = lib.mdDoc '' - Removed option, do not use. - ''; - }; }; }; ###### implementation config = mkIf cfg.enable { - warnings = optional (cfg.socketActivated != null) ( - let - files = showFiles options.services.dbus.socketActivated.files; - in - "The option 'services.dbus.socketActivated' in ${files} no longer has" - + " any effect and can be safely removed: the user D-Bus session is" - + " now always socket activated." - ); - environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus ]; environment.etc."dbus-1".source = configDir; From 43f34da0798ed4499598abc5a9bc4a87cb118cf1 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 17 Nov 2022 16:16:18 +0100 Subject: [PATCH 2/3] nixos/dbus: Clean up - Format the expression with nixpkgs-fmt. - Remove `with` statement for clarity. - Remove useless comments. - Regroup systemd options. --- nixos/modules/services/system/dbus.nix | 51 ++++++++++++++++---------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index 3cfdd74ea38e..2cd843e4d67c 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -2,8 +2,6 @@ { config, lib, pkgs, ... }: -with lib; - let cfg = config.services.dbus; @@ -16,11 +14,11 @@ let serviceDirectories = cfg.packages; }; + inherit (lib) mkOption types; + in { - ###### interface - options = { services.dbus = { @@ -68,10 +66,11 @@ in }; }; - ###### implementation - - config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus ]; + config = lib.mkIf cfg.enable { + environment.systemPackages = [ + pkgs.dbus.daemon + pkgs.dbus + ]; environment.etc."dbus-1".source = configDir; @@ -84,7 +83,9 @@ in users.groups.messagebus.gid = config.ids.gids.messagebus; - systemd.packages = [ pkgs.dbus.daemon ]; + systemd.packages = [ + pkgs.dbus.daemon + ]; security.wrappers.dbus-daemon-launch-helper = { source = "${pkgs.dbus.daemon}/libexec/dbus-daemon-launch-helper"; @@ -103,19 +104,29 @@ in systemd.services.dbus = { # Don't restart dbus-daemon. Bad things tend to happen if we do. reloadIfChanged = true; - restartTriggers = [ configDir ]; - environment = { LD_LIBRARY_PATH = config.system.nssModules.path; }; - }; - - systemd.user = { - services.dbus = { - # Don't restart dbus-daemon. Bad things tend to happen if we do. - reloadIfChanged = true; - restartTriggers = [ configDir ]; + restartTriggers = [ + configDir + ]; + environment = { + LD_LIBRARY_PATH = config.system.nssModules.path; }; - sockets.dbus.wantedBy = [ "sockets.target" ]; }; - environment.pathsToLink = [ "/etc/dbus-1" "/share/dbus-1" ]; + systemd.user.services.dbus = { + # Don't restart dbus-daemon. Bad things tend to happen if we do. + reloadIfChanged = true; + restartTriggers = [ + configDir + ]; + }; + + systemd.user.sockets.dbus.wantedBy = [ + "sockets.target" + ]; + + environment.pathsToLink = [ + "/etc/dbus-1" + "/share/dbus-1" + ]; }; } From 5acdf854673ffac97d3a7970d4c3026ddb411f72 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 17 Nov 2022 16:54:57 +0100 Subject: [PATCH 3/3] nixos/dbus: Avoid redundant output specification - Do not use `daemon`, it has been synonymous to `out` since https://github.com/NixOS/nixpkgs/commit/783c40eb68bbbcb9cf6918255157ecab55eedb6e - Do not use explicit `out` output, it has been default since https://github.com/NixOS/nixpkgs/commit/a17216af4c82dbeb33030355664d96875558f7ac (originally introduced in https://github.com/NixOS/nixpkgs/commit/2132c86c45de67842f9b1237f3a0d1f242dce7ec) --- nixos/modules/services/system/dbus.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index 2cd843e4d67c..b87e48f2945d 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -68,7 +68,6 @@ in config = lib.mkIf cfg.enable { environment.systemPackages = [ - pkgs.dbus.daemon pkgs.dbus ]; @@ -84,11 +83,11 @@ in users.groups.messagebus.gid = config.ids.gids.messagebus; systemd.packages = [ - pkgs.dbus.daemon + pkgs.dbus ]; security.wrappers.dbus-daemon-launch-helper = { - source = "${pkgs.dbus.daemon}/libexec/dbus-daemon-launch-helper"; + source = "${pkgs.dbus}/libexec/dbus-daemon-launch-helper"; owner = "root"; group = "messagebus"; setuid = true; @@ -97,7 +96,7 @@ in }; services.dbus.packages = [ - pkgs.dbus.out + pkgs.dbus config.system.path ];