How do I cross compile my own package (rather than something in nix-pkgs)

First you need to separate your nix file in two files, one that does callPackage on the other:
default.nix:

{ pkgs ? import <nixpkgs> {} }:
   pkgs.callPackage ./myapp.nix {}

and ./myapp.nix:

{ stdenv, SDL2 }: mkDerivation { ... }

Then check that it still builds. Then to cross compile, replace usage of pkgs.callPackage by pkgs.pkgsCross.mingw64.callPackage.

Good luck :slight_smile:

5 Likes