Skip to content

Commit

Permalink
WIP: flakes hacking
Browse files Browse the repository at this point in the history
  • Loading branch information
gilligan committed May 20, 2021
1 parent 235cec3 commit 1f1d22f
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 9 deletions.
3 changes: 2 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
{ system ? builtins.currentSystem
, crossSystem ? null
, config ? { allowUnfreePredicate = (import ./nix/lib/unfree.nix).unfreePredicate; }
, useFlakes ? false
# Overrides for niv
, sourcesOverride ? { }
, packages ? import ./nix { inherit system crossSystem config sourcesOverride checkMaterialization enableHaskellProfiling; }
, packages ? import ./nix { inherit system crossSystem config useFlakes sourcesOverride 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
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
description = "Flake for Plutus";

inputs = {
flake-utils.url = "github:numtide/flake-utils?rev=b543720b25df6ffdfcf9227afafc5b8c1fabfae8";
};

outputs = { self, flake-utils, ... }:
(flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
topLevel = import ./. {
inherit system;
useFlakes = true;
};

inherit (topLevel) pkgs plutus ownOverlays;
inherit (plutus) haskell iohkNix;
inherit (plutus.lib) buildPursPackage buildNodeModules filterNpm gitignore-nix;
in
rec {
packages = rec {
marlowe-playground-client = topLevel.marlowe-playground.client;
marlowe-playground-server = topLevel.marlowe-playground.server;
plutus-playground-client = topLevel.plutus-playground.client;
plutus-playground-server = topLevel.plutus-playground.server;
marlowe-website = topLevel.marlowe-web;
web-ghc-server = plutus.haskell.project.hsPkgs.web-ghc.components.exes.web-ghc-server;
};
}));
}
11 changes: 8 additions & 3 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@
, crossSystem ? null
, config ? { }
, overlays ? [ ]
, useFlakes ? false
, sourcesOverride ? { }
, checkMaterialization ? false
, enableHaskellProfiling ? false
}:
let
sources = import ./sources.nix { inherit pkgs; }
// sourcesOverride;
sources = import ./sources.nix { inherit system pkgs; } // sourcesOverride;
iohkNix = import sources.iohk-nix { };
haskellNix = import sources."haskell.nix" {
inherit system;
sourcesOverride = {
hackage = sources."hackage.nix";
stackage = sources."stackage.nix";
};
};

# For haskell.nix a different overlay has to be used for
# normal evaluation or when evaluated in a flake build
haskellNixOverlays = if useFlakes then [ haskellNix.allOverlays.combined-eval-on-build ] else haskellNix.overlays;

extraOverlays =
# Haskell.nix (https://github.com/input-output-hk/haskell.nix)
haskellNix.overlays
haskellNixOverlays
# haskell-nix.haskellLib.extra: some useful extra utility functions for haskell.nix
++ iohkNix.overlays.haskell-nix-extra
# iohkNix: nix utilities and niv:
Expand Down
10 changes: 5 additions & 5 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"haskell.nix": {
"branch": "master",
"branch": "pass-system-to-niv",
"description": "Alternative Haskell Infrastructure for Nixpkgs",
"homepage": "https://input-output-hk.github.io/haskell.nix",
"owner": "input-output-hk",
"owner": "tweag",
"repo": "haskell.nix",
"rev": "87084d65a476cc826a0e8c5d281d494254f5bc7a",
"sha256": "168vj5zswhxvvgp39ksr400gl2szih9sjbcdz2wsb7r7rnwp42xp",
"rev": "3bf36164e9cb2e5df47551777d8e5386f10984ad",
"sha256": "09irl3svvjjzkl1k1i32i1iidm0zbqawqgrs6bbbs1hqjr63s2cw",
"type": "tarball",
"url": "https://github.com/input-output-hk/haskell.nix/archive/87084d65a476cc826a0e8c5d281d494254f5bc7a.tar.gz",
"url": "https://github.com/tweag/haskell.nix/archive/3bf36164e9cb2e5df47551777d8e5386f10984ad.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"iohk-nix": {
Expand Down

0 comments on commit 1f1d22f

Please sign in to comment.