Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5bf36e5
stdenv: start working on adding more bootstrap tools
piperswe Oct 13, 2021
6957943
lib/tests: add sparc64-linux to systems.nix
piperswe Oct 13, 2021
0115834
lib: flesh out doubles
piperswe Oct 13, 2021
b032580
lib: clean up sparc64
piperswe Oct 13, 2021
023ce07
lib: flesh out tests/systems
piperswe Oct 14, 2021
6171d9e
busybox: don't use musl on risc-v and sparc
piperswe Oct 14, 2021
b411f7e
busybox/sandbox-shell: fix eval on sparc64
piperswe Oct 14, 2021
0c54199
stdenv: re-add useMusl to busyboxMinimal
piperswe Oct 14, 2021
1e31925
pcre: disable JIT on SPARC
piperswe Oct 14, 2021
1a06f19
stdenv: add bootstrap tools for ppc64le and sparc64
piperswe Oct 13, 2021
1e4c597
stdenv: add derivation for building seeds from scratch
piperswe Oct 13, 2021
90916b3
release: build bootstrap-tools from scratch in hydra
piperswe Oct 13, 2021
dbe1471
lib: make qemuSerialDevice compatible with SPARC
piperswe Oct 13, 2021
b5d08be
release: attempt to fix eval
piperswe Oct 13, 2021
0876acb
stdenv: fix building stdenv with cross-bootstrap
piperswe Oct 13, 2021
6a4def6
musl: fail in eval for unsupported platforms
piperswe Oct 13, 2021
a2ecc8f
mips: fix powerpc eval
piperswe Oct 13, 2021
d80a804
musl: limit to Linux
piperswe Oct 13, 2021
66c8fb2
musl: fix predicates
piperswe Oct 13, 2021
9d75aeb
musl: move platforms into doubles for use elsewhere
piperswe Oct 13, 2021
50a957a
musl: remove supportsMusl
piperswe Oct 14, 2021
1e268db
stdenv: add new stage building hardened gcc
piperswe Oct 14, 2021
c303c89
stdenv: fix multi-stage bootstrap tools build
piperswe Oct 14, 2021
3e84ebc
stdenv: pass bootstrapFiles more elegantly
piperswe Oct 14, 2021
c550f2f
stdenv: add pkgsWithTools to make-bootstrap-tools
piperswe Oct 14, 2021
06a046f
stdenv: import pkgs.path instead of nixpkgs
piperswe Oct 14, 2021
44cdd2c
stdenv: fix eval
piperswe Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

lib = import ./lib;

systems = lib.systems.supported.hydra;
systems = lib.platforms.all;

forAllSystems = f: lib.genAttrs systems (system: f system);

Expand Down
21 changes: 14 additions & 7 deletions lib/systems/doubles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ let
"x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin"

# FreeBSD
"i686-freebsd" "x86_64-freebsd"
"aarch64-freebsd" "armv5tel-freebsd" "armv6l-freebsd"
"armv7l-freebsd" "i686-freebsd" "mipsel-freebsd"
"powerpc64-freebsd" "riscv64-freebsd" "sparc64-freebsd"
"x86_64-freebsd"

# Genode
"aarch64-genode" "i686-genode" "x86_64-genode"
Expand All @@ -28,24 +31,26 @@ let
"aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux"
"armv7l-linux" "i686-linux" "m68k-linux" "mipsel-linux"
"powerpc64-linux" "powerpc64le-linux" "riscv32-linux"
"riscv64-linux" "s390-linux" "s390x-linux" "x86_64-linux"
"riscv64-linux" "s390-linux" "s390x-linux" "sparc64-linux"
"x86_64-linux"

# MMIXware
"mmix-mmixware"

# NetBSD
"aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd"
"i686-netbsd" "m68k-netbsd" "mipsel-netbsd" "powerpc-netbsd"
"riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd"
"riscv32-netbsd" "riscv64-netbsd" "sparc64-netbsd" "x86_64-netbsd"

# none
"aarch64-none" "arm-none" "armv6l-none" "avr-none" "i686-none"
"msp430-none" "or1k-none" "m68k-none" "powerpc-none"
"riscv32-none" "riscv64-none" "s390-none" "s390x-none" "vc4-none"
"x86_64-none"
"riscv32-none" "riscv64-none" "s390-none" "s390x-none" "sparc64-none"
"vc4-none" "x86_64-none"

