Nix Cross Compiling | 577 Members | |
| 129 Servers |
| Sender | Message | Time |
|---|---|---|
| 30 Dec 2024 | ||
| (btw, still happy to test anything on Darwin you need testing, though I'm sure you could also get an account on the community builder) | 16:36:59 | |
| quick question: what on earth is happening here? | 17:27:37 | |
| nix-repl> builtins.currentSystem "x86_64-linux" nix-repl> pkgsCross.x86_64-freebsd.pkgsTargetTarget { __raw = true; recurseForDerivations = false; stdenv = { ... }; } nix-repl> pkgsCross.x86_64-freebsd.pkgsTargetTarget.stdenv { cc = «derivation /nix/store/nhj8bgij919zkfb9f5z3h11gh3gc3r1f-x86_64-unknown-freebsd-clang-wrapper-19.1.6.drv»; } | 17:27:38 | |
| hm, what's weird there? | 17:29:03 | |
oh, pkgsTargetTarget being almost empty? | 17:29:09 | |
| yeah | 17:29:20 | |
does pkgsCross.x86_64-freebsd.callPackage ({ pkgsTargetTarget }: pkgsTargetTarget) behave the same I wonder | 17:30:00 | |
| yes | 17:30:29 | |
| I found this because I was trying to use pkgsTargetTarget in a derivation and it blew up when I tried to do feature detection on it | 17:30:54 | |
| this seems to be a known quantity in nixpkgs - every usage of pkgsTargetTarget I've seen seems to not assume it's populated... but why??? | 17:32:25 | |
probably because pkgsTargetTarget is weird :) | 17:33:14 | |
| but I defer to Artturin's wisdom here | 17:33:58 | |
In reply to @rhelmot:matrix.orgyeah from what i understand you can't pkgsTargetTarget from a cross set, it just isn't supported/implemented. what you're seeing seems to be just this "fake" set after bootstrap stages used for a compiler hack, defined here: https://github.com/NixOS/nixpkgs/blob/cd0883f61c95f321983c0d18f53040b8c76fc263/pkgs/stdenv/booter.nix#L142-L163 | 18:25:55 | |
| 🥲 | 18:26:29 | |
In reply to @lily:lily.flowers(idk more precise details of what that hack is for other than the comment right above it) | 18:26:46 | |
| nixpkgs is a well-documented piece of software that is normal and fun to reverse engineer | 18:27:19 | |
| just curious, what is your motivation for using pkgsTargetTarget? | 18:28:21 | |
| was trying to obtain the c++ stdlib and unwind lib implementations for the rustc wrapper to link against | 18:30:51 | |
| 31 Dec 2024 | ||
| Could someone merge this fix for cross builds of python packages using maturin: https://github.com/NixOS/nixpkgs/pull/365540 | 07:00:28 | |
| 08:03:50 | ||
| Hi, Happy New Year! Using pkgs.pkgsCross, I can compile a package from nixpkgs for another platform. For example:
I have a local repository with a package. For example, let’s say it’s a simple hello world. default.nix:
However, I can't build it the same way:
I can change pkgs.callPackage in default.nix to pkgs.pkgsCross.aarch64-multiplatform.callPackage. Then the package builds:
How can I properly test cross-compilation without adding the repository via a channel or flake? | 09:05:36 | |
| * Hi, Happy New Year! Using
I have a local repository with a package. For example, let’s say it’s a simple hello world. default.nix:
However, I can't build it the same way:
I can change
How can I properly test cross-compilation without adding the repository via a channel or flake? | 09:06:44 | |
You can do something like nix-build --expr "(import <nixpkgs> {}).pkgsCross.aarch64-multiplatform.callPackage ./pkgs/myhello {}" | 09:06:47 | |
| Thank you very much! But what is the difference between a local file and nixpkgs? How does nix know that a package with a prefix should be cross-compiled? I looked in the nixpkgs repository, but I didn't understand how pkgsCross works, since the packages are declared in one place. Apparently, it's not just the package name, but something generated automatically. | 09:14:43 | |
pkgsCross is basically another instance of nixpkgs | 09:15:32 | |
| Created with the right configuration to be cross-compiled | 09:15:44 | |
| The difference between a local file and nixpkgs is that pkgsCross knows nothing about your local file | 09:16:08 | |
| And neither does nixpkgs for that matter | 09:16:14 | |
| Nix itself knows absolutely nothing about any of it | 09:17:22 | |
| Nixpkgs is just one big attrset that it pulls from without understanding its structure in any real way | 09:17:41 | |