third_party/nix: introduce toolchain bundle
This introduces a nix derivation that builds a musl amd64/aarch64
toolchain sysroot.
Change-Id: Iba082edb8fd1f2ab580020bb1c7339a76487f3c8
Reviewed-on: https://review.monogon.dev/c/monogon/+/4006
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/third_party/nix/pkgs/perl/default.nix b/third_party/nix/pkgs/perl/default.nix
new file mode 100644
index 0000000..c2677b5
--- /dev/null
+++ b/third_party/nix/pkgs/perl/default.nix
@@ -0,0 +1,24 @@
+{ pkgs }: with pkgs;
+if (!stdenv.hostPlatform.isStatic) then perl else
+perl.overrideAttrs (old: {
+ patches = old.patches ++ [
+ ./static_build.patch
+ ];
+
+ preConfigure = old.preConfigure + ''
+ cat >> config.over <<EOF
+ osvers="musllinux"
+ EOF
+ '';
+
+ configureFlags = old.configureFlags ++ [
+ "-Dotherlibdirs=.../../lib/perl5/${old.version}" # Tell perl to use a relative libdir
+ # 1. Why isn't this the default?
+ # 2. Apparently nobody uses this option, because it is missing the quotes inside the config_h.SH
+ # 3. Why should a variable called "procselfexe" be used with a different path than /proc/self/exe?
+ # 4. I really dislike perl. - fionera
+ "-Dprocselfexe=\"/proc/self/exe\""
+ ];
+
+ env.NIX_CFLAGS_COMPILE = (old.NIX_CFLAGS_COMPILE or "") + " -Wno-error=implicit-function-declaration";
+})