mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
nixos/systemd-user: call systemd-tmpfiles during activation
Just like with system-wide tmpfiles, call `systemd-tmpfiles --create --remove` for users during activation. This fixes an issue where new entries in a user's tmpfiles are not reflected after activation, only at boot when the user service systemd-tmpfiles-setup.service runs or only after running systemd-tmpfiles manually.
This commit is contained in:
parent
a7d27e87ee
commit
e39c9f13bc
@ -230,5 +230,9 @@ in {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
cfg.tmpfiles.users;
|
cfg.tmpfiles.users;
|
||||||
|
|
||||||
|
system.userActivationScripts.tmpfiles = ''
|
||||||
|
${config.systemd.package}/bin/systemd-tmpfiles --user --create --remove
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import ./make-test-python.nix ({ lib, ... }: {
|
|||||||
initialPassword = "pass1";
|
initialPassword = "pass1";
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
};
|
};
|
||||||
|
systemd.user.tmpfiles.users.alice.rules = [ "r %h/file-to-remove" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
@ -27,7 +28,9 @@ import ./make-test-python.nix ({ lib, ... }: {
|
|||||||
machine.wait_for_file("/home/alice/login-ok")
|
machine.wait_for_file("/home/alice/login-ok")
|
||||||
verify_user_activation_run_count(1)
|
verify_user_activation_run_count(1)
|
||||||
|
|
||||||
|
machine.succeed("touch /home/alice/file-to-remove")
|
||||||
machine.succeed("/run/current-system/bin/switch-to-configuration test")
|
machine.succeed("/run/current-system/bin/switch-to-configuration test")
|
||||||
verify_user_activation_run_count(2)
|
verify_user_activation_run_count(2)
|
||||||
|
machine.succeed("[[ ! -f /home/alice/file-to-remove ]] || false")
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user