I want to package a custom build of bionic libc (the nixpkgs derivation is prebuilt) but I’m not sure what the best way of overriding the libc package would be outside of nixpkgs. I can only seem to find a way to set it to glibc or musl, not a custom derivation.
Thanks.
1 Like
There’s not package overlay that allows you to just plug in your libc.
If you look into the file pkgs/top-level/stage.nix
you will find a definition for pkgsMusl
, which builds all packages with musl instead of glibc.
What you need to do is copy that and adapt it to your library.
In any case, I doubt it will be as straightforward as that, I bet you’ll find problems with a lot of packages because practically everyone on Earth assumes libc == glibc.
I have another use case which is building GitHub - managarm/mlibc: Portable C standard library and using it with a custom stdenv. I am not looking to replace NixOS’s glibc at all, just for cross compiling via flakes. pkgsMusl does not seem to help as it uses crossSystem, I need to be able to set something like libc = stdenv.mkDerivation { name = "mlibc"; }
.
I ended up making an issue for this: Using a custom libc derivation · Issue #307600 · NixOS/nixpkgs · GitHub. However I have still not solved the problem.