Build with LLVM and musl

This commit is contained in:
Mikael Voss 2024-10-13 11:24:31 +02:00
parent 3f8acc3a4b
commit 4e0045a4da
No known key found for this signature in database
5 changed files with 49 additions and 17 deletions

View file

@ -95,7 +95,7 @@
overlays = load ./overlay "overlay"; overlays = load ./overlay "overlay";
legacyPackages = eachSystem (system: platform: legacyPackages = eachSystem (system: platform:
import nixpkgs { import nixpkgs {
localSystem = builtins.currentSystem or platform; localSystem = builtins.currentSystem or system;
crossSystem = platform; crossSystem = platform;
overlays = [ self.overlays.default ]; overlays = [ self.overlays.default ];
config.allowUnsupportedSystem = true; config.allowUnsupportedSystem = true;
@ -120,6 +120,13 @@
targetHost = config.networking.fqdnOrHostName; targetHost = config.networking.fqdnOrHostName;
targetUser = null; 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,22 @@ let inherit (nixpkgs) lib;
in lib.mapAttrs (system: platform: lib.systems.elaborate platform) { in lib.mapAttrs (system: platform: lib.systems.elaborate platform) {
"x86_64-linux" = { "x86_64-linux" = {
system = "x86_64-linux"; system = "x86_64-linux";
config = "x86_64-unknown-linux-musl";
useLLVM = true;
linker = "lld";
}; };
"aarch64-linux" = { "aarch64-linux" = {
system = "aarch64-linux"; system = "aarch64-linux";
config = "aarch64-unknown-linux-musl";
useLLVM = true;
linker = "lld";
}; };
"riscv64-linux" = { "riscv64-linux" = {
system = "riscv64-linux"; system = "riscv64-linux";
config = "riscv64-unknown-linux-musl";
useLLVM = true;
linker = "lld";
}; };
} }

View file

@ -11,6 +11,7 @@
iosched iosched
kernel kernel
locale-en_EU locale-en_EU
musl
network network
nix nix
openssh 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

@ -3,6 +3,14 @@ let
inherit (nixpkgs.lib) optionalAttrs toList; inherit (nixpkgs.lib) optionalAttrs toList;
inherit (prev.stdenv) hostPlatform; inherit (prev.stdenv) hostPlatform;
in { in {
netbsd = prev.netbsd.overrideScope (final: prev: {
compatIfNeeded = [ final.compat ];
compat = prev.compat.overrideAttrs (prevAttrs: {
makeFlags = prevAttrs.makeFlags ++ [ "OBJCOPY=:" ];
});
});
numactl = prev.numactl.overrideAttrs (prevAttrs: { numactl = prev.numactl.overrideAttrs (prevAttrs: {
patches = prevAttrs.patches or [ ] ++ [ patches = prevAttrs.patches or [ ] ++ [
(final.fetchpatch { (final.fetchpatch {
@ -12,26 +20,18 @@ in {
]; ];
}); });
python3 = prev.python3.overrideAttrs (prevAttrs: {
postFixup = prevAttrs.postFixup + ''
pushd "$out/lib/${prevAttrs.passthru.libPrefix}"
test -e "$sysconfigdataName" || ln -s _sysconfigdata__linux_.py "$sysconfigdataName.py"
popd
'';
});
redis = prev.redis.overrideAttrs ({ redis = prev.redis.overrideAttrs ({
doCheck = false; doCheck = false;
}); });
python312 = prev.python312.override {
packageOverrides = final: prev: {
pywebview = prev.pywebview.overrideAttrs ({
doCheck = false;
doInstallCheck = false;
});
} // optionalAttrs hostPlatform.isRiscV64 {
psutil = prev.psutil.overrideAttrs (prevAttrs: {
disabledTests = prevAttrs.disabledTests or [ ] ++ [
"net_if_addrs"
"net_if_stats"
];
});
};
};
sioyek = prev.sioyek.overrideAttrs (prevAttrs: { sioyek = prev.sioyek.overrideAttrs (prevAttrs: {
env = prevAttrs.env or { } // { env = prevAttrs.env or { } // {
NIX_CFLAGS_COMPILE = toList prevAttrs.env.NIX_CFLAGS_COMPILE or [ ] NIX_CFLAGS_COMPILE = toList prevAttrs.env.NIX_CFLAGS_COMPILE or [ ]
@ -39,6 +39,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: { zeromq = prev.zeromq.overrideAttrs (prevAttrs: {
postPatch = prevAttrs.postPatch or "" + '' postPatch = prevAttrs.postPatch or "" + ''
substituteInPlace CMakeLists.txt \ substituteInPlace CMakeLists.txt \