diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2018-11-30 17:46:21 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2018-11-30 17:46:21 +0100 |
commit | 1828a5c5ba465b7f342568c6a245a042831ef54c (patch) | |
tree | 3052eb1b293c7655d9ea58d78aa81d0bf2c1d539 /lib | |
parent | 70f5d64cb359a8e4351a32f24d68b8a8e0227b76 (diff) | |
parent | 74e283403c9f10504c1d2ab8c4970289c81a482b (diff) | |
download | nixpkgs-1828a5c5ba465b7f342568c6a245a042831ef54c.tar nixpkgs-1828a5c5ba465b7f342568c6a245a042831ef54c.tar.gz nixpkgs-1828a5c5ba465b7f342568c6a245a042831ef54c.tar.bz2 nixpkgs-1828a5c5ba465b7f342568c6a245a042831ef54c.tar.lz nixpkgs-1828a5c5ba465b7f342568c6a245a042831ef54c.tar.xz nixpkgs-1828a5c5ba465b7f342568c6a245a042831ef54c.tar.zst nixpkgs-1828a5c5ba465b7f342568c6a245a042831ef54c.zip |
Merge master into staging-next
Diffstat (limited to 'lib')
-rw-r--r-- | lib/systems/default.nix | 40 | ||||
-rw-r--r-- | lib/systems/examples.nix | 13 |
2 files changed, 48 insertions, 5 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 0b3475fefb9..25df5e17406 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -66,6 +66,46 @@ rec { # uname -r release = null; }; + + qemuArch = + if final.isArm then "arm" + else if final.isx86_64 then "x86_64" + else if final.isx86 then "i386" + else { + "powerpc" = "ppc"; + "powerpc64" = "ppc64"; + "powerpc64le" = "ppc64"; + "mips64" = "mips"; + "mipsel64" = "mipsel"; + }.${final.parsed.cpu.name} or final.parsed.cpu.name; + + emulator = pkgs: let + qemu-user = pkgs.qemu.override { + smartcardSupport = false; + spiceSupport = false; + openGLSupport = false; + virglSupport = false; + vncSupport = false; + gtkSupport = false; + sdlSupport = false; + pulseSupport = false; + smbdSupport = false; + seccompSupport = false; + hostCpuTargets = ["${final.qemuArch}-linux-user"]; + }; + wine-name = "wine${toString final.parsed.cpu.bits}"; + wine = (pkgs.winePackagesFor wine-name).minimal; + in + if final.parsed.kernel.name == pkgs.stdenv.hostPlatform.parsed.kernel.name && + (final.parsed.cpu.name == pkgs.stdenv.hostPlatform.parsed.cpu.name || + (final.platform.isi686 && pkgs.stdenv.hostPlatform.isx86_64)) + then pkgs.runtimeShell + else if final.isWindows + then "${wine}/bin/${wine-name}" + else if final.isLinux && pkgs.stdenv.hostPlatform.isLinux + then "${qemu-user}/bin/qemu-${final.qemuArch}" + else throw "Don't know how to run ${final.config} executables."; + } // mapAttrs (n: v: v final.parsed) inspect.predicates // args; in assert final.useAndroidPrebuilt -> final.isAndroid; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index acd673df666..c799b9ec449 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -2,7 +2,14 @@ # `crossSystem`. They are put here for user convenience, but also used by cross # tests and linux cross stdenv building, so handle with care! { lib }: -let platforms = import ./platforms.nix { inherit lib; }; in +let + platforms = import ./platforms.nix { inherit lib; }; + + riscv = bits: { + config = "riscv${bits}-unknown-linux-gnu"; + platform = platforms.riscv-multiplatform bits; + }; +in rec { # @@ -92,10 +99,6 @@ rec { musl64 = { config = "x86_64-unknown-linux-musl"; }; musl32 = { config = "i686-unknown-linux-musl"; }; - riscv = bits: { - config = "riscv${bits}-unknown-linux-gnu"; - platform = platforms.riscv-multiplatform bits; - }; riscv64 = riscv "64"; riscv32 = riscv "32"; |