With nix-env -iA nixpkgs.haskellPackages.postgrest I get the following:
Configuring postgrest-0.3.2.0...
Setup: Encountered missing dependencies:
bytestring-tree-builder ==0.2.7,
hasql ==0.19.12,
hasql-transaction ==0.4.5,
postgresql-binary ==0.9.0.1
builder for ‘/nix/store/kskmdp16snn3bnp9nc8grdnqwln5m5fr-postgrest-0.3.2.0.drv’ failed with exit code 1
error: build of ‘/nix/store/kskmdp16snn3bnp9nc8grdnqwln5m5fr-postgrest-0.3.2.0.drv’ failed
Let me know if this is just a simple cabal2nix and a bump, otherwise I'll try to package it up myself.
I've actually never made a Nix package and would appreciate your advice/assistance.
@begriffs https://github.com/NixOS/nixpkgs/pull/20884
That is just a workaround. The proper solution is to update your .cabal in Hackage (and bump the rest of package if possible?) and test on a fresh cabal2nix expression. Then we can remove that cruft and let Nixpkgs Just-Do-Its-Work.
Sounds good. Let's figure that out after the 0.4 release.
We use the PostgREST nix package as well and would like to see the constraint fixed.
Are you expecting to do this after v0.4?
https://github.com/NixOS/nixpkgs/pull/20884
Any help on fixing it or making it more tobust would be appreciated.
On Sat, Dec 31, 2016, 20:49 Theodore Witkamp notifications@github.com
wrote:
We use the PostgREST nix package as well and would like to see the
constraint fixed.
Are you expecting to do this after v0.4?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/begriffs/postgrest/issues/756#issuecomment-269889187,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAK5DDYHzL3JADyGPjRXTfeuc8Gbqb5Iks5rNwY0gaJpZM4LDDXG
.
I released 0.4 binaries and pushed the cabal file to hackage. Is there something else I need to do inside the cabal file?
I don't know about darwin but I have managed to build posgrest on linux with nix.
To make it work, you need to use the nixpkgs unstable channel. If you don't wait a couple of days, you might need to "import" this fix: https://github.com/NixOS/nixpkgs/commit/f08bbb90c0e55a7e36751d0d139fd16bd47af58f
I have a release.nix file that looks like this:
{ supportedSystems ? [ "x86_64-linux"] }:
with (import <nixpkgs/pkgs/top-level/release-lib.nix> { inherit supportedSystems; });
with (import <nixpkgs/pkgs/development/haskell-modules/lib.nix> { inherit pkgs; });
let hpkgs = pkgs.haskellPackages;
swagger2 = dontHaddock hpkgs.swagger2;
in
{
postgrest = pkgs.lib.hydraJob (dontCheck (hpkgs.callPackage ./. {inherit swagger2 ;}));
}
You can try it using this command: nix-build -A postgrest release.nix
I haven't managed to get the test suite working as part of the nix build because the dependencies on psql isn't registered anywhere. I don't know how to make that work.
Haddock on swagger2 is failing because of a bug that is fixed in ghc-8.0.2. Nix will switch to ghc-8.0.2 as soon as LTS-8 is released.
@begriffs what needs to be done in the postgrest cabal file is to declare the system dependency on I don't know how or if it is possible to have the test suite running on Hydra. It is actually disable on psql for the test suite.nixpkgs so ...
Any help concerning the test suite would be appreciated.
Anyhow I believe the next thing I can do is a PR on nixpkgs to re-enable the automatic hydra build for postgrest in a couple of days. That would make postgrest available in the nix binary cache (which is quite handy).
As an extra note, I guess the process will fail again when nix will switch to LTS-8 (in a week or so) because of the constraint on optparse-applicative (#778).
Either a patch will need to be sent to nixpkgs or the constraint has to be removed.
If the psql dependency causes a lot of problems we could have Haskell run the sql commands directly. Pretty easy to do in SpecHelper.hs, a little harder in create_test_db and destroy_test_db because they would need to be rewritten in Haskell.
all haskell libs will still require libpq which essentially is the same thing as requiring psql, might as well keep it simple
@PierreR I ran into the same issue with swagger2 (dontHaddock). Can you review/check out the PR on linux?
@tomberek can you try again using nixpkgs from the master branch ?
Several of our latest contributors(non-nix users) have also noted difficulties when trying to run the test suite, so after the next release I'm going to simplify this process. Possibly using pg_tmp which is available on nixpkgs.
After this maybe we could make postgrest work well with nix and release an official package, I'll require some help though since I'm no expert(I've started to use NixOS recently).
With https://github.com/NixOS/nixpkgs/pull/85206 and https://github.com/NixOS/nixpkgs/pull/85230 it should soon be possible to install PostgREST 7.0.0 with nix-env -iA haskellPackages.postgrest! :-) It already works locally for me on the patched branch.
To build the project and run the test suite locally and in CI we should add a default.nix and/or shell.nix to the root of the repository. I'm tying to put something together with cabal2nix, cabal-install, ghcWithPackages etc. We could use that setup in parallel to the current stack solution for a bit, also in CI, and see how useful it is - what do you think?
@monacoremo That would be great! Please do.
Thanks to @monacoremo is now possible to build and test PostgREST with Nix!
For more details, check nix/README.md.
Most helpful comment
Several of our latest contributors(non-nix users) have also noted difficulties when trying to run the test suite, so after the next release I'm going to simplify this process. Possibly using pg_tmp which is available on nixpkgs.
After this maybe we could make postgrest work well with nix and release an official package, I'll require some help though since I'm no expert(I've started to use NixOS recently).