2.home-manager/tests/modules/systemd/packages.nix
Arthur Khashaev 27613c7299
systemd: add packages option (#8540)
* systemd: add `packages` option

The `systemd.user.packages` option is the Home Manager equivalent of
NixOS’s `systemd.packages` option and provides a way to specify packages
providing systemd user units.

This option is similar to `dbus.packages`.
* systemd: only create the parent directory if there are packages to symlink
2026-01-15 00:51:28 +01:00

20 lines
517 B
Nix

{ pkgs, config, ... }:
let
package = config.lib.test.mkStubPackage {
buildScript = ''
mkdir -p $out/share/systemd/user
> $out/share/systemd/user/dummy.service cat <<EOF
[Service]
ExecStart=$out/bin/nonexistent
EOF
'';
};
in
{
systemd.user.packages = [ package ];
nmt.script = ''
serviceFile=home-files/.local/share/systemd/user/dummy.service
assertFileExists "$serviceFile"
assertFileContent "$serviceFile" ${package}/share/systemd/user/dummy.service
'';
}