summary refs log blame commit diff
path: root/nixos/tests/wine.nix
blob: 566b9baa67bfac49d9a9a1a2b1685bcbfea58098 (plain) (tree)
1
2
3
4
5
6
7
8
9





                                                        
                                                  

                                                                               






                                                             


                                                                     

                                                                           



                                                  





                                            

         





                                                                       
{ system ? builtins.currentSystem, pkgs ? import ../.. {
  inherit system;
  config = { };
}, }:

let
  inherit (pkgs.lib) concatMapStrings listToAttrs;
  inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;

  hello32 = "${pkgs.pkgsCross.mingw32.hello}/bin/hello.exe";
  hello64 = "${pkgs.pkgsCross.mingwW64.hello}/bin/hello.exe";

  makeWineTest = packageSet: exes: variant: rec {
    name = "${packageSet}-${variant}";
    value = makeTest {
      inherit name;
      meta = with pkgs.lib.maintainers; { maintainers = [ chkno ]; };

      machine = { pkgs, ... }: {
        environment.systemPackages = [ pkgs."${packageSet}"."${variant}" ];
        virtualisation.diskSize = "800";
      };

      testScript = ''
        machine.wait_for_unit("multi-user.target")
        ${concatMapStrings (exe: ''
          greeting = machine.succeed(
              'wine ${exe}'
          )
          assert 'Hello, world!' in greeting
        '') exes}
      '';
    };
  };

  variants = [ "base" "full" "minimal" "staging" "unstable" ];

in listToAttrs (map (makeWineTest "winePackages" [ hello32 ]) variants
  ++ map (makeWineTest "wineWowPackages" [ hello32 hello64 ]) variants)