5 ms·
Oh wow, I see it grew a lot since last time I checked. I got interested in the cross compile section. I normally work on Mac and whenever I need to create a do
by takeda 5y ago
Oh wow, I see it grew a lot since last time I checked.
I got interested in the cross compile section. I normally work on Mac and whenever I need to create a docker container I need to generate binaries for x86_64 linux.
I typically did it by creating another nixpkgs: instance like:
linux_pkgs = import <nixpkgs> { system = "x86_64-linux"; };
This doesn't exactly do cross compilation and it actually requires linux builder to work (I have one running in docker). There's also option to specify cross compiling, there, but from my experience requires rebuilding pretty much everything from scratch :/
Using pkgCross seems appealing, but I can't find a linux x86_64 target there. The closest I can find is musl64 (which is great, but can't get everything to work with it).
Is it under perhaps another name that I don't recognize, and if it isn't, would be possible to add it, it would greatly help creating docker images on mac.
- samueldr 5y agoFor non-musl (so GNU libc), it's the awkwardly named gnu64. To test with the classic test package "hello": $ nix-build '<nixpkgs>' -A pkgsCross.gnu64.hello Note that since this is cross-compiled, and not native compilation, you will have to build a lot more. All "pkgsCross" systems are found in https://github.com/NixOS/nixpkgs/blob/master/lib/systems/examples.nix https://github.com/NixOS/nixpkgs/blob/master/lib/systems/exa...
- takeda 5y agoGreat! Thank you for that :)
- domenkozar 5y agoI realize that the current naming is confusing, so while writing a tutorial I opened https://github.com/NixOS/nixpkgs/issues/126949 https://github.com/NixOS/nixpkgs/issues/126949 that hopefully gets us to a naming scheme that's more consistent with the triplets in cross compilation world. As for the binaries, you need to compile them once and then you can use http://cachix.org/ http://cachix.org/ for free to cache them.