Merge pull request #73362 from Infinisil/buildStackProjectChroot

buildStackProject: Set __noChroot to make it fail without sandbox
This commit is contained in:
Dennis Gosnell 2019-11-14 11:51:43 +09:00 committed by GitHub
commit d0c73e88b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -398,7 +398,9 @@ nix:
For more on how to write a `shell.nix` file see the below section. You'll need For more on how to write a `shell.nix` file see the below section. You'll need
to express a derivation. Note that Nixpkgs ships with a convenience wrapper to express a derivation. Note that Nixpkgs ships with a convenience wrapper
function around `mkDerivation` called `haskell.lib.buildStackProject` to help you function around `mkDerivation` called `haskell.lib.buildStackProject` to help you
create this derivation in exactly the way Stack expects. All of the same inputs create this derivation in exactly the way Stack expects. However for this to work
you need to disable the sandbox, which you can do by using `--option sandbox relaxed`
or `--option sandbox false` to the Nix command. All of the same inputs
as `mkDerivation` can be provided. For example, to build a Stack project that as `mkDerivation` can be provided. For example, to build a Stack project that
including packages that link against a version of the R library compiled with including packages that link against a version of the R library compiled with
special options turned on: special options turned on:

View File

@ -20,6 +20,10 @@ let
in stdenv.mkDerivation (args // { in stdenv.mkDerivation (args // {
# Doesn't work in the sandbox. Pass `--option sandbox relaxed` or
# `--option sandbox false` to be able to build this
__noChroot = true;
buildInputs = buildInputs buildInputs = buildInputs
++ lib.optional (stdenv.hostPlatform.libc == "glibc") glibcLocales; ++ lib.optional (stdenv.hostPlatform.libc == "glibc") glibcLocales;