PostgREST / postgrest

REST API for any Postgres database
https://postgrest.org
MIT License
23.38k stars 1.03k forks source link

4.3.0 fails to install using nixpkgs due to missing dependencies #1023

Closed ldesgoui closed 6 years ago

ldesgoui commented 6 years ago

Hello,

I forgot how to fix this, this happens on any recent nixpkgs channel.

$ nix-shell --pure
these derivations will be built:
  /nix/store/zdz6rmffbrxvknqlscfzdjbd6ivfnykd-postgrest-0.4.3.0.drv
building path(s) ‘/nix/store/6d6jkpb03m1vimsjqvlcyqi7f0nw4n99-postgrest-0.4.3.0’, ‘/nix/store/xl713jvfx3488a98ab7n2r8xnbjfw3fb-postgrest-0.4.3.0-doc’
setupCompilerEnvironmentPhase
Build with /nix/store/djbg4r4iaifl7lwc8wig18g9lm8zacqm-ghc-8.0.2.
unpacking sources
unpacking source archive /nix/store/1n8aw3v54q3w6w9pjcss0kjrrrr35zng-postgrest-0.4.3.0.tar.gz
source root is postgrest-0.4.3.0
setting SOURCE_DATE_EPOCH to timestamp 1504714141 of file postgrest-0.4.3.0/postgrest.cabal
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/tmp/nix-build-postgrest-0.4.3.0.drv-0/package.conf.d -j1 -threaded
[1 of 1] Compiling Main             ( Setup.hs, /tmp/nix-build-postgrest-0.4.3.0.drv-0/Main.o )
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/6d6jkpb03m1vimsjqvlcyqi7f0nw4n99-postgrest-0.4.3.0 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --docdir=/nix/store/xl713jvfx3488a98ab7n2r8xnbjfw3fb-postgrest-0.4.3.0-doc/share/doc --with-gcc=gcc --package-db=/tmp/nix-build-postgrest-0.4.3.0.drv-0/package.conf.d --ghc-option=-optl=-Wl,-rpath=/nix/store/6d6jkpb03m1vimsjqvlcyqi7f0nw4n99-postgrest-0.4.3.0/lib/ghc-8.0.2/postgrest-0.4.3.0 --ghc-option=-j1 --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-library-vanilla --enable-executable-dynamic --disable-tests --ghc-option=-split-sections
Configuring postgrest-0.4.3.0...
Setup: Encountered missing dependencies:
hasql-pool ==0.4.1, hasql-transaction ==0.5, protolude >=0.2
builder for ‘/nix/store/zdz6rmffbrxvknqlscfzdjbd6ivfnykd-postgrest-0.4.3.0.drv’ failed with exit code 1
error: build of ‘/nix/store/zdz6rmffbrxvknqlscfzdjbd6ivfnykd-postgrest-0.4.3.0.drv’ failed
/run/current-system/sw/bin/nix-shell: failed to build all dependencies
$ cat default.nix 
let
  hostPkgs = import <nixpkgs> {};
  nixpkgs = (hostPkgs.fetchFromGitHub {
    owner = "NixOS";
    repo = "nixpkgs-channels";
    rev = "45a85eacebf2181d2e12c0c1005bf3ba07583a74";
    sha256 = "1ksrjl897cq6j2b3h0s671sd626fbbf6sq87yvrl26wvyrrd7dz8";
  });
in
with import nixpkgs {};
stdenv.mkDerivation {
  name = "my-shell";
  buildInputs = [
        haskellPackages.postgrest
    ];
}
begriffs commented 6 years ago

Thanks for reporting. Probably happened when we bumped dependency versions or messed with the stack.yaml file. Could you try doing a git bisect to identify which commit broke it?

PierreR commented 6 years ago

@ldesgoui I don't believe this has anything to do with postgrest, do you ?

nixpkgs is using the stackage-lts and the missing reported dependencies are not on the current lts at the required version bound. You will need to override nixpkgs to fix this yourself (or/and send a PR to nixpkgs).

Using the nix overlays system, it is going to be something like this:

self: super:
{
  haskellPackages = super.haskellPackages.override {
    overrides =  hpkgs: _hpkgs: {
      postgrest = _hpkgs.postgrest.override {
        protolude= hpkgs.protolude_0_2;
        ...
      };
    };
  };
}
ldesgoui commented 6 years ago

I don't believe this has anything to do with postgrest, do you ?

I'm mostly ignorant on the subject.

I can't test right now, but if this is a solution and the fix should happen in nixpkgs rather than here, I think it's okay to close it, hopefully in the meanwhile, people looking for that issue will find this archived. I'll let @begriffs make the decision to close this issue.

Thanks!

begriffs commented 6 years ago

Sorry, I don't know much about the details of using Nix. What are the full steps to reproduce? Based on the issue description I'm assuming:

  1. Install nix, bash <(curl https://nixos.org/nix/install)
  2. Pull the latest postgrest master
  3. In the postgrest source root, run nix-shell --pure

Is that right?

steve-chavez commented 6 years ago

Let's continue the issue about building with nix in https://github.com/PostgREST/postgrest/issues/756.