mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
52 lines
1.8 KiB
Nix
52 lines
1.8 KiB
Nix
{ system ? builtins.currentSystem
|
|
, pkgs ? import ../.. { inherit system; config = { }; }
|
|
}:
|
|
|
|
let
|
|
inherit (pkgs.lib) concatMapStrings listToAttrs optionals optionalString;
|
|
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 ]; };
|
|
|
|
nodes.machine = { pkgs, ... }: {
|
|
environment.systemPackages = [ pkgs."${packageSet}"."${variant}" ];
|
|
virtualisation.diskSize = 800;
|
|
};
|
|
|
|
testScript = ''
|
|
machine.wait_for_unit("multi-user.target")
|
|
${concatMapStrings (exe: ''
|
|
greeting = machine.succeed(
|
|
"bash -c 'wine ${exe} 2> >(tee wine-stderr >&2)'"
|
|
)
|
|
assert 'Hello, world!' in greeting
|
|
''
|
|
# only the full version contains Gecko, but the error is not printed reliably in other variants
|
|
+ optionalString (variant == "full") ''
|
|
machine.fail(
|
|
"fgrep 'Could not find Wine Gecko. HTML rendering will be disabled.' wine-stderr"
|
|
)
|
|
'') exes}
|
|
'';
|
|
};
|
|
};
|
|
|
|
variants = [ "base" "full" "minimal" "staging" "unstable" "wayland" ];
|
|
|
|
in
|
|
listToAttrs (
|
|
map (makeWineTest "winePackages" [ hello32 ]) variants
|
|
++ optionals pkgs.stdenv.hostPlatform.is64bit
|
|
(map (makeWineTest "wineWowPackages" [ hello32 hello64 ])
|
|
# This wayland combination times out after spending many hours.
|
|
# https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.wine.wineWowPackages-wayland.x86_64-linux
|
|
(pkgs.lib.remove "wayland" variants))
|
|
)
|