1 import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
3 configuration = pkgs.writeText "configuration.nix" ''
6 ${../.}/modules/syncthing-autoregister.nix
7 <nixos/nixos/modules/installer/cd-dvd/channel.nix>
11 openDefaultPorts = true;
14 path = "/tmp/syncthing-auto-register-test-device-ids.nix";
17 environment.systemPackages = with pkgs; [ nix ];
20 configurationWithDeviceIDs =
21 pkgs.writeText "configuration-with-device-ids.nix" ''
25 /tmp/syncthing-auto-register-test-device-ids.nix
33 machine = "${configuration}";
36 def setConfig(machine, config):
37 machine.copy_from_host(config, "/etc/nixos/configuration.nix")
40 initialConfiguration = "${configuration}"
41 configurationWithDeviceIDs = (
42 "${configurationWithDeviceIDs}"
45 setConfig(machine, initialConfiguration)
46 machine.wait_for_unit("syncthing-autoregister.service")
47 setConfig(machine, configurationWithDeviceIDs)
49 '(( "$(nix eval --raw -f "<nixos/nixos>" config.services.syncthing.declarative.devices.machine.id | wc -c)" == 63 ))'