mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
* systemd: install systemd files when user is root (revert c2aa831)
* Apply suggestions from code review
Co-authored-by: Anillc <void@anil.lc>
---------
Co-authored-by: Anillc <void@anil.lc>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user