From 9f7560d25b01dbc037acadc3a4e4f3778169839d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac=20Jacqu=C3=A9?= Date: Fri, 20 Dec 2019 10:29:26 +0100 Subject: [PATCH] shell repro --- README.md | 40 +++----------------------------------- cabal.project | 3 ++- dummy-app/app/dummy-app.hs | 2 +- shell.nix | 15 ++++++++++++++ 4 files changed, 21 insertions(+), 39 deletions(-) create mode 100644 shell.nix diff --git a/README.md b/README.md index 09aa56c..adbe03f 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,5 @@ # `haskell-nix.cabalProject` bug minimal repro -1. Clone this repo. -2. Run `nix build -f . dummy-app.components.exes.dummy-app`. - -Expected output: - -``` -trace: Using latest index state! -trace: Using index-state: 2019-12-14T00:00:00Z -builder for '/nix/store/g5023y5h06iy1bj076zzaaza0v8c80w3-plan-to-nix-pkgs.drv' failed with exit code 128; last 2 log lines: - Cloning into '/build/tmp.UZdw0uapal/dist-newstyle/src/canonical_-1f90751276f12f5a'... - fatal: unable to access 'http://github.com/well-typed/canonical-json/': Could not resolve host: github.com -[1 built (1 failed), 0.0 MiB DL] -error: build of '/nix/store/g5023y5h06iy1bj076zzaaza0v8c80w3-plan-to-nix-pkgs. -``` - -Out of curiosity, I tried to disable the sandbox to see whether the build would succeed without it: - -``` -nix build -f . dummy-app.components.exes.dummy-app --option sandbox false -trace: Using latest index state! -trace: Using index-state: 2019-12-14T00:00:00Z -builder for '/nix/store/g5023y5h06iy1bj076zzaaza0v8c80w3-plan-to-nix-pkgs.drv' failed with exit code 128; last 9 log lines: - Cloning into '/tmp/nix-build-plan-to-nix-pkgs.drv-0/tmp.GquFxkVGQR/dist-newstyle/src/canonical_-1f90751276f12f5a'... - warning: redirecting to https://github.com/well-typed/canonical-json/ - remote: Enumerating objects: 4, done. - remote: Counting objects: 100% (4/4), done. - remote: Compressing objects: 100% (4/4), done. - remote: Total 130 (delta 0), reused 1 (delta 0), pack-reused 126 - Receiving objects: 100% (130/130), 582.22 KiB | 1.43 MiB/s, done. - Resolving deltas: 100% (51/51), done. - fatal: invalid reference: ddfe3593b80b5ceb88842bb7a6f2268df75d2c2fpackages: -[0 built (1 failed)] -error: build of '/nix/store/g5023y5h06iy1bj076zzaaza0v8c80w3-plan-to-nix-pkgs.drv' failed -(use '--show-trace' to show detailed location information) -``` - -Seems like something else is wrong here. +- `nix build -f . dummy-app.components.exes.dummy-app` succeeds. +- `cabal new-build` tries to fetch the `canonical` repo instead of + using the one cached in the `ghc-pkg` repo. diff --git a/cabal.project b/cabal.project index e5b4562..1e18276 100644 --- a/cabal.project +++ b/cabal.project @@ -7,4 +7,5 @@ package dummy-app source-repository-package type: git location: http://github.com/well-typed/canonical-json - tag: ddfe3593b80b5ceb88842bb7a6f2268df75d2c2f \ No newline at end of file + tag: ddfe3593b80b5ceb88842bb7a6f2268df75d2c2f + --sha256: 02fzn1xskis1lc1pkz0j92v6ipd89ww0k2p3dvwpm3yap5dpnm7k diff --git a/dummy-app/app/dummy-app.hs b/dummy-app/app/dummy-app.hs index e9e1deb..377b6b5 100644 --- a/dummy-app/app/dummy-app.hs +++ b/dummy-app/app/dummy-app.hs @@ -1,2 +1,2 @@ main :: IO () -main = undefined +main = return () diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..e9c836b --- /dev/null +++ b/shell.nix @@ -0,0 +1,15 @@ +let + lib = import ./nix/lib.nix; + pkgs = lib.pkgs; + hsPkgs = import ./default.nix { }; +in +hsPkgs.shellFor { + packages = ps: with ps; [ + dummy-app + ]; + withHoogle = true; + buildInputs = with pkgs.haskellPackages; + [ hlint stylish-haskell ghcid lib.niv lib.pkgs.haskell-nix.cabal-install ]; + exactDeps = true; + +}