Skip to content

Instantly share code, notes, and snippets.

@reckenrode
Created June 28, 2023 22:51
Show Gist options
  • Save reckenrode/79685b9366d3b165be94d971ab1e34fb to your computer and use it in GitHub Desktop.
Save reckenrode/79685b9366d3b165be94d971ab1e34fb to your computer and use it in GitHub Desktop.
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
inputs.nixpkgs11.url = "github:reckenrode/nixpkgs?ref=darwin-stdenv-rework";
inputs.nixpkgs16.url = "github:reckenrode/nixpkgs?ref=darwin-llvm16-update";
outputs = { self, nixpkgs11, nixpkgs16, nixpkgs }:
let
inherit (nixpkgs) lib;
mkTest = packages: packages.aarch64-darwin.stdenvNoCC.mkDerivation {
name = "stdenv_build-test";
dontUnpack = true;
dontBuild = true;
installPhase = lib.concatMapStrings (system:
let
pkgs = packages.${system};
in ''
outdir=$out/${system}
mkdir -p "$outdir"
ln -s ${pkgs.stdenv} "$outdir/stdenv"
''
+ ''
ln -s ${pkgs.e2fsprogs} "$outdir/e2fsprogs"
ln -s ${pkgs.boost} "$outdir/boost"
''
# + ''
# ln -s ${pkgs.ghc} "$outdir/ghc"
# ln -s ${pkgs.rustc} "$outdir/rustc"
# ln -s ${pkgs.rav1e} "$outdir/rav1e"
# ''
+ (lib.concatMapStrings (ver: ''
ln -s ${pkgs."boost${ver}"} "$outdir/boost${ver}"
'') [ "175" "177" "178" "179" "180" "181" "182" ])
# + (lib.concatMapStrings (ver: ''
# ln -s ${pkgs.haskell.compiler."ghc${ver}"} "$outdir/ghc${ver}"
# '') (lib.optional (system == "x86_64-darwin") "88" ++ [ "810" "90" "924" "925" "926" "927" "928" "942" "943" "944" "945" "961" "962" ]))
) [ "aarch64-darwin" "x86_64-darwin" ];
};
in
{
packages.aarch64-darwin.clang11 = mkTest nixpkgs11.legacyPackages;
packages.aarch64-darwin.clang16 = mkTest nixpkgs16.legacyPackages;
packages.aarch64-darwin.default = nixpkgs.legacyPackages.aarch64-darwin.stdenvNoCC.mkDerivation {
name = "build_test-output";
dontUnpack = true;
dontConfigure = true;
buildCommand = ''
mkdir -p "$out"
ln -s ${self.outputs.packages.aarch64-darwin.clang11} "$out/clang11"
ln -s ${self.outputs.packages.aarch64-darwin.clang16} "$out/clang16"
'';
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment