25 Aug 2024 |
themojken | Oh, that won't work, because it needs to access the store to evaluate the derivations... | 09:18:16 |
themojken | Huh, it's undocumented, but nix-build actually takes a --store argument that does almost exactly what I want | 09:44:39 |
themojken | Like, it put 490 things in there when I really only wanted three, only 39 if I filter for the platform suffix, 23 if I filter out directories. The extras are mostly alternative outputs of packages, such as -dev ones, as well as libraries I have built but then statically linked. Using the store, it might be worth going over to dynamic links after all, though. | 09:50:42 |
| Lukas Voreck joined the room. | 13:30:52 |
Lukas Voreck | Hey there. im trying to cross compile a rust project from nixos to windows. The relevant part of my flake looks like this
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
windows-pkgs = pkgs.pkgsCross.mingwW64;
in
{
windows-cross = windows-pkgs.rustPlatform.buildRustPackage rec {
pname = "rustyjeb";
version = "0.1.0";
buildInputs = [ ];
cargoLock.lockFile = ./Cargo.lock;
src = windows-pkgs.lib.cleanSource ./.;
};
};
};
}
But building it gives me this error
> error: Error calling dlltool 'x86_64-w64-mingw32-dlltool': No such file or directory (os error 2)
>
> error: could not compile `std` (lib) due to 1 previous error
> Build completed unsuccessfully in 0:00:49
For full logs, run 'nix log /nix/store/l9fk14vfyk2dbmivg5c75j7y7dszl4hd-x86_64-w64-mingw32-rustc-1.80.1.drv'.
error: 1 dependencies of derivation '/nix/store/5d2920ccqcjymhrlxv9sa4d8wrv0wk6n-x86_64-w64-mingw32-rustc-wrapper-1.80.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/zf42b74j4caj4jlx7qrjr2h1s7vnhb05-rustyjeb-x86_64-w64-mingw32-0.1.0.drv' failed to build
| 13:33:22 |
K900 | mingw isn't well supported | 13:46:10 |
K900 | Maybe look into something like https://gitlab.com/K900/rust-cross-windows | 13:46:17 |
Alyssa Ross | The LLVM bintools should have dlltool | 13:48:44 |
Alyssa Ross | Put buildPackages.llvmPackages.bintools in nativeBuildInputs ?
| 13:49:31 |
Alyssa Ross | hmm, although I think so should the default stdenv... | 13:50:50 |
Alyssa Ross | I guess we just need bintools for the target in rustc? | 14:00:53 |
Alyssa Ross | PR incoming :) | 14:07:08 |
Lukas Voreck | In reply to @qyliss:fairydust.space
Put buildPackages.llvmPackages.bintools in nativeBuildInputs ?
with that i get this error > mv: cannot stat 'expand-response-params': No such file or directory | 14:10:20 |
Alyssa Ross | Yeah, I'd misread the error when I said that. It needs to go in rustc's depsBuildTarget. | 14:10:56 |
Lukas Voreck | Err... how do i do that? | 14:13:31 |
Alyssa Ross | In reply to @qyliss:fairydust.space PR incoming :) ^ | 14:13:54 |
Alyssa Ross | https://github.com/NixOS/nixpkgs/pull/337251 | 14:16:13 |
Lukas Voreck | Already aproved lol | 14:37:46 |
Alyssa Ross | With that change I can build pkgsCross.mingwW64.fd
| 14:45:58 |
Lukas Voreck | can i use your branch in my flake before it's merged? | 14:52:53 |
Alyssa Ross | you can | 14:54:10 |
Alyssa Ross | (I don't know how to, if that's what your asking, but somebody else here probably dose) | 14:54:44 |
Alyssa Ross | * | 14:54:53 |
Alyssa Ross | * | 14:55:07 |
Lukas Voreck | I assume nixpkgs.url = "github:alyssais/nixpkgs/tree/rustc-mingw"; | 14:55:19 |
Lukas Voreck | Yup, it works now! | 15:04:14 |
Alyssa Ross | Merged | 15:25:09 |
Lukas Voreck | how long does it take until it lands in unstable? | 15:30:08 |
Alyssa Ross | few days | 15:30:21 |
Lukas Voreck | alright. thank you! | 15:32:11 |