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
34 a = "${configuration}";
35 b = "${configuration}";
39 def setConfig(machine, config):
40 machine.copy_from_host(config, "/etc/nixos/configuration.nix")
43 initialConfiguration = "${configuration}"
44 configurationWithDeviceIDs = (
45 "${configurationWithDeviceIDs}"
48 setConfig(a, initialConfiguration)
49 a.wait_for_unit("syncthing-autoregister.service")
50 setConfig(a, configurationWithDeviceIDs)
52 '(( "$(nix eval --raw -f "<nixos/nixos>" config.services.syncthing.declarative.devices.a.id | wc -c)" == 63 ))'