NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.59k stars 13.07k forks source link

Using a custom libc derivation #307600

Open theoparis opened 2 months ago

theoparis commented 2 months ago

Issue description

I have asked in several places but for some reason no one seems to have a proper solution to my problem. I want to use a custom libc with nixpkgs (for example, LLVM Libc, bionic or apple's libc built from upstream sources instead of prebuilt nixpkgs packages) and I cannot seem to find a way to override the libc easily by providing a derivation. All I could find is how to override it via a string such as libc = "musl" which doesn't help me here.

If this is not supported already, adding support for this could also make #296577 easier. Additionally, this could make porting libc++ or even nix to a new OS simpler.

If this is already supported I'd at least like for this be documented somewhere.

RossComputerGuy commented 2 months ago

Yeah, if being able to specify a custom libc was as simple as passing over a derivation then that could make the process just so much simpler.

theoparis commented 1 month ago

This might also allow cosmopolitan libc to be used with nixpkgs and/or LLVM in the future (once https://github.com/jart/cosmopolitan/issues/180 is solved).