diff options
author | Leorize <leorize+oss@disroot.org> | 2022-12-07 18:31:05 -0600 |
---|---|---|
committer | Leorize <leorize+oss@disroot.org> | 2022-12-08 10:28:41 -0600 |
commit | 0cc87ab901909ae949d22caf071e446bed83e47a (patch) | |
tree | 007ae81c031dc4fd04f208aee20183d3b358146d /nixos/tests/systemd-userdbd.nix | |
parent | 7ea3d4395dc97845ff755caa790b3ccffdb681dc (diff) |
nixos/systemd/userdbd: add method to enable service
This is recommended to enable in conjunction with systemd-homed.
Diffstat (limited to 'nixos/tests/systemd-userdbd.nix')
-rw-r--r-- | nixos/tests/systemd-userdbd.nix | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/nixos/tests/systemd-userdbd.nix b/nixos/tests/systemd-userdbd.nix new file mode 100644 index 0000000000000..5d0233ffd9fb8 --- /dev/null +++ b/nixos/tests/systemd-userdbd.nix @@ -0,0 +1,32 @@ +import ./make-test-python.nix ({ pkgs, lib, ... }: { + name = "systemd-userdbd"; + nodes.machine = { config, pkgs, ... }: { + services.userdbd.enable = true; + + users.users.test-user-nss = { + isNormalUser = true; + }; + + environment.etc."userdb/test-user-dropin.user".text = builtins.toJSON { + userName = "test-user-dropin"; + }; + + environment.systemPackages = with pkgs; [ libvarlink ]; + }; + testScript = '' + import json + from shlex import quote + + def getUserRecord(name): + Interface = "unix:/run/systemd/userdb/io.systemd.Multiplexer/io.systemd.UserDatabase" + payload = json.dumps({ + "service": "io.systemd.Multiplexer", + "userName": name + }) + return json.loads(machine.succeed(f"varlink call {Interface}.GetUserRecord {quote(payload)}")) + + machine.wait_for_unit("systemd-userdbd.socket") + getUserRecord("test-user-nss") + getUserRecord("test-user-dropin") + ''; +}) |