<commit_before>{ nixos ? ./..
, nixpkgs ? /etc/nixos/nixpkgs
, services ? /etc/nixos/services
, system ? builtins.currentSystem
}:

with import ../lib/build-vms.nix { inherit nixos nixpkgs services system; };

rec {
  nodes = {
    storage = 
      {pkgs, config, ...}:
      {
        services = {
          portmap = {
            enable = true;
          };
    
          nfsKernel = {
            enable = true;
            exports = ''
              /repos 192.168.1.0/255.255.255.0(rw,no_root_squash)
            '';
	    createMountPoints = true;
          };    
        };  
      };

    postgresql =
      {config, pkgs, ...}:
      {
        services = {
          sshd = {
            enable = true;
          };
    
          postgresql = {
            enable = true;
    	    enableTCPIP = true;
	    
            authentication = ''
              # Generated file; do not edit!
              local all all                trust
              host  all all 127.0.0.1/32   trust
	      host  all all ::1/128        trust
	      host  all all 192.168.1.0/24 trust
            '';
          };
        };  
      };

    webserver = 
      {config, pkgs, ...}:
      {
        fileSystems = pkgs.lib.mkOverride 50 {} 
	[ 
	  { mountPoint = "/repos";
	    device = "storage:/repos"; } 
	];
      
        services = {
	  portmap = {
	    enable = true;
	  };

          nfsKernel = {
            enable = true;
          };
  
          httpd = {
            enable = true;
            adminAddr = "root@localhost";
            extraSubservices = [
	      { serviceType = "trac"; }
            ];
          };
        };
	
	environment = {
	  extraPackages = [ pkgs.pythonPackages.trac pkgs.subversion ];
	};
      };
      
    client = 
      {config, pkgs, ...}:
      {
        services = {
	  xserver = {
	    enable = true;

            displayManager = {
	      slim = {
	        enable = false;
	      };
              kdm = {
	        enable = true;
		extraConfig =
                  ''
                    [X-:0-Core]
                    AutoLoginEnable=true
                    AutoLoginUser=alice
                    AutoLoginPass=<PASSWORD>
                  '';
	      };
	    };
	    desktopManager = {
	      default = "kde4";
	      kde4 = {
	        enable = true;
	      };
	    };            
	  };
	};
	
	users = {
	  extraUsers = pkgs.lib.singleton { 
	      name = "alice";
              description = "<NAME>";
              home = "/home/alice";
              createHome = true;
              useDefaultShell = true;
              password = "<PASSWORD>";
          };
        };
 
        environment = {
	  extraPackages = [
	    pkgs.scrot
	  ];
	};
      };
  };
    
  vms = buildVirtualNetwork { inherit nodes; };

  test = runTests vms
    ''
      startAll;
      
      $postgresql->waitForFile("/tmp/.s.PGSQL.5432");
      $postgresql->mustSucceed("createdb trac");
      
      $webserver->mustSucceed("mkdir -p /repos/trac");
      $webserver->mustSucceed("svnadmin create /repos/trac");
      
      $webserver->waitForFile("/var/trac");      
      $webserver->mustSucceed("mkdir -p /var/trac/projects/test");
      $webserver->mustSucceed("PYTHONPATH=${pkgs.pythonPackages.psycopg2}/lib/python2.5/site-packages trac-admin /var/trac/projects/test initenv Test postgres://root\@postgresql/trac svn /repos/trac");
      
      $client->waitForFile("/tmp/.X11-unix/X0");
      sleep 60;
      <commit_msg>Shortened the Trac test expression a bit to make it more readable<commit_after>{ nixos ? ./..
, nixpkgs ? /etc/nixos/nixpkgs
, services ? /etc/nixos/services
, system ? builtins.currentSystem
}:

with import ../lib/build-vms.nix { inherit nixos nixpkgs services system; };

rec {
  nodes = {
    storage = 
      {pkgs, config, ...}:
      {
        services.portmap.enable = true;
        services.nfsKernel.enable = true;
        services.nfsKernel.exports = ''
          /repos 192.168.1.0/255.255.255.0(rw,no_root_squash)
        '';
	services.nfsKernel.createMountPoints = true;
      };

    postgresql =
      {config, pkgs, ...}:
      {
        services.sshd.enable = true;
        services.postgresql.enable = true;
    	services.postgresql.enableTCPIP = true;
        services.postgresql.authentication = ''
          # Generated file; do not edit!
          local all all                trust
          host  all all 127.0.0.1/32   trust
	  host  all all ::1/128        trust
	  host  all all 192.168.1.0/24 trust
        '';
      };

    webserver = 
      {config, pkgs, ...}:
      {
        fileSystems = pkgs.lib.mkOverride 50 {} 
	[ 
	  { mountPoint = "/repos";
	    device = "storage:/repos"; } 
	];
      
        services.portmap.enable = true;
        services.nfsKernel.enable = true;
        services.httpd.enable = true;
        services.httpd.adminAddr = "root@localhost";
        services.httpd.extraSubservices = [ { serviceType = "trac"; } ];
	environment.systemPackages = [ pkgs.pythonPackages.trac pkgs.subversion ];
      };
      
    client = 
      {config, pkgs, ...}:
      {
        services.xserver.enable = true;
        services.xserver.displayManager.slim.enable = false;
        services.xserver.displayManager.kdm.enable = true;
	services.xserver.displayManager.kdm.extraConfig =
          ''
            [X-:0-Core]
            AutoLoginEnable=true
            AutoLoginUser=alice
            AutoLoginPass=<PASSWORD>
          '';
	services.xserver.desktopManager.default = "kde4";
	services.xserver.desktopManager.kde4.enable = true;
	users.extraUsers = pkgs.lib.singleton { 
	  name = "alice";
          description = "<NAME>";
          home = "/home/alice";
          createHome = true;
          useDefaultShell = true;
          password = "<PASSWORD>";
        };
        environment.systemPackages = [ pkgs.scrot ];
      };
  };
    
  vms = buildVirtualNetwork { inherit nodes; };

  test = runTests vms
    ''
      startAll;
      
      $postgresql->waitForFile("/tmp/.s.PGSQL.5432");
      $postgresql->mustSucceed("createdb trac");
      
      $webserver->mustSucceed("mkdir -p /repos/trac");
      $webserver->mustSucceed("svnadmin create /repos/trac");
      
      $webserver->waitForFile("/var/trac");      
      $webserver->mustSucceed("mkdir -p /var/trac/projects/test");
      $webserver->mustSucceed("PYTHONPATH=${pkgs.pythonPackages.psycopg2}/lib/python2.5/site-packages trac-admin /var/trac/projects/test initenv Test postgres://root\@postgresql/trac svn /repos/trac");
      
      $client->waitForFile("/tmp/.X11-unix/X0");
      sleep 60;
      
{'fraction_non_alphanumeric': 0.132319391634981, 'fraction_numerical': 0.017338403041825094, 'mean_word_length': 1.5637426900584794, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1147924', 'n_tokens_mistral': 2228, 'n_tokens_neox': 2045, 'n_words': 339}