Skip to content

Commit

Permalink
systemd-initrd: dbus
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvishJerricco committed Apr 12, 2023
1 parent 7d58364 commit dbe90a1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
21 changes: 20 additions & 1 deletion nixos/modules/services/system/dbus.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ let
serviceDirectories = cfg.packages;
};

inherit (lib) mkOption mkIf mkMerge types;
inherit (lib) mkOption mkEnableOption mkIf mkMerge types;

in

{
options = {

boot.initrd.systemd.dbus = {
enable = mkEnableOption (lib.mdDoc "dbus in stage 1") // { visible = false; };
};

services.dbus = {

enable = mkOption {
Expand Down Expand Up @@ -111,6 +115,21 @@ in
];
}

(mkIf config.boot.initrd.systemd.dbus.enable {
boot.initrd.systemd = {
users.messagebus = { };
groups.messagebus = { };
contents."/etc/dbus-1".source = pkgs.makeDBusConf {
inherit (cfg) apparmor;
suidHelper = "/bin/false";
serviceDirectories = [ pkgs.dbus ];
};
packages = [ pkgs.dbus ];
storePaths = [ "${pkgs.dbus}/bin/dbus-daemon" ];
targets.sockets.wants = [ "dbus.socket" ];
};
})

(mkIf (cfg.implementation == "dbus") {
environment.systemPackages = [
pkgs.dbus
Expand Down
3 changes: 3 additions & 0 deletions nixos/modules/system/boot/networkd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3149,6 +3149,9 @@ let

systemd.package = pkgs.systemdStage1Network;

# For networkctl
systemd.dbus.enable = mkDefault true;

systemd.additionalUpstreamUnits = [
"systemd-networkd-wait-online.service"
"systemd-networkd.service"
Expand Down

0 comments on commit dbe90a1

Please sign in to comment.