Hello,
I am attempting to build a thing that requires me to build for a Windows target, and I’m very much at a loss as to how to do this.
I’ve seen some questions floating around here, but none of them have been very useful to me (read: I didn’t understand what to do / couldn’t get it to work the way I wanted)
Ideally, what I want is a flake.nix that provides me with Cargo configured in a way that when I run cargo build
(or maybe cargo build --target x86_64-pc-windows-gnu
or whatever), it builds my project for Windows.
The first thing I tried was just adapting the shell.nix mentioned on the wiki to a flake.nix - without much success; I get derivation build errors that make it look like it’s somehow mixing up the build / target architecture.
I have found a few things that use the Nix flake build system (flakebox, naersk), but I didn’t go much further with these for the following reason: there may be other ppl working on the project, and I don’t want to force them to deal with flakes, because I can barely deal with them myself; I only use them because of the nice direnv integration, and the per-project package management and version-locking that this allows.
So can anyone tell me how to cross-compile Rust for Windows on NixOS? Or point out the part where I’m doing things fundamentally wrong that is making it difficult to do things correctly?