Skip to content

Commit a450a6b

Browse files
committed
rpi cross-compilation wip
1 parent 3ffcb77 commit a450a6b

File tree

7 files changed

+34
-20
lines changed

7 files changed

+34
-20
lines changed

nix/misc.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
let
22
repo = builtins.toString ./..;
33
in
4-
with (import ./project.nix); rec {
4+
with (import ./project.nix {}); rec {
55
pkgBin = pkg: "${pkgs.${pkg}}/bin/${pkg}";
66
nix-bundle = pkgs.nix-bundle.overrideAttrs (attrs: {
77
buildInputs =

nix/project.nix

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let
1+
{crossSystem ? null}: let
22
# Read in the Niv sources
33
sources = import ./sources.nix {};
44
# If ./nix/sources.nix file is not found run:
@@ -21,18 +21,33 @@ let
2121
# the haskell.nix functionality itself as an overlay.
2222
haskellNix.nixpkgsArgs;
2323

24+
# Apply crossSystem if needed
25+
next =
26+
if crossSystem == null
27+
then pkgs
28+
else
29+
import haskellNix.sources.nixpkgs-unstable (
30+
haskellNix.nixpkgsArgs
31+
// {
32+
crossSystem = pkgs.lib.systems.examples."${crossSystem}";
33+
}
34+
);
35+
2436
# Nixpkgs overlay to fix haskell tdlib bindings.
2537
pkgs = prev.extend (
26-
next: prev: {tdjson = prev.tdlib;}
38+
_: x: {tdjson = x.tdlib;}
2739
);
2840
in
29-
pkgs.haskell-nix.project {
41+
next.haskell-nix.project {
3042
# 'cleanGit' cleans a source directory based on the files known by git
3143
src = pkgs.haskell-nix.haskellLib.cleanGit {
3244
name = "functora";
3345
src = ./..;
3446
};
3547
# Specify the GHC version to use.
36-
compiler-nix-name = "ghc948"; # Not required for `stack.yaml` based projects.
48+
#
49+
# NOTE : Fallback from 948 to 928 for aarch64 cross support.
50+
#
51+
compiler-nix-name = "ghc928"; # Not required for `stack.yaml` based projects.
3752
projectFileName = "cabal.project";
3853
}

nix/shell.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
with (import ./project.nix); let
1+
with (import ./project.nix {}); let
22
misc = import ./misc.nix;
33
newpkgs = import ./newpkgs.nix;
44
in

nix/tools.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
with (import ./project.nix);
1+
with (import ./project.nix {});
22
with pkgs; let
33
newpkgs = import ./newpkgs.nix;
44
repoDir = builtins.toString ./..;

prv

Submodule prv updated from 575e4f6 to 177320b

pub/dazzle/nix/tools.nix

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
with (import ./../../../nix/project.nix);
2-
with pkgs;
3-
let pkgDir = builtins.toString ./..;
4-
ghcidDazzleMain = writeShellScriptBin "ghcid-dazzle-main" ''
5-
(cd ${pkgDir} && ${ghcid}/bin/ghcid --command="${hpack}/bin/hpack ${pkgDir} && cabal new-repl dazzle-exe --disable-optimization --repl-options=-fobject-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-j -fghcid")
6-
'';
7-
ghcidDazzleTest = writeShellScriptBin "ghcid-dazzle-test" ''
8-
(cd ${pkgDir} && ${ghcid}/bin/ghcid --test=":main --fail-fast --color -f failed-examples" --command="${hpack}/bin/hpack ${pkgDir} && cabal new-repl dazzle-test --disable-optimization --repl-options=-fobject-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-j -fghcid")
9-
'';
10-
in
11-
[
1+
with (import ./../../../nix/project.nix {});
2+
with pkgs; let
3+
pkgDir = builtins.toString ./..;
4+
ghcidDazzleMain = writeShellScriptBin "ghcid-dazzle-main" ''
5+
(cd ${pkgDir} && ${ghcid}/bin/ghcid --command="${hpack}/bin/hpack ${pkgDir} && cabal new-repl dazzle-exe --disable-optimization --repl-options=-fobject-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-j -fghcid")
6+
'';
7+
ghcidDazzleTest = writeShellScriptBin "ghcid-dazzle-test" ''
8+
(cd ${pkgDir} && ${ghcid}/bin/ghcid --test=":main --fail-fast --color -f failed-examples" --command="${hpack}/bin/hpack ${pkgDir} && cabal new-repl dazzle-test --disable-optimization --repl-options=-fobject-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-j -fghcid")
9+
'';
10+
in [
1211
ghcidDazzleMain
1312
ghcidDazzleTest
1413
]

pub/functora-hakyll/nix/tools.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
with (import ./../../../nix/project.nix);
1+
with (import ./../../../nix/project.nix {});
22
with pkgs; let
33
cabal = "${pkgs.cabal-install}/bin/cabal";
44
pkgDir = builtins.toString ./..;

0 commit comments

Comments
 (0)