disnixos
                                
                                 disnixos copied to clipboard
                                
                                    disnixos copied to clipboard
                            
                            
                            
                        running the VM test script: error: invalid syntax (<string>, line 2)
Hello,
First, thanks for this very promising software. I'm trying to setup a very simple VM network with disnixos+disnix.
So to that extend I created 4 files:
packages.nix
{pkgs, system}:
{
  test1 = [
    pkgs.wget
  ];
  test2 = [
    pkgs.curl
  ];
}
network.nix
{
  test1 = {pkgs, config, ...}:
    {
      environment.systemPackages = with pkgs; [ emacs-nox ];
      users.users.alice = {
        isNormalUser = true;
        home = "/home/alice";
        description = "Alice Foobar";
        password = "mysecretpass";
      };
      # ??? Don't know why but this line fails
      # deployment.targetHost = "test1.example.net";
    };
  test2 = {pkgs, config, ...}:
    {
      environment.systemPackages = with pkgs; [ emacs-nox ];
      users.users.alice = {
        isNormalUser = true;
        home = "/home/alice";
        description = "Alice Foobar";
        password = "mysecretpass";
      };
      # deployment.targetHost = "test2.example.net";
    };
}
services.nix:
{pkgs, system, distribution, invDistribution}:
{
  mc = {
    name = "mc";
    pkg = pkgs.mc;
    type = "package";
  };
}
and distribution.nix:
{infrastructure}:
{
  mc = [ infrastructure.test1 infrastructure.test2 ];
}
But when I run disnixos-vm-env, after the succesful compilation, it gives an error:
$ disnixos-vm-env -n network.nix -P packages.nix -s services.nix -d distribution.nix 
starting VDE switch for network 1
running the VM test script
error: invalid syntax (<string>, line 2)
cleaning up
(0.00 seconds)
I don't know if it's related, but (also for nixos-build-vm) if I add the line deployment.targetHost = "test1.example.net"; I get an error during the compilation:
$ disnixos-vm-env -n network.nix -P packages.nix -s services.nix -d distribution.nix 
error: --- ThrownError --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix-build
The option `deployment' defined in `<unknown-file>' does not exist.
(use '--show-trace' to show detailed location information)
Can you tell me which version of Nixpkgs you are currently using? I suspect this may have something to do with the fact that the upcoming release of Nixpkgs is going to switch to a Python-based implementation of the NixOS test driver. That probably explains the invalid syntax error.
It should definitely work with the last stable Nixpkgs release: 20.03
I'm building it with Nixpkgs release 20.03, more precisely I use this commit https://github.com/NixOS/nixpkgs/archive/14006b724f3.tar.gz.  I put both disnix and disnixos in my environment.systemPackages. Here are some versions:
$ readlink -f $(which disnixos-vm-env)
/nix/store/vg0bvv5g40c9s8nvc8kvzi6375qsjyrd-disnixos-0.8/bin/disnixos-vm-env
$ nix --version
nix (Nix) 2.3.6
$ disnixos-vm-env --version
/run/current-system/sw/bin/disnixos-vm-env (disnixos 0.8)
Copyright (C) 2008-2019 Sander van der Burg
I just did some experiments myself. It turns out that the problem is with the nixos-build-vms command. Basically, disnixos-vm-env uses this command to spawn the QEMU virtual machines. This command is also using the Python test driver. Apparently, it fails to run the initialization script because it's implemented in Perl.
I have just fixed the problem in the current development version so that everything now works with the Python implementation.