1 import ./make-test-python.nix ({ pkgs, ... }:
4 exampleScript = pkgs.writeTextFile {
7 #! ${pkgs.runtimeShell} -e
10 echo "Example script running" >&2
11 ${pkgs.coreutils}/bin/sleep 1
17 unitFile = pkgs.writeTextFile {
18 name = "example.service";
21 Description=Example systemd service unit file
24 ExecStart=${exampleScript}
27 WantedBy=multi-user.target
32 name = "systemd-misc";
34 nodes.machine = { pkgs, lib, ... }: {
35 boot.extraSystemdUnitPaths = [ "/etc/systemd-rw/system" ];
37 users.users.limited = {
42 systemd.units."user-1000.slice.d/limits.conf" = {
52 machine.wait_for_unit("multi-user.target")
53 machine.succeed("mkdir -p /etc/systemd-rw/system")
55 "cp ${unitFile} /etc/systemd-rw/system/example.service"
57 machine.succeed("systemctl start example.service")
58 machine.succeed("systemctl status example.service | grep 'Active: active'")
60 machine.succeed("systemctl show --property TasksMax --value user-1000.slice | grep 100")