Skip to content

Commit

Permalink
Moved NixSupport/shell.nix to the IHP root shell.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Oct 23, 2020
1 parent 6643a08 commit 5044d71
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
cd $GITHUB_WORKSPACE
mkdir -p ~/.config/nixpkgs
echo "{ allowBroken = true; }" >> ~/.config/nixpkgs/config.nix
nix-shell NixSupport/shell.nix --run "cabal build"
nix-shell --run "cabal build"
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
name: digitallyinduced
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix-shell ./NixSupport/shell.nix --run "runghc $(make -f lib/IHP/Makefile.dist print-ghc-extensions) Test/Main.hs"
- run: nix-shell --run "runghc $(make -f lib/IHP/Makefile.dist print-ghc-extensions) Test/Main.hs"
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ To work on the documentation locally open a nix shell inside the framework direc

```
cd IHP
nix-shell NixSupport/shell.nix
nix-shell
```

Then switch to the `Guide` directory:
Expand Down Expand Up @@ -104,7 +104,7 @@ The documentation reads a bit like a tutorial, but should still be kept somewhat
When inside the IHP directory, you can run the Test Suite by loading it into a `ghci` like this:

```bash
nix-shell NixSupport/shell.nix
nix-shell
ghci
:l Test/Main.hs
main
Expand Down
60 changes: 0 additions & 60 deletions NixSupport/shell.nix

This file was deleted.

2 changes: 1 addition & 1 deletion Test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Copyright: (c) digitally induced GmbH, 2020
When in the IHP directory, you can run this file like:
> nix-shell NixSupport/shell.nix
> nix-shell
> ghci
> :l Test/Main.hs
> main
Expand Down
121 changes: 58 additions & 63 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,65 +1,60 @@
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:

let

inherit (nixpkgs) pkgs;

f = { mkDerivation, aeson, async, attoparsec, base, basic-prelude
, blaze-html, blaze-markup, bytestring, case-insensitive
, classy-prelude, clientsession, containers, cookie
, countable-inflections, data-default, directory, fsnotify
, ghc-prim, haskell-src-exts, haskell-src-meta, http-client
, http-media, http-types, inflections, interpolate, megaparsec, mtl
, network, network-uri, newtype-generics, postgresql-simple
, process, pwstore-fast, random-strings, split, stdenv
, string-conversions, template-haskell, text, time, typerep-map
, unix, unliftio, uuid, vault, wai, wai-extra
, wai-middleware-static, wai-session, wai-session-clientsession
, wai-util, wai-websockets, warp, websockets
}:
mkDerivation {
pname = "ihp";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
libraryHaskellDepends = [
aeson async attoparsec base basic-prelude blaze-html blaze-markup
bytestring case-insensitive classy-prelude clientsession containers
cookie countable-inflections data-default directory ghc-prim
haskell-src-exts haskell-src-meta http-client http-media http-types
inflections interpolate megaparsec mtl network-uri newtype-generics
postgresql-simple process pwstore-fast random-strings split
string-conversions template-haskell text time typerep-map uuid
vault wai wai-extra wai-middleware-static wai-session
wai-session-clientsession wai-util warp
];
executableHaskellDepends = [
aeson async attoparsec base basic-prelude blaze-html blaze-markup
bytestring case-insensitive classy-prelude clientsession containers
cookie countable-inflections data-default directory fsnotify
ghc-prim haskell-src-exts haskell-src-meta http-client http-media
http-types inflections interpolate megaparsec mtl network
network-uri newtype-generics postgresql-simple process
pwstore-fast random-strings split string-conversions
template-haskell text time typerep-map unix unliftio uuid vault wai
wai-extra wai-middleware-static wai-session
wai-session-clientsession wai-util wai-websockets warp websockets
];
doHaddock = false;
description = "Haskell Web Framework";
license = stdenv.lib.licenses.unfree;
hydraPlatforms = stdenv.lib.platforms.none;
};

haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};

variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;

drv = variant (haskellPackages.callPackage f {});

pkgs = import ./NixSupport/pkgs.nix;
ghc = pkgs.haskell.packages.ghc883;
haskellDeps = ghc.ghcWithPackages (p: with p; [
cabal-install
base
classy-prelude
directory
string-conversions
warp
wai
mtl
blaze-html
blaze-markup
wai-extra
http-types
inflections
text
postgresql-simple
wai-middleware-static
wai-util
http-client
aeson
uuid
wai-session
wai-session-clientsession
clientsession
pwstore-fast
template-haskell
haskell-src-meta
random-strings
interpolate
uri-encode
websockets
wai-websockets
mime-mail
mime-mail-ses
attoparsec
case-insensitive
http-media
cookie
process
newtype-generics
unix
fsnotify
countable-inflections
typerep-map
mmark-cli
data-default
hspec
regex-tdfa
resource-pool
]);
in

if pkgs.lib.inNixShell then drv.env else drv
pkgs.stdenv.mkDerivation {
name = "app";
src = ./../.;
buildInputs = [haskellDeps pkgs.entr];
shellHook = "eval $(egrep ^export ${haskellDeps}/bin/ghc)";
}

0 comments on commit 5044d71

Please sign in to comment.