I've defined the following container:
containers.abc123 = {
config = { config, pkgs, ... }:
{
systemd.user.services = {
finder = {
description = "finder";
enable = true;
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.coreutils}/bin/mkdir /tmp/hello";
Restart = "always";
RestartSec = 50;
};
wantedBy = [ "default.target" ];
};
};
};
};
Essentially a test finder service defined. However, this does not seem to work according to the output from:
sudo nixos-container run abc123 -- systemctl status finder
Unit finder.service could not be found.
sudo nixos-container run abc123 -- systemctl status --user finder
Failed to connect to bus: No such file or directory
I thought perhaps these 'user' services don't run for the root user. But after adding a user and logging in, still no change.
sudo nixos-container root-login abc123
[root@abc123:~]# systemctl status --user finder
Failed to connect to bus: No such file or directory
[root@abc123:~]# su test123
[test123@abc123:/root]$ systemctl status --user finder
Failed to connect to bus: No such file or directory
[test123@abc123:/root]$ systemctl status finder
Unit finder.service could not be found.
Why isn't this service working? Is it not supported in nixos containers?