Skip to content

Commit 05b261f

Browse files
committed
Materialize haskell.nix projects
Materialization saves the part of the Nix expression which would be generated every time the project is built. This part tracks the package description and dependencies, so it only changes infrequently. Saving the output of this step (so that we can skip building it) makes the build faster. The drawback of this approach is that we must periodically run with checkMaterialization enabled to detect when the materialization needs to be updated.
1 parent d010e16 commit 05b261f

20 files changed

+2041
-4
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
name: runtimeverification
1616
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
17-
- run: nix-build -A kore -A project.kore.checks
17+
- run: nix-build --arg checkMaterialization true -A kore -A project.kore.checks
1818
- run: nix-shell --run "echo OK"
1919

2020
test-cabal:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/.build/*
22
/evm-semantics
33

4-
*.cache
54
*.class
65
*.iml
76
*.ipr

default.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{ profiling ? false
22
, release ? false
33
, threaded ? !profiling
4+
, checkMaterialization ? false
45
}:
56

67
let
@@ -16,6 +17,8 @@ let
1617

1718
project = pkgs.haskell-nix.stackProject {
1819
src = pkgs.haskell-nix.haskellLib.cleanGit { name = "kore"; src = ./.; };
20+
inherit checkMaterialization;
21+
materialized = ./nix/kore.nix.d;
1922
modules = [
2023
{
2124
# package *
@@ -39,7 +42,7 @@ let
3942
];
4043
};
4144

42-
shell = import ./shell.nix { inherit default; };
45+
shell = import ./shell.nix { inherit default checkMaterialization; };
4346

4447
version = project.kore.components.exes.kore-exec.version;
4548

nix/ghcide.nix.d/.stack-to-nix.cache

Whitespace-only changes.

nix/ghcide.nix.d/default.nix

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
extras = hackage:
3+
{
4+
packages = {
5+
"haskell-lsp" = (((hackage.haskell-lsp)."0.22.0.0").revisions).default;
6+
"haskell-lsp-types" = (((hackage.haskell-lsp-types)."0.22.0.0").revisions).default;
7+
"lsp-test" = (((hackage.lsp-test)."0.11.0.2").revisions).default;
8+
"ghc-check" = (((hackage.ghc-check)."0.5.0.1").revisions).default;
9+
"hie-bios" = (((hackage.hie-bios)."0.6.1").revisions).default;
10+
"Chart-diagrams" = (((hackage.Chart-diagrams)."1.9.3").revisions).default;
11+
"SVGFonts" = (((hackage.SVGFonts)."1.7.0.1").revisions).default;
12+
"diagrams" = (((hackage.diagrams)."1.4").revisions).default;
13+
"diagrams-svg" = (((hackage.diagrams-svg)."1.4.3").revisions).default;
14+
"diagrams-contrib" = (((hackage.diagrams-contrib)."1.4.4").revisions).default;
15+
"diagrams-core" = (((hackage.diagrams-core)."1.4.2").revisions).default;
16+
"diagrams-lib" = (((hackage.diagrams-lib)."1.4.3").revisions).default;
17+
"diagrams-postscript" = (((hackage.diagrams-postscript)."1.5").revisions).default;
18+
"monoid-extras" = (((hackage.monoid-extras)."0.5.1").revisions).default;
19+
"svg-builder" = (((hackage.svg-builder)."0.1.1").revisions).default;
20+
"active" = (((hackage.active)."0.2.0.14").revisions).default;
21+
"dual-tree" = (((hackage.dual-tree)."0.2.2.1").revisions).default;
22+
"force-layout" = (((hackage.force-layout)."0.4.0.6").revisions).default;
23+
"statestack" = (((hackage.statestack)."0.3").revisions).default;
24+
ghcide = ./ghcide.nix;
25+
};
26+
};
27+
resolver = "nightly-2020-06-19";
28+
modules = [
29+
({ lib, ... }:
30+
{ packages = {}; })
31+
{ packages = { "ghcide" = { package = { ghcOptions = "-DSTACK"; }; }; }; }
32+
];
33+
}

nix/ghcide.nix.d/ghcide.nix

Lines changed: 303 additions & 0 deletions
Large diffs are not rendered by default.

nix/hlint.nix.d/.stack-to-nix.cache

Whitespace-only changes.

nix/hlint.nix.d/default.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
extras = hackage:
3+
{
4+
packages = {
5+
"ghc-lib-parser" = (((hackage.ghc-lib-parser)."8.10.2.20200808").revisions).default;
6+
"ghc-lib-parser-ex" = (((hackage.ghc-lib-parser-ex)."8.10.0.16").revisions).default;
7+
"extra" = (((hackage.extra)."1.7.3").revisions).default;
8+
"apply-refact" = (((hackage.apply-refact)."0.8.2.0").revisions).default;
9+
"ghc-exactprint" = (((hackage.ghc-exactprint)."0.6.3.1").revisions).default;
10+
"optparse-applicative" = (((hackage.optparse-applicative)."0.15.1.0").revisions).default;
11+
hlint = ./hlint.nix;
12+
};
13+
};
14+
resolver = "lts-14.20";
15+
modules = [
16+
({ lib, ... }:
17+
{ packages = {}; })
18+
{
19+
packages = {
20+
"$locals" = {
21+
package = {
22+
ghcOptions = "-ddump-to-file -ddump-hi -Werror=unused-imports -Werror=unused-top-binds -Werror=orphans";
23+
};
24+
};
25+
};
26+
}
27+
];
28+
}

nix/hlint.nix.d/hlint.nix

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
{ system
2+
, compiler
3+
, flags
4+
, pkgs
5+
, hsPkgs
6+
, pkgconfPkgs
7+
, errorHandler
8+
, config
9+
, ... }:
10+
{
11+
flags = { threaded = true; gpl = true; ghc-lib = false; hsyaml = false; };
12+
package = {
13+
specVersion = "1.18";
14+
identifier = { name = "hlint"; version = "3.2"; };
15+
license = "BSD-3-Clause";
16+
copyright = "Neil Mitchell 2006-2020";
17+
maintainer = "Neil Mitchell <[email protected]>";
18+
author = "Neil Mitchell <[email protected]>";
19+
homepage = "https://github.com/ndmitchell/hlint#readme";
20+
url = "";
21+
synopsis = "Source code suggestions";
22+
description = "HLint gives suggestions on how to improve your source code.";
23+
buildType = "Simple";
24+
isLocal = true;
25+
detailLevel = "FullDetails";
26+
licenseFiles = [ "LICENSE" ];
27+
dataDir = "data";
28+
dataFiles = [
29+
"hlint.yaml"
30+
"default.yaml"
31+
"Test.hs"
32+
"report_template.html"
33+
"hs-lint.el"
34+
"hlint.1"
35+
"hlint.ghci"
36+
"HLint_QuickCheck.hs"
37+
"HLint_TypeCheck.hs"
38+
];
39+
extraSrcFiles = [];
40+
extraTmpFiles = [];
41+
extraDocFiles = [ "README.md" "CHANGES.txt" ];
42+
};
43+
components = {
44+
"library" = {
45+
depends = (([
46+
(hsPkgs."base" or (errorHandler.buildDepError "base"))
47+
(hsPkgs."process" or (errorHandler.buildDepError "process"))
48+
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
49+
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
50+
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
51+
(hsPkgs."unordered-containers" or (errorHandler.buildDepError "unordered-containers"))
52+
(hsPkgs."vector" or (errorHandler.buildDepError "vector"))
53+
(hsPkgs."text" or (errorHandler.buildDepError "text"))
54+
(hsPkgs."bytestring" or (errorHandler.buildDepError "bytestring"))
55+
(hsPkgs."transformers" or (errorHandler.buildDepError "transformers"))
56+
(hsPkgs."file-embed" or (errorHandler.buildDepError "file-embed"))
57+
(hsPkgs."utf8-string" or (errorHandler.buildDepError "utf8-string"))
58+
(hsPkgs."data-default" or (errorHandler.buildDepError "data-default"))
59+
(hsPkgs."cpphs" or (errorHandler.buildDepError "cpphs"))
60+
(hsPkgs."cmdargs" or (errorHandler.buildDepError "cmdargs"))
61+
(hsPkgs."uniplate" or (errorHandler.buildDepError "uniplate"))
62+
(hsPkgs."ansi-terminal" or (errorHandler.buildDepError "ansi-terminal"))
63+
(hsPkgs."extra" or (errorHandler.buildDepError "extra"))
64+
(hsPkgs."refact" or (errorHandler.buildDepError "refact"))
65+
(hsPkgs."aeson" or (errorHandler.buildDepError "aeson"))
66+
(hsPkgs."filepattern" or (errorHandler.buildDepError "filepattern"))
67+
(hsPkgs."ghc-lib-parser-ex" or (errorHandler.buildDepError "ghc-lib-parser-ex"))
68+
] ++ (if !flags.ghc-lib && (compiler.isGhc && (compiler.version).ge "8.10.0") && (compiler.isGhc && (compiler.version).lt "8.11.0")
69+
then [
70+
(hsPkgs."ghc" or (errorHandler.buildDepError "ghc"))
71+
(hsPkgs."ghc-boot-th" or (errorHandler.buildDepError "ghc-boot-th"))
72+
(hsPkgs."ghc-boot" or (errorHandler.buildDepError "ghc-boot"))
73+
]
74+
else [
75+
(hsPkgs."ghc-lib-parser" or (errorHandler.buildDepError "ghc-lib-parser"))
76+
])) ++ (pkgs.lib).optional (flags.gpl) (hsPkgs."hscolour" or (errorHandler.buildDepError "hscolour"))) ++ (if flags.hsyaml
77+
then [
78+
(hsPkgs."HsYAML" or (errorHandler.buildDepError "HsYAML"))
79+
(hsPkgs."HsYAML-aeson" or (errorHandler.buildDepError "HsYAML-aeson"))
80+
]
81+
else [ (hsPkgs."yaml" or (errorHandler.buildDepError "yaml")) ]);
82+
buildable = true;
83+
modules = [
84+
"Paths_hlint"
85+
"Apply"
86+
"CmdLine"
87+
"Extension"
88+
"Fixity"
89+
"HLint"
90+
"HsColour"
91+
"Idea"
92+
"Report"
93+
"Util"
94+
"Parallel"
95+
"Refact"
96+
"Timing"
97+
"CC"
98+
"EmbedData"
99+
"Summary"
100+
"Config/Compute"
101+
"Config/Haskell"
102+
"Config/Read"
103+
"Config/Type"
104+
"Config/Yaml"
105+
"GHC/All"
106+
"GHC/Util"
107+
"GHC/Util/ApiAnnotation"
108+
"GHC/Util/View"
109+
"GHC/Util/Brackets"
110+
"GHC/Util/DynFlags"
111+
"GHC/Util/FreeVars"
112+
"GHC/Util/HsDecl"
113+
"GHC/Util/HsExpr"
114+
"GHC/Util/SrcLoc"
115+
"GHC/Util/Scope"
116+
"GHC/Util/Unify"
117+
"Hint/All"
118+
"Hint/Bracket"
119+
"Hint/Comment"
120+
"Hint/Duplicate"
121+
"Hint/Export"
122+
"Hint/Extensions"
123+
"Hint/Import"
124+
"Hint/Lambda"
125+
"Hint/List"
126+
"Hint/ListRec"
127+
"Hint/Match"
128+
"Hint/Monad"
129+
"Hint/Naming"
130+
"Hint/NewType"
131+
"Hint/Pattern"
132+
"Hint/Pragma"
133+
"Hint/Restrict"
134+
"Hint/Smell"
135+
"Hint/Type"
136+
"Hint/Unsafe"
137+
"Test/All"
138+
"Test/Annotations"
139+
"Test/InputOutput"
140+
"Test/Util"
141+
"Language/Haskell/HLint"
142+
];
143+
hsSourceDirs = [ "src" ];
144+
};
145+
exes = {
146+
"hlint" = {
147+
depends = [
148+
(hsPkgs."base" or (errorHandler.buildDepError "base"))
149+
(hsPkgs."hlint" or (errorHandler.buildDepError "hlint"))
150+
];
151+
buildable = true;
152+
mainPath = [
153+
"src/Main.hs"
154+
] ++ (pkgs.lib).optional (flags.threaded) "";
155+
};
156+
};
157+
};
158+
} // rec {
159+
src = (pkgs.lib).mkDefault ./.;
160+
}

nix/kore.nix.d/.stack-to-nix.cache

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
https://github.com/ttuegel/tasty-test-reporter.git e411234da88d3f32dfe1319c5edce478abf5115b . 1n8xah66agmcrchpi9gf448c8b6kmgcc66jifsx6dnxx8f8wm9y4 tasty-test-reporter .stack-to-nix.cache.0
2+
https://github.com/ttuegel/pipes-ghc-events.git 780b479300bd165f58b3bdd5f941ea81844fc937 eventlog2speedscope 1qhpyx179n3zkaadvw8x411rqcvv12lvnnhkaxfa5fqm78bp2yzy eventlog2speedscope .stack-to-nix.cache.1
3+
https://github.com/ttuegel/pipes-ghc-events.git 780b479300bd165f58b3bdd5f941ea81844fc937 pipes-ghc-events 1qhpyx179n3zkaadvw8x411rqcvv12lvnnhkaxfa5fqm78bp2yzy pipes-ghc-events .stack-to-nix.cache.2
4+
https://github.com/ttuegel/pipes-sqlite-simple.git a3920f053f92e76f2a7ff7c68e34f9e926817702 . 13iag206szfmc8ng77j6qjb6r91ysy9qkvijmf9n9dclvmb1g8an pipes-sqlite-simple .stack-to-nix.cache.3

nix/kore.nix.d/.stack-to-nix.cache.0

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{ system
2+
, compiler
3+
, flags
4+
, pkgs
5+
, hsPkgs
6+
, pkgconfPkgs
7+
, errorHandler
8+
, config
9+
, ... }:
10+
{
11+
flags = {};
12+
package = {
13+
specVersion = "1.18";
14+
identifier = { name = "tasty-test-reporter"; version = "0.1.1.1"; };
15+
license = "BSD-3-Clause";
16+
copyright = "2020 Christoph Hermann";
17+
maintainer = "[email protected]";
18+
author = "Christoph Hermann";
19+
homepage = "https://github.com/stoeffel/tasty-test-reporter#readme";
20+
url = "";
21+
synopsis = "Producing JUnit-style XML test reports.";
22+
description = "Please see the README at <https://github.com/stoeffel/tasty-test-reporter>.";
23+
buildType = "Simple";
24+
};
25+
components = {
26+
"library" = {
27+
depends = [
28+
(hsPkgs."ansi-terminal" or (errorHandler.buildDepError "ansi-terminal"))
29+
(hsPkgs."base" or (errorHandler.buildDepError "base"))
30+
(hsPkgs."concurrent-output" or (errorHandler.buildDepError "concurrent-output"))
31+
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
32+
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
33+
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
34+
(hsPkgs."junit-xml" or (errorHandler.buildDepError "junit-xml"))
35+
(hsPkgs."mtl" or (errorHandler.buildDepError "mtl"))
36+
(hsPkgs."safe-exceptions" or (errorHandler.buildDepError "safe-exceptions"))
37+
(hsPkgs."stm" or (errorHandler.buildDepError "stm"))
38+
(hsPkgs."tagged" or (errorHandler.buildDepError "tagged"))
39+
(hsPkgs."tasty" or (errorHandler.buildDepError "tasty"))
40+
(hsPkgs."text" or (errorHandler.buildDepError "text"))
41+
];
42+
buildable = true;
43+
};
44+
tests = {
45+
"spec" = {
46+
depends = [
47+
(hsPkgs."base" or (errorHandler.buildDepError "base"))
48+
(hsPkgs."tasty" or (errorHandler.buildDepError "tasty"))
49+
(hsPkgs."tasty-hunit" or (errorHandler.buildDepError "tasty-hunit"))
50+
(hsPkgs."tasty-test-reporter" or (errorHandler.buildDepError "tasty-test-reporter"))
51+
];
52+
buildable = true;
53+
};
54+
};
55+
};
56+
} // rec {
57+
src = (pkgs.lib).mkDefault /nix/store/nj6ylibif8ib91d9dj20v96kcp8gx2ql-tasty-test-reporter-e411234;
58+
}

0 commit comments

Comments
 (0)