Build with LLVM and musl

This commit is contained in:
Mikael Voss 2024-10-13 11:24:31 +02:00
parent 9b1a223c71
commit 52a8461d51
No known key found for this signature in database
5 changed files with 55 additions and 10 deletions

View file

@ -95,7 +95,7 @@
overlays = load ./overlay "overlay";
legacyPackages = eachSystem (system: platform:
import nixpkgs {
localSystem = builtins.currentSystem or platform;
localSystem = builtins.currentSystem or system;
crossSystem = platform;
overlays = [ self.overlays.default ];
config.allowUnsupportedSystem = true;
@ -120,6 +120,13 @@
targetHost = config.networking.fqdnOrHostName;
targetUser = null;
};
nixpkgs = let
platform = self.lib.platforms.x86_64-linux;
in {
buildPlatform = builtins.currentSystem or platform.system;
hostPlatform = platform;
};
};
};

View file

@ -4,13 +4,25 @@ let inherit (nixpkgs) lib;
in lib.mapAttrs (system: platform: lib.systems.elaborate platform) {
"x86_64-linux" = {
system = "x86_64-linux";
config = "x86_64-unknown-linux-musl";
useLLVM = true;
linker = "lld";
gcc.arch = "x86-64-v3";
};
"aarch64-linux" = {
system = "aarch64-linux";
config = "aarch64-unknown-linux-musl";
useLLVM = true;
linker = "lld";
gcc.arch = "armv8-a";
};
"riscv64-linux" = {
system = "riscv64-linux";
config = "riscv64-unknown-linux-musl";
useLLVM = true;
linker = "lld";
gcc.arch = "rv64imacfd";
};
}

View file

@ -11,6 +11,7 @@
iosched
kernel
locale-en_EU
musl
network
nix
openssh

7
nixos/module/musl.nix Normal file
View file

@ -0,0 +1,7 @@
{ ...}: { modulesPath, ... }: {
disabledModules = [
(modulesPath + "/config/ldso.nix")
(modulesPath + "/programs/nix-ld.nix")
(modulesPath + "/config/stub-ld.nix")
];
}

View file

@ -4,6 +4,14 @@ let
inherit (lib) toList;
inherit (prev.stdenv) hostPlatform;
in {
netbsd = prev.netbsd.overrideScope (final: prev: {
compatIfNeeded = [ final.compat ];
compat = prev.compat.overrideAttrs (prevAttrs: {
makeFlags = prevAttrs.makeFlags ++ [ "OBJCOPY=:" ];
});
});
numactl = prev.numactl.overrideAttrs (prevAttrs: {
patches = prevAttrs.patches or [ ] ++ [
(final.fetchpatch {
@ -13,19 +21,21 @@ in {
];
});
python3 = prev.python3.overrideAttrs (prevAttrs: {
postFixup = let
lib = "$out/lib/${prevAttrs.passthru.libPrefix}";
prefix = "_sysconfigdata__linux_";
suffix = "${hostPlatform.parsed.cpu.name}-${hostPlatform.libc}";
in prevAttrs.postFixup + ''
test -e '${lib}/${prefix}${suffix}.py' \
|| ln -s '${lib}/${prefix}'{,'${suffix}'}.py
'';
});
redis = prev.redis.overrideAttrs {
doCheck = false;
};
python312 = prev.python312.override {
packageOverrides = final: prev: {
pywebview = prev.pywebview.overrideAttrs ({
doCheck = false;
doInstallCheck = false;
});
};
};
sioyek = prev.sioyek.overrideAttrs (prevAttrs: {
env = prevAttrs.env or { } // {
NIX_CFLAGS_COMPILE = toList prevAttrs.env.NIX_CFLAGS_COMPILE or [ ]
@ -33,6 +43,14 @@ in {
};
});
time = prev.time.overrideAttrs (prevAttrs: {
env = prevAttrs.env or { } // {
CFLAGS = toList prevAttrs.env.CFLAGS or [ ] ++ [
"-Wno-error=implicit-function-declaration"
] |> toString;
};
});
zeromq = prev.zeromq.overrideAttrs (prevAttrs: {
postPatch = prevAttrs.postPatch or "" + ''
substituteInPlace CMakeLists.txt \