Skip to content

Commit

Permalink
Use shell.nix from hydra-poc
Browse files Browse the repository at this point in the history
The shellFor function used before seem to try to do too much, and set
up some specific settings in ghc and ghci. hydra-poc's shell.nix is
somewhat more standard.
  • Loading branch information
abailly-iohk committed May 4, 2021
1 parent 74271e4 commit 4dd4154
Showing 1 changed file with 58 additions and 29 deletions.
87 changes: 58 additions & 29 deletions shell.nix
@@ -1,37 +1,66 @@
# shell.nix
{ pkgs ? import <nixpkgs> { } }:
# A very simple shell.nix file for setting up necessary build tools. This is
# likely going to be updated using the iohk-specific nixpkgs and a haskel.nix
# derivation of our cabal.project.
{ compiler ? "ghc8104"
# Latest haskell.nix for more likely cache hits
, haskellNix ? import
(builtins.fetchTarball
"https://github.com/input-output-hk/haskell.nix/archive/abb289ff961fb1bd98eb0340088c432f15109807.tar.gz")
{ }
# Use same pkgs as haskell.nix for more likely cache hits
, nixpkgsSrc ? haskellNix.sources.nixpkgs-2009
, nixpkgsArgs ? haskellNix.nixpkgsArgs
, pkgs ? import nixpkgsSrc nixpkgsArgs
# Use cardano-node master for more likely cache hits
}:
with pkgs;
let
hsPkgs = import ./default.nix { };
hls = haskell-nix.tool compiler "haskell-language-server" "latest";
ghc = haskell-nix.compiler.${compiler};
fourmolu = haskell-nix.tool compiler "fourmolu" "latest";
cabal-plan = pkgs.haskellPackages.cabal-plan ;
ghcid = pkgs.haskellPackages.ghcid ;
hspec-discover = pkgs.haskellPackages.hspec-discover ;
libsodium-vrf = libsodium.overrideAttrs (oldAttrs: {
name = "libsodium-1.0.18-vrf";
src = fetchFromGitHub {
owner = "input-output-hk";
repo = "libsodium";
# branch tdammers/rebased-vrf
rev = "66f017f16633f2060db25e17c170c2afa0f2a8a1";
sha256 = "12g2wz3gyi69d87nipzqnq4xc6nky3xbmi2i2pb2hflddq8ck72f";
};
nativeBuildInputs = [ autoreconfHook ];
configureFlags = "--enable-static";
});
in
hsPkgs.shellFor {
# Include only the *local* packages of your project.
packages = ps: with ps; [
hydra-sim
];

# Builds a Hoogle documentation index of all dependencies,
# and provides a "hoogle" command to search the index.
# withHoogle = true;

# You might want some extra tools in the shell (optional).

# Some common tools can be added with the `tools` argument
tools = {
cabal = "3.2.0.0";
hlint = "latest";
haskell-language-server = "latest";
ormolu = "latest";
};
# See overlays/tools.nix for more details
mkShell rec {
name = "hydra-sim-env";

# Some you may need to get some other way.
buildInputs = with pkgs.haskellPackages; [
tools = [
cabal-install
fourmolu
ghcid
ghc
hls
cabal-plan
# needed for HLS to work properly, see https://github.com/haskell/haskell-language-server/issues/176
hspec-discover
# For discovering libs (below)
pkgconfig
];

# Setting it to true prevents cabal from choosing alternate plans, so that
# *all* dependencies are provided by Nix.
# However, this breaks hspec-discover so ¯\_(ツ)_/¯
exactDeps = false;
libs = [
libsodium-vrf
zlib
];

buildInputs = tools ++ libs;

# Ensure that libz.so and other libraries are available to TH splices.
LD_LIBRARY_PATH = lib.makeLibraryPath libs;

# Force a UTF-8 locale because many Haskell programs and tests
# assume this.
LANG = "en_US.UTF-8";
}

0 comments on commit 4dd4154

Please sign in to comment.