Skip to content

Commit

Permalink
Refactor wiring in default.nix and nix/default.nix
Browse files Browse the repository at this point in the history
Move sources, haskellNix and haskellNixOverlays to the top level
default.nix which allows for passing the haskellNixOverlays from
flake.nix and thus simply importing 'default.nix' directly.

The reason why this is important is that haskell.nix needs to use
a different overlay for when using in flake evaluationor normal one.
This is due to the fact that when evaluating flakes
builtins.currentSystem is not available.
  • Loading branch information
gilligan committed Jun 8, 2021
1 parent e7eb00a commit 454be4e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
11 changes: 9 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
{ system ? builtins.currentSystem
, crossSystem ? null
, config ? { allowUnfreePredicate = (import ./nix/lib/unfree.nix).unfreePredicate; }
# Overrides for niv
, sourcesOverride ? { }
, packages ? import ./nix { inherit system crossSystem config sourcesOverride checkMaterialization enableHaskellProfiling; }
, sources ? import ./nix/sources.nix { inherit system; } // sourcesOverride
, haskellNix ? import sources."haskell.nix" {
sourcesOverride = {
hackage = sources."hackage.nix";
stackage = sources."stackage.nix";
};
}
, haskellNixOverlays ? haskellNix.overlays
, packages ? import ./nix { inherit system sources crossSystem config sourcesOverride haskellNixOverlays checkMaterialization enableHaskellProfiling; }
# An explicit git rev to use, passed when we are in Hydra
# Whether to check that the pinned shas for haskell.nix are correct. We want this to be
# false, generally, since it does more work, but we set it to true in the CI
Expand Down
20 changes: 2 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,12 @@
outputs = { self, nixpkgs, haskell-nix, flake-utils, ... }:
(flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
#
# Obtain all niv sources extending it with the 'nixpkgs' flake input
#
sources = import ./nix/sources.nix { inherit system; };

#
# all packages from nix/default.nix
#
plutusPackages = import ./nix {
inherit system sources;
haskellNixOverlays = [ haskell-nix.overlay ];
};

#
# all packages from ./default.nix
#
topLevel = import ./. {
inherit system;
packages = plutusPackages;
haskellNixOverlays = [ haskell-nix.overlay ];
};

inherit (plutusPackages) pkgs plutus ownOverlays;
inherit (topLevel) pkgs plutus ownOverlays;
inherit (plutus) haskell iohkNix;
inherit (plutus.lib) buildPursPackage buildNodeModules filterNpm gitignore-nix;
in
Expand Down
8 changes: 2 additions & 6 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{ crossSystem ? null
, system ? builtins.currentSystem
, config ? { allowUnfreePredicate = (import ./nix/lib/unfree.nix).unfreePredicate; }
, sourcesOverride ? { }
, packages ? import ./. { inherit crossSystem config sourcesOverride enableHaskellProfiling; }
, enableHaskellProfiling ? false
{ system ? builtins.currentSystem
, packages ? import ./. { inherit system; }
}:
let
inherit (packages) pkgs plutus plutus-playground marlowe-playground plutus-pab marlowe-dashboard deployment docs;
Expand Down

0 comments on commit 454be4e

Please sign in to comment.