# OpenBSD
"i686-openbsd" "x86_64-openbsd"
"aarch64-openbsd" "armv7l-openbsd" "i686-openbsd" "powerpc64-openbsd"
"riscv64-openbsd" "sparc64-openbsd" "x86_64-openbsd"

# Redox
"x86_64-redox"
Expand All @@ -54,7 +59,7 @@ let
"wasm64-wasi" "wasm32-wasi"

# Windows
"x86_64-windows" "i686-windows"
"x86_64-windows" "i686-windows" "aarch64-windows"
];

allParsed = map parse.mkSystemFromString all;
Expand All @@ -78,6 +83,8 @@ in {
or1k = filterDoubles predicates.isOr1k;
m68k = filterDoubles predicates.isM68k;
s390 = filterDoubles predicates.isS390;
sparc = filterDoubles predicates.isSparc;
sparc64 = filterDoubles predicates.isSparc64;
js = filterDoubles predicates.isJavaScript;

bigEndian = filterDoubles predicates.isBigEndian;
Expand Down
4 changes: 4 additions & 0 deletions lib/systems/examples.nix
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ rec {
config = "s390x-unknown-linux-gnu";
};

sparc64-linux = {
config = "sparc64-unknown-linux-gnu";
};

arm-embedded = {
config = "arm-none-eabi";
libc = "newlib";
Expand Down
1 change: 1 addition & 0 deletions lib/systems/inspect.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ rec {
isMmix = { cpu = { family = "mmix"; }; };
isRiscV = { cpu = { family = "riscv"; }; };
isSparc = { cpu = { family = "sparc"; }; };
isSparc64 = { cpu = { family = "sparc"; bits = 64; }; };
isWasm = { cpu = { family = "wasm"; }; };
isMsp430 = { cpu = { family = "msp430"; }; };
isVc4 = { cpu = { family = "vc4"; }; };
Expand Down
18 changes: 9 additions & 9 deletions lib/tests/systems.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ in
with lib.systems.doubles; lib.runTests {
testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ mmix ++ js ++ genode ++ redox);

testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-netbsd" "armv6l-none" "armv7a-linux" "armv7a-netbsd" "armv7l-linux" "armv7l-netbsd" "arm-none" "armv7a-darwin" ];
testi686 = mseteq i686 [ "i686-linux" "i686-freebsd" "i686-genode" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ];
testmips = mseteq mips [ "mipsel-linux" "mipsel-netbsd" ];
testarm = mseteq arm [ "armv7a-darwin" "armv5tel-freebsd" "armv6l-freebsd" "armv7l-freebsd" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "arm-none" "armv6l-none" "armv7l-openbsd" ];
testi686 = mseteq i686 [ "i686-cygwin" "i686-darwin" "i686-freebsd" "i686-genode" "i686-linux" "i686-netbsd" "i686-none" "i686-openbsd" "i686-windows" ];
testmips = mseteq mips [ "mipsel-freebsd" "mipsel-linux" "mipsel-netbsd" ];
testmmix = mseteq mmix [ "mmix-mmixware" ];
testx86_64 = mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-genode" "x86_64-redox" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" "x86_64-windows" "x86_64-none" ];
testx86_64 = mseteq x86_64 [ "x86_64-cygwin" "x86_64-darwin" "x86_64-freebsd" "x86_64-genode" "x86_64-solaris" "x86_64-linux" "x86_64-netbsd" "x86_64-none" "x86_64-openbsd" "x86_64-redox" "x86_64-windows" ];

testcygwin = mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ];
testdarwin = mseteq darwin [ "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin" ];
testfreebsd = mseteq freebsd [ "i686-freebsd" "x86_64-freebsd" ];
testfreebsd = mseteq freebsd [ "aarch64-freebsd" "armv5tel-freebsd" "armv6l-freebsd" "armv7l-freebsd" "i686-freebsd" "mipsel-freebsd" "powerpc64-freebsd" "riscv64-freebsd" "sparc64-freebsd" "x86_64-freebsd" ];
testgenode = mseteq genode [ "aarch64-genode" "i686-genode" "x86_64-genode" ];
testredox = mseteq redox [ "x86_64-redox" ];
testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */);
testillumos = mseteq illumos [ "x86_64-solaris" ];
testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" "m68k-linux" "s390-linux" "s390x-linux" ];
testnetbsd = mseteq netbsd [ "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "m68k-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd" ];
testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ];
testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ];
testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "m68k-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv32-linux" "riscv64-linux" "s390-linux" "s390x-linux" "sparc64-linux" "x86_64-linux" ];
testnetbsd = mseteq netbsd [ "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "m68k-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "sparc64-netbsd" "x86_64-netbsd" ];
testopenbsd = mseteq openbsd [ "aarch64-openbsd" "armv7l-openbsd" "i686-openbsd" "powerpc64-openbsd" "riscv64-openbsd" "sparc64-openbsd" "x86_64-openbsd" ];
testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "x86_64-windows" "i686-windows" "aarch64-windows" ];
testunix = mseteq unix (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ cygwin ++ redox);
}
2 changes: 1 addition & 1 deletion nixos/lib/qemu-common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rec {
];

