diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 00a0aff3f..e90a50fe2 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -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" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c9381c7b2..028e995ba 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fc2180321..bff6048ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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: @@ -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 diff --git a/NixSupport/shell.nix b/NixSupport/shell.nix deleted file mode 100644 index 9deb0af51..000000000 --- a/NixSupport/shell.nix +++ /dev/null @@ -1,60 +0,0 @@ -let - pkgs = import ./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 - pkgs.stdenv.mkDerivation { - name = "app"; - src = ./../.; - buildInputs = [haskellDeps pkgs.entr]; - shellHook = "eval $(egrep ^export ${haskellDeps}/bin/ghc)"; - } diff --git a/Test/Main.hs b/Test/Main.hs index db89e380e..63fa4eda3 100644 --- a/Test/Main.hs +++ b/Test/Main.hs @@ -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 diff --git a/shell.nix b/shell.nix index 5f4a2f492..095e1ad08 100644 --- a/shell.nix +++ b/shell.nix @@ -1,65 +1,60 @@ -{ nixpkgs ? import {}, 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)"; + }