Skip to content

Cross Compiling Haskell to Windows #36200

@angerman

Description

@angerman

As some may already know, I'm working on cross compiling Haskell to Windows using nix.

I'll try to keep track of the issues I run into, and then add the relevant PRs as I manage to
clean them up.

Minor

  • mingw64 is too old for GHC. GHC requires mingw-w64 >= 5
  • cctools asserts targetPlatform.isDarwin, which fails.
  • ghc binary expressions assert stdenv.targetPlatform == stdenv.hostPlatform, which fails during validation.
  • The buildMK in the ghc expressions is wrong and needs to also include the relevant $flavour.mk
  • The generic builder uses hsc2hs from the nativeGhc, but should use $targetPrefix-hsc2hs.
  • haskellSetupDepends should come from the buildPackages package set as they are compiled and run by the native compiler.

Major

  • packageOverrides and buildPackages don't play nice together. Injecting a custom ghc via config doesn't work anymore, as buildPackages is fixed prior to the overrides being applied, and buildPackages doesn't see any added packages from the packageOverrides.

I might be missing some philosophical foundation with respect to nix here. Please bear with me and help me better understand.

/cc @Ericson2314

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: cross-compilationBuilding packages on a different platform than they will be used on6.topic: haskellGeneral-purpose, statically typed, purely functional programming language6.topic: windowsRunning, or buiding, packages on Windows

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions