summary refs log tree commit diff
path: root/profiles/stdenv.nix
blob: 93d5918c3dd574850b48f2c48d7d4876abd3b793 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
  pkgs,
  lib,
  config,
  inputs,
  ...
}: {
  nix.binaryCaches = [
    "https://cache.nixos.org/"
    "https://cache.allvm.org/"
  ];

  nix.binaryCachePublicKeys = [
    "gravity.cs.illinois.edu-1:yymmNS/WMf0iTj2NnD0nrVV8cBOXM9ivAkEdO1Lro3U="
  ];

  overlays = [
    (final: prev: {
      nativeStdenv =
        prev.stdenvAdapters.withCFlags ["-O3" "-pipe" "-march=native"]
        (prev.overrideCC prev.llvmPackages_latest.stdenv
          (prev.wrapCCWith rec {
            cc = prev.llvmPackages_latest.clang-unwrapped;
            bintools = final.wrapBintoolsWith {
              coreutils = final.uutils-coreutils;
              libc = final.musl;
              bintools =
                final.binutils-unwrapped.overrideAttrs
                (old: {
                  postInstall = ''
                    ln -sf ${final.mold}/bin/mold $out/bin/ld
                  '';
                });
            };
          }));
    })
  ];
}