lol

nixos/systemd/userdbd: add method to enable service

This is recommended to enable in conjunction with systemd-homed.

Leorize 0cc87ab9 7ea3d439

+52
+1
nixos/modules/module-list.nix
··· 1275 1275 ./system/boot/systemd/shutdown.nix 1276 1276 ./system/boot/systemd/tmpfiles.nix 1277 1277 ./system/boot/systemd/user.nix 1278 + ./system/boot/systemd/userdbd.nix 1278 1279 ./system/boot/timesyncd.nix 1279 1280 ./system/boot/tmp.nix 1280 1281 ./system/boot/uvesafb.nix
+18
nixos/modules/system/boot/systemd/userdbd.nix
··· 1 + { config, lib, ... }: 2 + 3 + let 4 + cfg = config.services.userdbd; 5 + in 6 + { 7 + options.services.userdbd.enable = lib.mkEnableOption (lib.mdDoc '' 8 + Enables the systemd JSON user/group record lookup service 9 + ''); 10 + config = lib.mkIf cfg.enable { 11 + systemd.additionalUpstreamSystemUnits = [ 12 + "systemd-userdbd.socket" 13 + "systemd-userdbd.service" 14 + ]; 15 + 16 + systemd.sockets.systemd-userdbd.wantedBy = [ "sockets.target" ]; 17 + }; 18 + }
+1
nixos/tests/all-tests.nix
··· 636 636 systemd-shutdown = handleTest ./systemd-shutdown.nix {}; 637 637 systemd-timesyncd = handleTest ./systemd-timesyncd.nix {}; 638 638 systemd-misc = handleTest ./systemd-misc.nix {}; 639 + systemd-userdbd = handleTest ./systemd-userdbd.nix {}; 639 640 tandoor-recipes = handleTest ./tandoor-recipes.nix {}; 640 641 taskserver = handleTest ./taskserver.nix {}; 641 642 tayga = handleTest ./tayga.nix {};
+32
nixos/tests/systemd-userdbd.nix
··· 1 + import ./make-test-python.nix ({ pkgs, lib, ... }: { 2 + name = "systemd-userdbd"; 3 + nodes.machine = { config, pkgs, ... }: { 4 + services.userdbd.enable = true; 5 + 6 + users.users.test-user-nss = { 7 + isNormalUser = true; 8 + }; 9 + 10 + environment.etc."userdb/test-user-dropin.user".text = builtins.toJSON { 11 + userName = "test-user-dropin"; 12 + }; 13 + 14 + environment.systemPackages = with pkgs; [ libvarlink ]; 15 + }; 16 + testScript = '' 17 + import json 18 + from shlex import quote 19 + 20 + def getUserRecord(name): 21 + Interface = "unix:/run/systemd/userdb/io.systemd.Multiplexer/io.systemd.UserDatabase" 22 + payload = json.dumps({ 23 + "service": "io.systemd.Multiplexer", 24 + "userName": name 25 + }) 26 + return json.loads(machine.succeed(f"varlink call {Interface}.GetUserRecord {quote(payload)}")) 27 + 28 + machine.wait_for_unit("systemd-userdbd.socket") 29 + getUserRecord("test-user-nss") 30 + getUserRecord("test-user-dropin") 31 + ''; 32 + })