on iko/ghcjs-patch-master help sign in
Merge pull request #47 from input-output-hk/rvl/hackage-stackage

Provide hackage and stackage from haskell.nix

commit7446d044a0db6acdd3d13c1d933ec1ed6da9a606 authorRodney Lorrimar <dev@rodney.id.au> dateWed 13 Feb 2019, 14:52 (8 years ago) parent2520ce07ff3d1a
29 files changed+568−60
README.org+33−3 default.nix+75−8 doc/maintainer-scripts.md+18 hackage-src.json+7 compat.nix → lib/compat.nix lib/fetch-external.nix+16 lib/override-with.nix+9 nix-tools/default.nix+15 nix-tools/nix-tools-src.json+7 scripts/update-external.nix+26 scripts/update-hackage.nix+24 scripts/update-stackage.nix+44 stackage-src.json+7 test/builder-haddock/default.nix+2−6 test/cabal-22/default.nix+8−12 test/cabal-simple/default.nix+4−10 test/default.nix+7−14 test/stack-simple/.gitignore+3 test/stack-simple/.stack.nix/stack-simple.nix+32 test/stack-simple/Setup.hs+2 test/stack-simple/app/Main.hs+6 test/stack-simple/default.nix+35 test/stack-simple/package.yaml+48 test/stack-simple/src/Lib.hs+6 test/stack-simple/stack-pkgs.nix+5 test/stack-simple/stack-simple.cabal+61 test/stack-simple/stack.yaml+64 test/stack-simple/test/Spec.hs+2 test/with-packages/default.nix+2−7
README.org+33−3
@@ -1,4 +1,34 @@
1−* haskell.nix
1+* Alternative Haskell Infrastructure for Nixpkgs
22
3−This repository contains the runtime system for [[https://github.com/input-output-hk/nix-tools][nix-tools]].
4−Please see [[https://github.com/input-output-hk/nix-tools][nix-tools]] for more details.
3+[[https://travis-ci.org/input-output-hk/haskell.nix][https://travis-ci.org/input-output-hk/haskell.nix.svg?branch=master]]
4+
5+=haskell.nix= is an experimental new builder for Haskell packages.
6+
7+It works by automatically translating your Cabal or Stack project and
8+its dependencies into Nix code. Most of your dependencies are already
9+translated, so you generally won't have too much generated code.
10+
11+For full documentation, see https://input-output-hk.github.io/haskell.nix
12+
13+** Quickstart
14+
15+This will download and build =nix-tools=.
16+
17+#+begin_src sh
18+nix build -f https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz nix-tools -o nt
19+./nt/bin/cabal-to-nix --help
20+#+end_src
21+
22+** Related repos
23+
24+The =haskell.nix= repository contains the runtime system for building
25+Haskell packages in Nix. It depends on other repos, which are:
26+
27+- [[https://github.com/input-output-hk/nix-tools][nix-tools]] — provides the programs for generating Nix expressions from
28+ Haskell projects.
29+
30+- [[https://github.com/input-output-hk/hackage.nix][hackage.nix]] — the latest contents of the [[https://hackage.haskell.org/][Hackage]] databases,
31+ converted to Nix expressions.
32+
33+- [[https://github.com/input-output-hk/stackage.nix][stackage.nix]] — all of the [[https://www.stackage.org/][Stackage]] snapshots, converted to Nix
34+ expressions.
default.nix+75−8
@@ -1,3 +1,6 @@
1+{ pkgs ? import <nixpkgs> {}
2+}:
3+
14let
25 # pkg-def's may reference boot packages, but those
36 # are not guaranteed to be available on hackage, as
@@ -13,19 +16,83 @@ let
1316 then filterAttrs (k: _: !(builtins.elem k boot-pkgs)) v
1417 else v)
1518 (pkg-def hackage);
16−in
17−hackage: let haskell = rec {
19+
1820 # ghc hackage patches.
1921 # these are patches that turn hackage packages into the same as the ones
2022 # ghc ships with the supposedly same version. See GHC Track Issue: 16199
2123 ghcHackagePatches = import ./patches;
2224
23− compat = import ./compat.nix;
25+ compat = import ./lib/compat.nix;
26+
27+ # Utility function for downloading a pinned git repo, that can be
28+ # overridden with NIX_PATH.
29+ fetchExternal = import ./lib/fetch-external.nix;
30+
31+ # All packages from Hackage as Nix expressions
32+ hackage = import (fetchExternal {
33+ name = "hackage-exprs-source";
34+ specJSON = ./hackage-src.json;
35+ override = "hackage";
36+ });
37+
38+ # The set of all Stackage snapshots
39+ stackage = import (fetchExternal {
40+ name = "stackage-snapshot-source";
41+ specJSON = ./stackage-src.json;
42+ override = "stackage";
43+ });
44+
45+ packages = self: ({
46+ # Utility functions for working with the component builder.
47+ haskellLib = let hl = import ./lib { inherit (pkgs) lib; haskellLib = hl; }; in hl;
2448
25− mkPkgSet
26− = { pkgs, pkg-def, pkg-def-overlays ? [], modules ? [] }@args:
27− import ./package-set.nix (args // { inherit hackage; pkg-def = strip-pkg-def pkgs pkg-def; });
49+ # Create a Haskell package set based on a cabal build plan (plan-to-nix)
50+ # and Nix expressions representing cabal packages (cabal-to-nix).
51+ mkPkgSet =
52+ { pkg-def # Base package set. Either from stackage (via stack-to-nix) or from a cabal projects plan file (via plan-to-nix)
53+ , pkg-def-overlays ? [] # Additional packages to augment the Base package set `pkg-def` with.
54+ , modules ? []
55+ }@args:
2856
29− mkNewPkgSet = args: builtins.trace "DEPRECATED: use mkPkgSet instead of mkNewPkgSet" (mkPkgSet args);
57+ import ./package-set.nix (args // {
58+ inherit hackage pkgs;
59+ pkg-def = strip-pkg-def pkgs pkg-def;
60+ });
3061
31−}; in haskell
62+ # Create a Haskell package set based on a Stack configuration.
63+ mkStackPkgSet =
64+ { stack-pkgs # Path to the output of stack-to-nix
65+ , pkg-def-overlays ? []
66+ , modules ? []
67+ }@args:
68+
69+ let
70+ # The Stackage release referenced in the stack config
71+ pkg-def = stackage.${stack-pkgs.resolver};
72+ # The compiler referenced in the stack config
73+ compiler = (stack-pkgs.overlay hackage).compiler or (pkg-def hackage).compiler;
74+ in self.mkPkgSet {
75+ inherit pkg-def;
76+ pkg-def-overlays = [ stack-pkgs.overlay ] ++ pkg-def-overlays;
77+ modules = [ ghcHackagePatches.${compiler.nix-name} ] ++ modules;
78+ };
79+
80+ # Programs for generating Nix expressions from Cabal and Stack
81+ # files.
82+ nix-tools = self.callPackage ./nix-tools {
83+ inherit fetchExternal;
84+ };
85+
86+ # Snapshots of Hackage and Stackage, converted to Nix expressions,
87+ # regularly updated.
88+ inherit hackage stackage;
89+
90+ # Scripts for keeping Hackage and Stackage up to date.
91+ maintainer-scripts = {
92+ update-hackage = self.callPackage ./scripts/update-hackage.nix {};
93+ update-stackage = self.callPackage ./scripts/update-stackage.nix {};
94+ };
95+ });
96+
97+in
98+ pkgs.lib.makeScope pkgs.newScope packages
doc/maintainer-scripts.mdnew file+18
@@ -0,0 +1,18 @@
1+# Updating Hackage and Stackage Nix expressions
2+
3+The [`hackage.nix`](https://github.com/input-output-hk/hackage.nix)
4+and [`stackage.nix`](https://github.com/input-output-hk/stackage.nix)
5+repos and corresponding files `hackage-src.json` and
6+`stackage-src.json` will be regularly and automatically updated using
7+scripts in this repo.
8+
9+To run the updater scripts manually, use:
10+
11+ nix-build -A maintainer-scripts.update-hackage -o update-hackage.sh
12+ ./update-hackage.sh
13+
14+ nix-build -A maintainer-scripts.update-stackage -o update-stackage.sh
15+ ./update-stackage.sh
16+
17+The scripts will clone the repo, generate the latest data, then
18+attempt to push back to the repo and update the source JSON file.
hackage-src.jsonnew file+7
@@ -0,0 +1,7 @@
1+{
2+ "url": "https://github.com/input-output-hk/hackage.nix",
3+ "rev": "3180384b563ec7c7b46bca86b3ace0f32d04cde8",
4+ "date": "2019-02-05T17:32:14+08:00",
5+ "sha256": "19ndkn8pivli9plwq0wnx1cj126l89yk7jw9a0dj51ic3b2qhlb2",
6+ "fetchSubmodules": false
7+}
compat.nix → lib/compat.nixrenamed

The content is the same.

lib/fetch-external.nixnew file+16
@@ -0,0 +1,16 @@
1+# Provides a function for fetching a GitHub repo from a JSON spec,
2+# overridable with the given entry on the NIX_PATH.
3+
4+let
5+ overrideWith = import ./override-with.nix;
6+in
7+ { name, specJSON, override }:
8+ let
9+ spec = builtins.fromJSON (builtins.readFile specJSON);
10+ in
11+ overrideWith override
12+ (builtins.fetchTarball {
13+ inherit name;
14+ url = "${spec.url}/archive/${spec.rev}.tar.gz";
15+ inherit (spec) sha256;
16+ })
lib/override-with.nixnew file+9
@@ -0,0 +1,9 @@
1+# overrideWith - Allow the user to override the given default path
2+# with a NIX_PATH entry.
3+override: default:
4+ let
5+ try = builtins.tryEval (builtins.findFile builtins.nixPath override);
6+ in if try.success then
7+ builtins.trace "using search host <${override}>" try.value
8+ else
9+ default
nix-tools/default.nixnew file+15
@@ -0,0 +1,15 @@
1+{ symlinkJoin, fetchExternal, mkPkgSet }:
2+
3+let
4+ src = fetchExternal {
5+ name = "nix-tools-src";
6+ specJSON = ./nix-tools-src.json;
7+ override = "nix-tools";
8+ };
9+
10+ hsPkgs = import (src + "/pkgs.nix") { inherit mkPkgSet; };
11+in
12+ symlinkJoin {
13+ name = "nix-tools";
14+ paths = builtins.attrValues hsPkgs.nix-tools.components.exes;
15+ }
nix-tools/nix-tools-src.jsonnew file+7
@@ -0,0 +1,7 @@
1+{
2+ "url": "https://github.com/input-output-hk/nix-tools",
3+ "rev": "232e4fde7f942ef234b649144016d5da0f7e2745",
4+ "date": "2019-02-11T12:59:38+08:00",
5+ "sha256": "1nrm9vcq443isk09z1fmlp8zxnw9p3cx95zbda29s5mky17ky2c0",
6+ "fetchSubmodules": false
7+}
scripts/update-external.nixnew file+26
@@ -0,0 +1,26 @@
1+{ stdenv, writeScript, glibc, coreutils, git, nix-tools, cabal-install, nix-prefetch-git }:
2+
3+{ name, script }:
4+
5+with stdenv.lib;
6+
7+writeScript "update-${name}-nix.sh" ''
8+ #!${stdenv.shell}
9+
10+ set -euo pipefail
11+
12+ export PATH="${makeBinPath [ coreutils glibc git nix-tools cabal-install nix-prefetch-git ]}"
13+
14+ ${script}
15+
16+ git add .
17+ git commit --allow-empty -m "Automatic update for $(date)"
18+
19+ rev=$(git rev-parse HEAD)
20+
21+ git push
22+
23+ cd ..
24+
25+ nix-prefetch-git https://github.com/input-output-hk/${name}.nix.git --rev "$rev" | tee ${name}-src.json
26+''
scripts/update-hackage.nixnew file+24
@@ -0,0 +1,24 @@
1+{ stdenv, writeScript, coreutils, glibc, git, nix-tools, cabal-install, nix-prefetch-git }@args:
2+
3+import ./update-external.nix args {
4+ name = "hackage";
5+ script = ''
6+ # Make sure the hackage index is recent.
7+ cabal new-update
8+
9+ # Clone or update the Hackage Nix expressions repo.
10+ if [ -d hackage.nix ]; then
11+ cd hackage.nix
12+ git pull --ff-only
13+ cd ..
14+ else
15+ git clone git@github.com:input-output-hk/hackage.nix.git
16+ fi
17+
18+ echo "Running hackage-to-nix..."
19+
20+ hackage-to-nix hackage.nix
21+
22+ cd hackage.nix
23+ '';
24+}
scripts/update-stackage.nixnew file+44
@@ -0,0 +1,44 @@
1+{ stdenv, writeScript, coreutils, glibc, git, nix-tools, cabal-install, nix-prefetch-git }@args:
2+
3+import ./update-external.nix args {
4+ name = "stackage";
5+ script = ''
6+ # Clone or update the main Stackage Nix expressions repo.
7+ # The upstream LTS and Nightly package sets are in submodules, which
8+ # should also be updated.
9+ if [ -d stackage.nix ]; then
10+ cd stackage.nix
11+ git pull --ff-only
12+ git submodule update --init
13+ git submodule foreach git pull origin master
14+ else
15+ git clone git@github.com:input-output-hk/stackage.nix.git
16+ cd stackage.nix
17+ git submodule update --init
18+ fi
19+
20+ echo "Running lts-to-nix for all snapshots..."
21+
22+ # update them all in parallel...
23+ N=$(getconf _NPROCESSORS_ONLN)
24+ for lts in {lts-haskell,stackage-nightly}/*.yaml
25+ do
26+ lts-to-nix $lts > $(basename ''${lts%.yaml}.nix) &
27+ while [[ $(jobs -r -p | wc -l) -gt $N ]]; do
28+ # can't use `wait -n` on older bash versions.
29+ # e.g. what ships with macOS High Sierra
30+ sleep 1;
31+ done
32+ done
33+ wait
34+
35+ # update nightlies
36+ echo "{" > nightlies.nix;
37+ for a in nightly-*.nix; do echo " \"''${a%%.nix}\" = import ./$a;" >> nightlies.nix; done;
38+ echo "}" >> nightlies.nix
39+ # update lts
40+ echo "{" > ltss.nix;
41+ for a in lts-*.nix; do echo " \"''${a%%.nix}\" = import ./$a;" >> ltss.nix; done;
42+ echo "}" >> ltss.nix
43+ '';
44+}
stackage-src.jsonnew file+7
@@ -0,0 +1,7 @@
1+{
2+ "url": "https://github.com/input-output-hk/stackage.nix",
3+ "rev": "2615a4e6b1651215ee400e62fcdcb195062a3d35",
4+ "date": "2019-02-05T17:41:44+08:00",
5+ "sha256": "08c8lb8x047hndwm1cb2zxixnjmrswfp5y18xp1v79cjqlva0qj6",
6+ "fetchSubmodules": false
7+}
test/builder-haddock/default.nix+2−6
@@ -1,13 +1,9 @@
1−{ pkgs
2−, haskell
3−, stdenv
4−}:
1+{ mkPkgSet, stdenv }:
52
63with stdenv.lib;
74
85let
9− pkgSet = haskell.mkPkgSet {
10− inherit pkgs;
6+ pkgSet = mkPkgSet {
117 # generated with:
128 # cabal new-build
139 # plan-to-nix dist-newstyle/cache/plan.json > plan.nix
test/cabal-22/default.nix+8−12
@@ -1,13 +1,9 @@
1−{ pkgs
2−, haskell
3−, stdenv
4−}:
1+{ stdenv, mkPkgSet }:
52
63with stdenv.lib;
74
85let
9− pkgSet = haskell.mkPkgSet {
10− inherit pkgs;
6+ pkgSet = mkPkgSet {
117 pkg-def = import ./plan.nix;
128 pkg-def-overlays = [
139 { project = ./project.nix; }
@@ -32,23 +28,23 @@ in
3228 "$exe"
3329
3430 printf "checking that executable is dynamically linked to system libraries... " >& 2
35− '' + pkgs.lib.optionalString pkgs.stdenv.isLinux ''
31+ '' + optionalString stdenv.isLinux ''
3632 ldd $exe | grep libpthread
37− '' + pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
33+ '' + optionalString stdenv.isDarwin ''
3834 otool -L $exe | grep "libSystem.B"
3935 '' + ''
4036 # fixme: posix-specific
4137 printf "checking that dynamic library is produced... " >& 2
42− '' + pkgs.lib.optionalString pkgs.stdenv.isLinux ''
38+ '' + optionalString stdenv.isLinux ''
4339 sofile=$(find "${packages.project.components.library}" | grep -e '\.so$')
44− '' + pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
40+ '' + optionalString stdenv.isDarwin ''
4541 sofile=$(find "${packages.project.components.library}" | grep -e '\.dylib$')
4642 '' + ''
4743 echo "$sofile"
4844 printf "checking that dynamic library is dynamically linked to prim... " >& 2
49− '' + pkgs.lib.optionalString pkgs.stdenv.isLinux ''
45+ '' + optionalString stdenv.isLinux ''
5046 ldd $sofile | grep libHSghc-prim
51− '' + pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
47+ '' + optionalString stdenv.isDarwin ''
5248 otool -L $sofile | grep libHSghc-prim
5349 '' + ''
5450 touch $out
test/cabal-simple/default.nix+4−10
@@ -1,9 +1,5 @@
11# Test a package set
2−{ pkgs
3−, haskell
4−, stdenv
5−, util
6−}:
2+{ stdenv, util, mkPkgSet }:
73
84with stdenv.lib;
95
@@ -12,8 +8,7 @@ let
128 # 1. cabal-to-nix cabal-simple.cabal > cabal-simple.nix
139 # 2. cabal new-build
1410 # 3. plan-to-nix ./dist-newstyle/cache/plan.json > plan.nix
15− pkgSet = haskell.mkPkgSet {
16− inherit pkgs;
11+ pkgSet = mkPkgSet {
1712 pkg-def = import ./plan.nix;
1813 pkg-def-overlays = [
1914 { cabal-simple = ./cabal-simple.nix;
@@ -45,9 +40,9 @@ in
4540 $exe
4641
4742 printf "checking that executable is dynamically linked to system libraries... " >& 2
48− '' + pkgs.lib.optionalString pkgs.stdenv.isLinux ''
43+ '' + optionalString stdenv.isLinux ''
4944 ldd $exe | grep libpthread
50− '' + pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
45+ '' + optionalString stdenv.isDarwin ''
5146 otool -L $exe |grep .dylib
5247 '' + ''
5348
@@ -68,6 +63,5 @@ in
6863 # Used for testing externally with nix-shell (../tests.sh).
6964 # This just adds cabal-install to the existing shells.
7065 test-shell = util.addCabalInstall packages.cabal-simple.components.all;
71−
7266 };
7367}
test/default.nix+7−14
@@ -3,29 +3,22 @@
33with pkgs;
44
55let
6− # all packages from hackage as nix expressions
7− hackage = import (fetchFromGitHub { owner = "angerman";
8− repo = "hackage.nix";
9− rev = "5223a45e08b1b0d738fdd292b39e49f39f21536f";
10− sha256 = "09r662kn2qs444fmqni9jamaxnrk9jrg6whqmxbwhfgd5vy3yynq";
11− name = "hackage-exprs-source"; });
126
137 # The new Haskell infra applied to nix representation of Hackage
14− haskell = import ../. hackage;
15−
16− haskellLib = let hl = import ../lib { inherit lib; haskellLib = hl; }; in hl;
8+ haskell = pkgs.callPackage ../. { };
179
1810 util = callPackage ./util.nix {};
1911
2012in {
21− cabal-simple = callPackage ./cabal-simple { inherit haskell util; };
22− cabal-22 = callPackage ./cabal-22 { inherit haskell; };
23− with-packages = callPackage ./with-packages { inherit haskell util; };
24− builder-haddock = callPackage ./builder-haddock { inherit haskell; };
13+ cabal-simple = callPackage ./cabal-simple { inherit (haskell) mkPkgSet; inherit util; };
14+ cabal-22 = callPackage ./cabal-22 { inherit (haskell) mkPkgSet; };
15+ with-packages = callPackage ./with-packages { inherit (haskell) mkPkgSet; inherit util; };
16+ builder-haddock = callPackage ./builder-haddock { inherit (haskell) mkPkgSet; };
17+ stack-simple = callPackage ./stack-simple { inherit (haskell) mkStackPkgSet; };
2518
2619 # Run unit tests with: nix-instantiate --eval --strict -A unit
2720 # An empty list means success.
28− unit = callPackage ./unit.nix { inherit haskellLib; };
21+ unit = callPackage ./unit.nix { inherit (haskell) haskellLib; };
2922}
3023
3124## possible test cases
test/stack-simple/.gitignorenew file+3
@@ -0,0 +1,3 @@
1+.stack-work/
2+stack-simple.cabal
3+*~
test/stack-simple/.stack.nix/stack-simple.nixnew file+32
@@ -0,0 +1,32 @@
1+{ system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
2+ ({
3+ flags = {};
4+ package = {
5+ specVersion = "0";
6+ identifier = { name = "stack-simple"; version = "0.1.0.0"; };
7+ license = "BSD-3-Clause";
8+ copyright = "2019 Author name here";
9+ maintainer = "example@example.com";
10+ author = "Author name here";
11+ homepage = "https://github.com/githubuser/stack-simple#readme";
12+ url = "";
13+ synopsis = "";
14+ description = "Please see the README on GitHub at <https://github.com/githubuser/stack-simple#readme>";
15+ buildType = "Simple";
16+ };
17+ components = {
18+ "library" = { depends = [ (hsPkgs.base) ]; };
19+ exes = {
20+ "stack-simple-exe" = {
21+ depends = [ (hsPkgs.base) (hsPkgs.stack-simple) ];
22+ };
23+ };
24+ tests = {
25+ "stack-simple-test" = {
26+ depends = [ (hsPkgs.base) (hsPkgs.stack-simple) ];
27+ };
28+ };
29+ };
30+ } // rec { src = (pkgs.lib).mkDefault ../.; }) // {
31+ cabal-generator = "hpack";
32+ }
test/stack-simple/Setup.hsnew file+2
@@ -0,0 +1,2 @@
1+import Distribution.Simple
2+main = defaultMain
test/stack-simple/app/Main.hsnew file+6
@@ -0,0 +1,6 @@
1+module Main where
2+
3+import Lib
4+
5+main :: IO ()
6+main = someFunc
test/stack-simple/default.nixnew file+35
@@ -0,0 +1,35 @@
1+{ stdenv, mkStackPkgSet }:
2+
3+with stdenv.lib;
4+
5+let
6+ # ./stack-pkgs.nix and ./.stack.nix/stack-simple are
7+ # generated by running hpack then stack-to-nix.
8+ pkgSet = mkStackPkgSet {
9+ stack-pkgs = import ./stack-pkgs.nix;
10+ pkg-def-overlays = [];
11+ modules = [];
12+ };
13+
14+ packages = pkgSet.config.hsPkgs;
15+
16+in
17+ stdenv.mkDerivation {
18+ name = "stack-simple-test";
19+
20+ buildCommand = ''
21+ exe="${packages.stack-simple.components.exes.stack-simple-exe}/bin/stack-simple-exe"
22+
23+ printf "checking whether executable runs... " >& 2
24+ $exe
25+
26+ touch $out
27+ '';
28+
29+ meta.platforms = platforms.all;
30+
31+ passthru = {
32+ # Attributes used for debugging with nix repl
33+ inherit pkgSet packages;
34+ };
35+ }
test/stack-simple/package.yamlnew file+48
@@ -0,0 +1,48 @@
1+name: stack-simple
2+version: 0.1.0.0
3+github: "githubuser/stack-simple"
4+license: BSD3
5+author: "Author name here"
6+maintainer: "example@example.com"
7+copyright: "2019 Author name here"
8+
9+extra-source-files:
10+- README.md
11+- ChangeLog.md
12+
13+# Metadata used when publishing your package
14+# synopsis: Short description of your package
15+# category: Web
16+
17+# To avoid duplicated efforts in documentation and dealing with the
18+# complications of embedding Haddock markup inside cabal files, it is
19+# common to point users to the README.md file.
20+description: Please see the README on GitHub at <https://github.com/githubuser/stack-simple#readme>
21+
22+dependencies:
23+- base >= 4.7 && < 5
24+
25+library:
26+ source-dirs: src
27+
28+executables:
29+ stack-simple-exe:
30+ main: Main.hs
31+ source-dirs: app
32+ ghc-options:
33+ - -threaded
34+ - -rtsopts
35+ - -with-rtsopts=-N
36+ dependencies:
37+ - stack-simple
38+
39+tests:
40+ stack-simple-test:
41+ main: Spec.hs
42+ source-dirs: test
43+ ghc-options:
44+ - -threaded
45+ - -rtsopts
46+ - -with-rtsopts=-N
47+ dependencies:
48+ - stack-simple
test/stack-simple/src/Lib.hsnew file+6
@@ -0,0 +1,6 @@
1+module Lib
2+ ( someFunc
3+ ) where
4+
5+someFunc :: IO ()
6+someFunc = putStrLn "someFunc"
test/stack-simple/stack-pkgs.nixnew file+5
@@ -0,0 +1,5 @@
1+{
2+ overlay = hackage:
3+ { packages = {} // { stack-simple = ./.stack.nix/stack-simple.nix; }; };
4+ resolver = "lts-13.6";
5+ }
test/stack-simple/stack-simple.cabalnew file+61
@@ -0,0 +1,61 @@
1+cabal-version: 1.12
2+
3+-- This file has been generated from package.yaml by hpack version 0.31.1.
4+--
5+-- see: https://github.com/sol/hpack
6+--
7+-- hash: 0df70dbda375296766e47fd09b809934bff5ee3edb5a16e93681d4cb37cef875
8+
9+name: stack-simple
10+version: 0.1.0.0
11+description: Please see the README on GitHub at <https://github.com/githubuser/stack-simple#readme>
12+homepage: https://github.com/githubuser/stack-simple#readme
13+bug-reports: https://github.com/githubuser/stack-simple/issues
14+author: Author name here
15+maintainer: example@example.com
16+copyright: 2019 Author name here
17+license: BSD3
18+build-type: Simple
19+extra-source-files:
20+ README.md
21+ ChangeLog.md
22+
23+source-repository head
24+ type: git
25+ location: https://github.com/githubuser/stack-simple
26+
27+library
28+ exposed-modules:
29+ Lib
30+ other-modules:
31+ Paths_stack_simple
32+ hs-source-dirs:
33+ src
34+ build-depends:
35+ base >=4.7 && <5
36+ default-language: Haskell2010
37+
38+executable stack-simple-exe
39+ main-is: Main.hs
40+ other-modules:
41+ Paths_stack_simple
42+ hs-source-dirs:
43+ app
44+ ghc-options: -threaded -rtsopts -with-rtsopts=-N
45+ build-depends:
46+ base >=4.7 && <5
47+ , stack-simple
48+ default-language: Haskell2010
49+
50+test-suite stack-simple-test
51+ type: exitcode-stdio-1.0
52+ main-is: Spec.hs
53+ other-modules:
54+ Paths_stack_simple
55+ hs-source-dirs:
56+ test
57+ ghc-options: -threaded -rtsopts -with-rtsopts=-N
58+ build-depends:
59+ base >=4.7 && <5
60+ , stack-simple
61+ default-language: Haskell2010
test/stack-simple/stack.yamlnew file+64
@@ -0,0 +1,64 @@
1+# This file was automatically generated by 'stack init'
2+#
3+# Some commonly used options have been documented as comments in this file.
4+# For advanced use and comprehensive documentation of the format, please see:
5+# https://docs.haskellstack.org/en/stable/yaml_configuration/
6+
7+# Resolver to choose a 'specific' stackage snapshot or a compiler version.
8+# A snapshot resolver dictates the compiler version and the set of packages
9+# to be used for project dependencies. For example:
10+#
11+# resolver: lts-3.5
12+# resolver: nightly-2015-09-21
13+# resolver: ghc-7.10.2
14+#
15+# The location of a snapshot can be provided as a file or url. Stack assumes
16+# a snapshot provided as a file might change, whereas a url resource does not.
17+#
18+# resolver: ./custom-snapshot.yaml
19+# resolver: https://example.com/snapshots/2018-01-01.yaml
20+resolver: lts-13.6
21+
22+# User packages to be built.
23+# Various formats can be used as shown in the example below.
24+#
25+# packages:
26+# - some-directory
27+# - https://example.com/foo/bar/baz-0.0.2.tar.gz
28+# - location:
29+# git: https://github.com/commercialhaskell/stack.git
30+# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
31+# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
32+# subdirs:
33+# - auto-update
34+# - wai
35+packages:
36+- .
37+# Dependency packages to be pulled from upstream that are not in the resolver
38+# using the same syntax as the packages field.
39+# (e.g., acme-missiles-0.3)
40+# extra-deps: []
41+
42+# Override default flag values for local packages and extra-deps
43+# flags: {}
44+
45+# Extra package databases containing global packages
46+# extra-package-dbs: []
47+
48+# Control whether we use the GHC we find on the path
49+# system-ghc: true
50+#
51+# Require a specific version of stack, using version ranges
52+# require-stack-version: -any # Default
53+# require-stack-version: ">=1.9"
54+#
55+# Override the architecture used by stack, especially useful on Windows
56+# arch: i386
57+# arch: x86_64
58+#
59+# Extra directories used by stack for building
60+# extra-include-dirs: [/path/to/dir]
61+# extra-lib-dirs: [/path/to/dir]
62+#
63+# Allow a newer minor version of GHC than the snapshot specifies
64+# compiler-check: newer-minor
test/stack-simple/test/Spec.hsnew file+2
@@ -0,0 +1,2 @@
1+main :: IO ()
2+main = putStrLn "Test suite not yet implemented"
test/with-packages/default.nix+2−7
@@ -1,15 +1,10 @@
1−{ pkgs
2−, haskell
3−, stdenv
4−, util
5−}:
1+{ stdenv, util, mkPkgSet }:
62
73with stdenv.lib;
84with util;
95
106let
11− pkgSet = haskell.mkPkgSet {
12− inherit pkgs;
7+ pkgSet = mkPkgSet {
138 # generated with:
149 # cabal new-build
1510 # plan-to-nix dist-newstyle/cache/plan.json > plan.nix