This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2849e83
commit a5689b6
Showing
3 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# This shell file provides a compiler, build tools and system | ||
# libraries, and lets Cabal build all of the Haskell package | ||
# dependencies. | ||
# | ||
# The default shell (../shell.nix) uses the Haskell.nix shellFor to | ||
# also provide Haskell package dependencies in the shell environment. | ||
|
||
{ pkgs ? import ./default.nix {} | ||
# optional string argument to override compiler, e.g. | ||
# nix-shell nix/cabal-shell.nix --argstr compiler ghc8102 | ||
, compiler ? null | ||
}: | ||
|
||
with pkgs; | ||
|
||
mkShell rec { | ||
name = "offchain-metadata-tools-cabal-env"; | ||
meta.platforms = lib.platforms.unix; | ||
|
||
ghc = if (compiler == null) | ||
then offchainMetadataToolsHaskellPackages.metadata-lib.project.pkg-set.config.ghc.package | ||
else haskell-nix.compiler.${compiler}; | ||
|
||
tools = [ | ||
ghc | ||
cabal-install | ||
nix | ||
pkgconfig | ||
] | ||
++ lib.optional (!stdenv.isDarwin) git; | ||
|
||
libs = [ | ||
zlib | ||
gmp | ||
ncurses | ||
lzma | ||
openssl | ||
libsodium | ||
] | ||
++ lib.optional (stdenv.hostPlatform.libc == "glibc") glibcLocales | ||
++ lib.optional stdenv.isLinux systemd.dev | ||
++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ | ||
Cocoa CoreServices libcxx libiconv | ||
]); | ||
|
||
buildInputs = tools ++ libs; | ||
|
||
# allow building the shell so that it can be cached in hydra | ||
phases = ["nobuildPhase"]; | ||
nobuildPhase = "echo '${lib.concatStringsSep "\n" buildInputs}' > $out"; | ||
preferLocalBuild = true; | ||
|
||
# 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"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# This is the derivation used by "stack --nix". | ||
# It provides the system dependencies required for a stack build. | ||
{ pkgs ? import ./default.nix {} | ||
}: | ||
|
||
let | ||
cabalShell = import ./cabal-shell.nix { | ||
inherit pkgs; | ||
}; | ||
in | ||
cabalShell.overrideAttrs (old: { | ||
name = "offchain-metadata-tools-stack-env"; | ||
|
||
buildInputs = old.buildInputs ++ [ pkgs.stack ]; | ||
|
||
# Build environment setup copied from | ||
# <nixpkgs/pkgs/development/haskell-modules/generic-stack-builder.nix> | ||
GIT_SSL_CAINFO = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; | ||
STACK_IN_NIX_SHELL = "true"; | ||
}) |