diff --git a/scripts/check-nix-is-updated.sh b/scripts/check-nix-is-updated.sh index a796b13..c7cb216 100755 --- a/scripts/check-nix-is-updated.sh +++ b/scripts/check-nix-is-updated.sh @@ -11,6 +11,6 @@ fail_stack2nix_check() { exit 1 } -\time ~/.local/bin/stack2nix --hackage-snapshot 2018-09-04T08:56:04Z . > $scriptDir/../stack2nix.nix +\time /usr/bin/env stack2nix --hackage-snapshot 2018-09-04T08:56:04Z . > $scriptDir/../stack2nix.nix git diff --text --exit-code || fail_stack2nix_check diff --git a/src/Stack2nix/External/Stack.hs b/src/Stack2nix/External/Stack.hs index d136107..e75f612 100644 --- a/src/Stack2nix/External/Stack.hs +++ b/src/Stack2nix/External/Stack.hs @@ -59,12 +59,19 @@ import System.Directory (canonicalizePat import System.FilePath (makeRelative, ()) import Text.PrettyPrint.HughesPJClass (Doc) +import System.Environment (lookupEnv) data PackageRef = HackagePackage PackageIdentifierRevision | NonHackagePackage PackageIdentifier (PackageLocation FilePath) deriving (Eq, Show) +getStackRoot :: IO String +getStackRoot = fromMaybe defaultStackRoot <$> lookupEnv stackRootEnv + where + stackRootEnv = "S2N_STACK_ROOT" + defaultStackRoot = "/tmp/s2n" + genNixFile :: Args -> Version -> FilePath -> Maybe String -> Maybe String -> DB.HackageDB -> PackageRef -> IO (Either Doc Derivation) genNixFile args ghcVersion baseDir uri argRev hackageDB pkgRef = do cwd <- getCurrentDirectory @@ -143,7 +150,7 @@ runPlan :: FilePath -> Args -> IO () runPlan baseDir remoteUri args@Args{..} = do - let stackRoot = "/tmp/s2n" + stackRoot <- getStackRoot createDirectoryIfMissing True stackRoot let globals = globalOpts baseDir stackRoot args let stackFile = baseDir argStackYaml diff --git a/stack2nix.nix b/stack2nix.nix index c6d1b2c..818896c 100644 --- a/stack2nix.nix +++ b/stack2nix.nix @@ -1,4 +1,4 @@ -# Generated using stack2nix 0.2. +# Generated using stack2nix 0.2.1. { pkgs ? (import {}) , compiler ? pkgs.haskell.packages.ghc843 @@ -11,6 +11,7 @@ let self: { array = null; base = null; + bin-package-db = null; binary = null; bytestring = null; containers = null; @@ -6115,6 +6116,10 @@ inherit (pkgs.xorg) libXfixes;}; ]; doHaddock = false; doCheck = false; + preCheck = '' + export PATH="$PWD/dist/build/cabal2nix:$PATH" + export HOME="$TMPDIR/home" + ''; homepage = "https://github.com/nixos/cabal2nix#readme"; description = "Convert Cabal files into Nix build instructions"; license = stdenv.lib.licenses.bsd3; @@ -32586,7 +32591,7 @@ inherit (pkgs) libjpeg; inherit (pkgs) libpng; inherit (pkgs) zlib;}; }: mkDerivation { pname = "stack2nix"; - version = "0.2"; + version = "0.2.1"; src = ./.; configureFlags = [ "--ghc-option=-Werror" ]; isLibrary = true; @@ -39136,7 +39141,7 @@ inherit (pkgs) libjpeg; inherit (pkgs) libpng; inherit (pkgs) zlib;}; pname = "yaml"; version = "0.8.32"; sha256 = "dc20f863deb4ee75395bf1f78268781db76be6209af67b70c05f6e1a09f47a31"; - configureFlags = [ "-fsystem-libyaml" ]; + configureFlags = [ "-f-system-libyaml" ]; isLibrary = true; isExecutable = true; libraryHaskellDepends = [