+
+ evaluatedVMConfiguration = import <nixos/nixos/lib/eval-config.nix> {
+ system = builtins.currentSystem;
+ modules = [ "${vmConfiguration}" ];
+ };
+
+ # Also include a syncthing configuration with a device id
+ # because using this feature pulls in additional dependencies.
+ evaluatedSyncthingDeclarativeConfiguration = import <nixos/nixos/lib/eval-config.nix> {
+ system = builtins.currentSystem;
+ modules = [
+ ../lib/test-nixos-rebuild-switch-config.nix
+ {
+ services.syncthing = {
+ enable = true;
+ settings.folders.forDeps.path = "/nope";
+ };
+ }
+ ];
+ };
+
+ initialConfiguration = {
+ imports = [ "${vmConfiguration}" ];
+ virtualisation.memorySize = 2048;
+ system.activationScripts.installInitialConfiguration = {
+ text = ''
+ mkdir -p /etc/nixos
+ cp "${vmConfiguration}" /etc/nixos/configuration.nix
+ '';
+ deps = [ ];
+ };
+ system.extraDependencies = [
+ evaluatedVMConfiguration.config.system.build.toplevel
+ evaluatedSyncthingDeclarativeConfiguration.config.system.build.toplevel
+ ];
+ };
+
+ configurationWithDeviceIDs =
+ pkgs.writeText "configuration-with-device-ids.nix" ''
+ {
+ imports = [
+ ${vmConfiguration}
+ ${deviceIDFilename}
+ ];
+ }
+ '';
+
+ configurationWithFolder =
+ pkgs.writeText "configuration-with-folder.nix" ''
+ { config, ... }: {
+ imports = [ ${configurationWithDeviceIDs} ];
+ services.syncthing.settings.folders.foo = {
+ devices = [ "a" "b" ];
+ path = "''${config.services.syncthing.dataDir}/foo";
+ };
+ }
+ '';
+