diff --git a/modules/services/pipewire.nix b/modules/services/pipewire.nix index e4502a929..bd6851aa8 100644 --- a/modules/services/pipewire.nix +++ b/modules/services/pipewire.nix @@ -467,7 +467,7 @@ in systemctl = "${ensureSystemd} systemctl"; in - mkIf (systemdCfg.enable && config.home.username != "root") ( + mkIf systemdCfg.enable ( hm.dag.entryAfter [ "onFilesChange" "reloadSystemd" ] '' if [[ -v PIPEWIRE_RELOAD ]]; then if [[ -v DRY_RUN ]]; then diff --git a/modules/systemd.nix b/modules/systemd.nix index 76a5b94d8..926105906 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -454,8 +454,7 @@ in # If we run under a Linux system we assume that systemd is # available, in particular we assume that systemctl is in PATH. - # Do not install any user services if username is root. - config = mkIf (cfg.enable && config.home.username != "root") { + config = mkIf cfg.enable { assertions = [ (lib.hm.assertions.assertPlatform "systemd" pkgs lib.platforms.linux) ]; diff --git a/tests/modules/systemd/default.nix b/tests/modules/systemd/default.nix index 9221c3474..feafcb84d 100644 --- a/tests/modules/systemd/default.nix +++ b/tests/modules/systemd/default.nix @@ -1,7 +1,6 @@ { systemd-services = ./services.nix; systemd-packages = ./packages.nix; - systemd-services-disabled-for-root = ./services-disabled-for-root.nix; systemd-session-variables = ./session-variables.nix; systemd-user-config = ./user-config.nix; systemd-empty-user-config = ./empty-user-config.nix; diff --git a/tests/modules/systemd/services-disabled-for-root.nix b/tests/modules/systemd/services-disabled-for-root.nix deleted file mode 100644 index bc0060e5b..000000000 --- a/tests/modules/systemd/services-disabled-for-root.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, ... }: - -{ - home.username = lib.mkForce "root"; - - systemd.user.services."test-service@" = { - Unit = { - Description = "A basic test service"; - }; - - Service = { - Environment = [ - "VAR1=1" - "VAR2=2" - ]; - ExecStart = ''/some/exec/start/command --with-arguments "%i"''; - }; - }; - - nmt.script = '' - serviceFile=home-files/.config/systemd/user/test-service@.service - assertPathNotExists $serviceFile - ''; -}