diff options
author | Silvan Mosberger <github@infinisil.com> | 2022-03-25 19:05:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-25 19:05:35 +0100 |
commit | 5a67e9db616f6118ef5c0e2241b43b437b6d6239 (patch) | |
tree | 46571722ba9cefee2324f364e846e00bdeb1c457 /nixos | |
parent | f33719eda108fea4611a95d7d54a0dfb91c9ebc5 (diff) | |
parent | c70a466d21fbd72f73cfc263e93f967e79953e73 (diff) | |
download | nixlib-5a67e9db616f6118ef5c0e2241b43b437b6d6239.tar nixlib-5a67e9db616f6118ef5c0e2241b43b437b6d6239.tar.gz nixlib-5a67e9db616f6118ef5c0e2241b43b437b6d6239.tar.bz2 nixlib-5a67e9db616f6118ef5c0e2241b43b437b6d6239.tar.lz nixlib-5a67e9db616f6118ef5c0e2241b43b437b6d6239.tar.xz nixlib-5a67e9db616f6118ef5c0e2241b43b437b6d6239.tar.zst nixlib-5a67e9db616f6118ef5c0e2241b43b437b6d6239.zip |
Merge pull request #133532 from Infinisil/systemd-unit-dirs
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/systemd-lib.nix | 10 | ||||
-rw-r--r-- | nixos/tests/all-tests.nix | 2 | ||||
-rw-r--r-- | nixos/tests/systemd-misc.nix (renamed from nixos/tests/systemd-unit-path.nix) | 17 |
3 files changed, 23 insertions, 6 deletions
diff --git a/nixos/lib/systemd-lib.nix b/nixos/lib/systemd-lib.nix index a472d97f5cc7..37900b0b16f6 100644 --- a/nixos/lib/systemd-lib.nix +++ b/nixos/lib/systemd-lib.nix @@ -23,8 +23,9 @@ in rec { inherit (unit) text; } '' - mkdir -p $out - echo -n "$text" > $out/${shellEscape name} + name=${shellEscape name} + mkdir -p "$out/$(dirname "$name")" + echo -n "$text" > "$out/$name" '' else pkgs.runCommand "unit-${mkPathSafeName name}-disabled" @@ -32,8 +33,9 @@ in rec { allowSubstitutes = false; } '' - mkdir -p $out - ln -s /dev/null $out/${shellEscape name} + name=${shellEscape name} + mkdir -p "$out/$(dirname "$name")" + ln -s /dev/null "$out/$name" ''; boolValues = [true false "yes" "no"]; diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 47587b1b30c0..413fc5637b61 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -519,7 +519,7 @@ in systemd-networkd-vrf = handleTest ./systemd-networkd-vrf.nix {}; systemd-nspawn = handleTest ./systemd-nspawn.nix {}; systemd-timesyncd = handleTest ./systemd-timesyncd.nix {}; - systemd-unit-path = handleTest ./systemd-unit-path.nix {}; + systemd-misc = handleTest ./systemd-misc.nix {}; taskserver = handleTest ./taskserver.nix {}; teeworlds = handleTest ./teeworlds.nix {}; telegraf = handleTest ./telegraf.nix {}; diff --git a/nixos/tests/systemd-unit-path.nix b/nixos/tests/systemd-misc.nix index 5998a187188a..e416baa8b5f5 100644 --- a/nixos/tests/systemd-unit-path.nix +++ b/nixos/tests/systemd-misc.nix @@ -29,10 +29,23 @@ let }; in { - name = "systemd-unit-path"; + name = "systemd-misc"; machine = { pkgs, lib, ... }: { boot.extraSystemdUnitPaths = [ "/etc/systemd-rw/system" ]; + + users.users.limited = { + isNormalUser = true; + uid = 1000; + }; + + systemd.units."user-1000.slice.d/limits.conf" = { + text = '' + [Slice] + TasksAccounting=yes + TasksMax=100 + ''; + }; }; testScript = '' @@ -43,5 +56,7 @@ in ) machine.succeed("systemctl start example.service") machine.succeed("systemctl status example.service | grep 'Active: active'") + + machine.succeed("systemctl show --property TasksMax --value user-1000.slice | grep 100") ''; }) |