mirror of
https://github.com/simplex-chat/haskell.nix.git
synced 2026-06-03 09:17:32 +00:00
a443611ecf
This adds a way to specify the `evalSystem` or `evalPackages` explicitly when calling the `project` functions. Currently if we want to make a `flake` that supports multiple systems we have few options: * Require builders for all the supported systems (even just for `nix flake show`). * Pass `--impure` so that haskell.nix can see `builtins.currentSystem` to set up `pkgs.evalPackages` to use that. Unfortunately this prevents nix from caching some of the work it does and often results in it recalculating for each supported system when it would otherwise be cached and take no time at all. * Add an overlay to replace `evalPackages`. This works, but it is not straight forward. * Materialize the nix files for the project. This change allows `evalSystem = "x86_64-linux";` to be passed telling `haskell.nix` to run `cabal` and `nix-tools` on that system. The user will have to have a builder for that system, but does not need to have builders for the others (unless building outputs for them).
36 lines
886 B
Nix
36 lines
886 B
Nix
{ stdenv, lib, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
project = cabalProject' {
|
|
inherit compiler-nix-name evalPackages;
|
|
src = testSrc "buildable";
|
|
modules = [ { packages.buildable-test.flags.exclude-broken = true; } ];
|
|
};
|
|
packages = project.hsPkgs;
|
|
|
|
in recurseIntoAttrs {
|
|
ifdInputs = {
|
|
inherit (project) plan-nix;
|
|
};
|
|
run = stdenv.mkDerivation {
|
|
name = "buildable-test";
|
|
|
|
buildCommand =
|
|
(concatStrings (mapAttrsToList (name: value: ''
|
|
printf "checking whether executable runs... " >& 2
|
|
cat ${haskellLib.check value}/test-stdout
|
|
'') packages.buildable-test.components.exes)) + ''
|
|
touch $out
|
|
'';
|
|
|
|
meta.platforms = platforms.all;
|
|
|
|
passthru = {
|
|
# Attributes used for debugging with nix repl
|
|
inherit project packages;
|
|
};
|
|
};
|
|
}
|