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).
48 lines
1.2 KiB
Nix
48 lines
1.2 KiB
Nix
{ pkgs, compiler-nix-name, evalPackages }:
|
|
|
|
with pkgs;
|
|
with lib;
|
|
|
|
let
|
|
project = haskell-nix.cabalProject' {
|
|
inherit compiler-nix-name evalPackages;
|
|
src = evalPackages.haskell-nix.haskellLib.cleanGit { src = ../..; name = "setup-deps"; subDir = "test/setup-deps"; };
|
|
modules = [{
|
|
# Package has no exposed modules which causes
|
|
# haddock: No input file(s)
|
|
packages.bytestring-builder.doHaddock = false;
|
|
}];
|
|
};
|
|
|
|
meta = {
|
|
platforms = platforms.unix;
|
|
# We require lib ghc so this won't work with cross-compiling.
|
|
# Moreover, even building the plan doesn't seem to work in these circumstances.
|
|
disabled = stdenv.buildPlatform != stdenv.hostPlatform || stdenv.hostPlatform.isMusl;
|
|
};
|
|
in
|
|
|
|
recurseIntoAttrs ({
|
|
ifdInputs = {
|
|
plan-nix = addMetaAttrs meta project.plan-nix;
|
|
};
|
|
run = pkgs.stdenv.mkDerivation {
|
|
name = "setup-deps-test";
|
|
|
|
buildCommand = ''
|
|
exe="${project.getComponent "pkg:exe:pkg"}/bin/pkg"
|
|
|
|
printf "checking whether executable runs... " >& 2
|
|
$exe
|
|
|
|
touch $out
|
|
'';
|
|
|
|
inherit meta;
|
|
passthru = {
|
|
# Attributes used for debugging with nix repl
|
|
inherit project;
|
|
};
|
|
};
|
|
})
|