import ({ pkgs, lib, ... }: let configuration = pkgs.writeText "configuration.nix" '' { pkgs, ... }: { imports = [ ${../.}/modules/syncthing-autoregister.nix ]; services.syncthing = { enable = true; openDefaultPorts = true; autoRegister = { enable = true; path = "/tmp/syncthing-auto-register-test-device-ids.nix"; }; }; environment.systemPackages = with pkgs; [ nix ]; } ''; configurationWithDeviceIDs = pkgs.writeText "configuration-with-device-ids.nix" '' { imports = [ ${configuration} /tmp/syncthing-auto-register-test-device-ids.nix ]; } ''; in { name = "syncthing"; machine = "${configuration}"; testScript = '' machine.copy_from_host( "${configuration}", "/etc/nixos/configuration.nix", ) machine.wait_for_unit("syncthing-autoregister.service") machine.copy_from_host( "${configurationWithDeviceIDs}", "/etc/nixos/configuration.nix", ) machine.succeed( '(( "$(nix eval --raw -f "" config.services.syncthing.declarative.devices.machine.id | wc -c)" == 63 ))' ) ''; })