qemuSerialDevice = if pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 then "ttyS0"
else if (with pkgs.stdenv.hostPlatform; isAarch32 || isAarch64 || isPower) then "ttyAMA0"
else if (with pkgs.stdenv.hostPlatform; isAarch32 || isAarch64 || isPower || isSparc) then "ttyAMA0"
else throw "Unknown QEMU serial device for system '${pkgs.stdenv.hostPlatform.system}'";

qemuBinary = qemuPkg: {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/pcre/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ in stdenv.mkDerivation {
outputs = [ "bin" "dev" "out" "doc" "man" ];

# Disable jit on Apple Silicon, https://github.com/zherczeg/sljit/issues/51
configureFlags = optional (!stdenv.hostPlatform.isRiscV && !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)) "--enable-jit" ++ [
configureFlags = optional (!stdenv.hostPlatform.isRiscV && !stdenv.hostPlatform.isSparc && !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)) "--enable-jit" ++ [
"--enable-unicode-properties"
"--disable-cpp"
]
Expand Down
2 changes: 1 addition & 1 deletion pkgs/os-specific/linux/busybox/sandbox-shell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ busybox}:
{ busybox }:

# Minimal shell for use as basic /bin/sh in sandbox builds
busybox.override {
Expand Down
11 changes: 10 additions & 1 deletion pkgs/os-specific/linux/musl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,16 @@ stdenv.mkDerivation rec {
homepage = "https://musl.libc.org/";
changelog = "https://git.musl-libc.org/cgit/musl/tree/WHATSNEW?h=v${version}";
license = licenses.mit;
platforms = platforms.linux;
# See https://wiki.musl-libc.org/supported-platforms.html
platforms = [
"i386-linux" "x86_64-linux"
"armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux"
"mipsel-linux"
"powerpc64-linux" "powerpc64le-linux"
"or1k-linux"
"s390x-linux"
"riscv64-linux"
];
Comment on lines +151 to +159
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically platforms.linux? Or which platform is not supported? I can't tell. It would be way cleaner to substract the one or two not working platforms from platforms.linux or just write them into meta.broken.

maintainers = with maintainers; [ thoughtpolice dtzWill ];
};
}
2 changes: 1 addition & 1 deletion pkgs/stdenv/cross/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib
, localSystem, crossSystem, config, overlays, crossOverlays ? []
, localSystem, crossSystem, config, overlays, crossOverlays ? [], ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we suddenly need to accept any input here and in the other files below? I don't think that is a good idea because it swallows mistakes like typos and makes.

}:

let
Expand Down
2 changes: 1 addition & 1 deletion pkgs/stdenv/custom/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib
, localSystem, crossSystem, config, overlays, crossOverlays ? []
, localSystem, crossSystem, config, overlays, crossOverlays ? [], ...
}:

assert crossSystem == localSystem;
Expand Down
2 changes: 2 additions & 0 deletions pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
cpio = fetch { file = "cpio"; sha256 = "sha256-SWkwvLaFyV44kLKL2nx720SvcL4ej/p2V/bX3uqAGO0="; };
tarball = fetch { file = "bootstrap-tools.cpio.bz2"; sha256 = "sha256-b65dXbIm6o6s6U8tAiGpR6SMfvfn/VFcZgTHBetJZis="; executable = false; };
}

, ...
}:

assert crossSystem == localSystem;
Expand Down
3 changes: 2 additions & 1 deletion pkgs/stdenv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{ # Args just for stdenvs' usage
lib
# Args to pass on to the pkgset builder, too
, localSystem, crossSystem, config, overlays, crossOverlays ? []
, localSystem, crossSystem, config, overlays, crossOverlays ? [], ...
} @ args:

let
Expand Down Expand Up @@ -56,6 +56,7 @@ in
powerpc-linux = /* stagesLinux */ stagesNative;
powerpc64-linux = stagesLinux;
powerpc64le-linux = stagesLinux;
sparc64-linux = stagesLinux;
x86_64-darwin = stagesDarwin;
aarch64-darwin = stagesDarwin;
x86_64-solaris = stagesNix;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/stdenv/freebsd/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib
, localSystem, crossSystem, config, overlays, crossOverlays ? []
, localSystem, crossSystem, config, overlays, crossOverlays ? [], ...
}:

assert crossSystem == localSystem;
Expand Down
3 changes: 1 addition & 2 deletions pkgs/stdenv/generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ let
../../build-support/setup-hooks/audit-tmpdir.sh
../../build-support/setup-hooks/move-systemd-user-units.sh
]
++ lib.optional hasCC cc
++ [
../../build-support/setup-hooks/multiple-outputs.sh
../../build-support/setup-hooks/move-sbin.sh
../../build-support/setup-hooks/move-lib64.sh
../../build-support/setup-hooks/set-source-date-epoch-to-latest.sh
../../build-support/setup-hooks/reproducible-builds.sh
# TODO use lib.optional instead
(if hasCC then cc else null)
];

defaultBuildInputs = extraBuildInputs;
Expand Down
21 changes: 21 additions & 0 deletions pkgs/stdenv/linux/bootstrap-files/powerpc64le.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
# Note: do not use Hydra as a source URL. Ask a member of the
# infrastructure team to mirror the job.
busybox = import <nix/fetchurl.nix> {
# from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.powerpc64le.dist
# from build: https://hydra.nixos.org/build/155848348
# TODO(pmc): ask infra to mirror this
# url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/busybox";
url = "https://nix-cache.piperswe.me/bootstrap/7znrqcmp15b93k3bz0yyczqi73dj713v-stdenv-bootstrap-tools-powerpc64le-unknown-linux-gnu/on-server/busybox";
sha256 = "sha256-nOJImyOtWg2WuXgu9SLKKHiVtmygAQxDutmec98XD9A=";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
# from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv7l.dist/latest
# from build: https://hydra.nixos.org/build/114203060
# TODO(pmc): ask infra to mirror this
# url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/bootstrap-tools.tar.xz";
url = "https://nix-cache.piperswe.me/bootstrap/7znrqcmp15b93k3bz0yyczqi73dj713v-stdenv-bootstrap-tools-powerpc64le-unknown-linux-gnu/on-server/bootstrap-tools.tar.xz";
sha256 = "sha256-QsTMZZF0GUFj+YQ5aF9YxEzyDSIhIYBBFVmpNYoDPdg=";
};
}
21 changes: 21 additions & 0 deletions pkgs/stdenv/linux/bootstrap-files/sparc64.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
# Note: do not use Hydra as a source URL. Ask a member of the
# infrastructure team to mirror the job.
busybox = import <nix/fetchurl.nix> {
# from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.powerpc64le.dist
# from build: https://hydra.nixos.org/build/155848348
# TODO(pmc): ask infra to mirror this
# url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/busybox";
url = "https://nix-cache.piperswe.me/bootstrap/wnjkv15kl6pn4jw4dqwqy7i364w6qqvr-stdenv-bootstrap-tools-sparc64-unknown-linux-gnu/on-server/busybox";
sha256 = "sha256-T9ak4aH9LJBtFlT1fJWaw7xaYmMZOBMstrXCwq5MK+M=";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
# from job: https://hydra.nixos.org/job/nixpkgs/cross-trunk/bootstrapTools.armv7l.dist/latest
# from build: https://hydra.nixos.org/build/114203060
# TODO(pmc): ask infra to mirror this
# url = "http://tarballs.nixos.org/stdenv-linux/powerpc64le/0eb0ddc4dbe3cd5415c6b6e657538eb809fc3778/bootstrap-tools.tar.xz";
url = "https://nix-cache.piperswe.me/bootstrap/wnjkv15kl6pn4jw4dqwqy7i364w6qqvr-stdenv-bootstrap-tools-sparc64-unknown-linux-gnu/on-server/bootstrap-tools.tar.xz";
sha256 = "sha256-2z5mNuGjS8lJVA/jEyu9lq/byIYUSAmCOM44p4YWnrg=";
};
}
Loading