Skip to content

Instantly share code, notes, and snippets.

@RossComputerGuy
Last active April 18, 2025 01:27
Show Gist options
  • Save RossComputerGuy/0b17862ad2f7b518d1e6d449ad39549f to your computer and use it in GitHub Desktop.
Save RossComputerGuy/0b17862ad2f7b518d1e6d449ad39549f to your computer and use it in GitHub Desktop.
Test nixpkgs stdenvs
{
pkgs ? import ./. { },
}:
let
inherit (pkgs) lib;
stdenvs =
lib.genAttrs
[
"gcc9Stdenv"
"gcc10Stdenv"
"gcc11Stdenv"
"gcc12Stdenv"
"gcc13Stdenv"
"gcc14Stdenv"
]
(
name:
let
stdenv = pkgs."${name}";
targetPlatform = {
gcc = {
arch = "armv8-a";
tune = "neoverse-n1";
};
};
in
pkgs.overrideCC
(stdenv.override {
hostPlatform = stdenv.hostPlatform // targetPlatform;
targetPlatform = stdenv.targetPlatform // targetPlatform;
})
(
stdenv.cc.override {
stdenvNoCC = stdenv.cc.stdenv.override {
hostPlatform = stdenv.cc.stdenv.hostPlatform // targetPlatform;
targetPlatform = stdenv.cc.stdenv.targetPlatform // targetPlatform;
};
bintools = stdenv.cc.bintools.override {
stdenvNoCC = stdenv.cc.bintools.stdenv.override {
hostPlatform = stdenv.cc.bintools.stdenv.hostPlatform // targetPlatform;
targetPlatform = stdenv.cc.bintools.stdenv.targetPlatform // targetPlatform;
};
};
cc = stdenv.cc.cc.override {
stdenv = stdenv.cc.cc.stdenv.override {
hostPlatform = stdenv.cc.cc.stdenv.hostPlatform // targetPlatform;
targetPlatform = stdenv.cc.cc.stdenv.targetPlatform // targetPlatform;
};
libcCross = stdenv.cc.libc;
};
}
)
);
in
lib.mapAttrs (
_: stdenv:
let
llvmPackages = pkgs.llvmPackages_20.override {
inherit stdenv;
};
in
pkgs.hello.override {
stdenv = pkgs.overrideCC stdenv llvmPackages.clangUseLLVM;
}
) stdenvs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment