Skip to content

Commit

Permalink
WIP: trying to get cross-compilation working with iohk haskell.nix ht…
Browse files Browse the repository at this point in the history
  • Loading branch information
avh4 committed Mar 23, 2022
1 parent d796bec commit c98d471
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
16 changes: 12 additions & 4 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{ sources ? import ./nix/sources.nix { } }:
{ sources ? import ./nix/sources.nix { }, pkgs ? null }:

let
haskellNix = import sources.haskellNix { };
pkgs = import haskellNix.sources.nixpkgs-unstable haskellNix.nixpkgsArgs;
haskell-nix = if pkgs == null then
let
haskellNix = import sources.haskellNix { };
finalPkgs =
import haskellNix.sources.nixpkgs-unstable haskellNix.nixpkgsArgs;
in finalPkgs.haskell-nix

pkgSet = pkgs.haskell-nix.mkCabalProjectPkgSet {
else
let haskellNix = import sources.haskellNix { inherit pkgs; };
in haskellNix.pkgs.haskell-nix;

pkgSet = haskell-nix.mkCabalProjectPkgSet {
plan-pkgs = import ./pkgs.nix;
pkg-def-extras = [ ];
modules = [ ];
Expand Down
27 changes: 27 additions & 0 deletions release.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ sources ? import ./nix/sources.nix { } }:
let
project = import ./default.nix;
pkgsNative = import sources.nixpkgs { };

pkgsLinux = pkgsNative;
pkgsMac = import sources.nixpkgs {
crossSystem = pkgsNative.lib.systems.examples.x86_64-darwin;
};
pkgsWin = import sources.nixpkgs {
crossSystem = pkgsNative.lib.systems.examples.mingw32;
};

pkgsTest = import sources.nixpkgs {
crossSystem = pkgsNative.lib.systems.examples.aarch64-multiplatform;
};

linux = project { pkgs = pkgsLinux; };
mac = project { pkgs = pkgsMac; };
win = project { pkgs = pkgsWin; };
test = project { pkgs = pkgsTest; };
in {
elm-format-linux = linux.elm-format.components.exes.elm-format;
#elm-format-mac = mac.elm-format.components.exes.elm-format;
#elm-format-win = win.elm-format.components.exes.elm-format;
elm-format-test = test.elm-format.components.exes.elm-format;
}
12 changes: 8 additions & 4 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{ sources ? import nix/sources.nix, pkgs ? import sources.nixpkgs { } }:
let
project = import ./default.nix { sources = sources; };
niv = import sources.niv { };
haskellNix = import sources.haskellNix { };
in project.shellFor {
# packages = p: [ ];

tools = { cabal = "latest"; };
#exactDeps = true;

haskellPackages = pkgs.haskell.packages.ghc901;
in haskellPackages.shellFor {
packages = p: [ ];
buildInputs = with pkgs; [
# Tools required to build elm-format
cabal-install
git
python3
jq
Expand All @@ -17,5 +20,6 @@ in haskellPackages.shellFor {
cabal2nix
niv.niv
nixfmt
haskellNix.pkgs.haskell-nix.nix-tools.ghc901
];
}

0 comments on commit c98d471

Please sign in to comment.