Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hasura: init at 1.2.1 #75527

Merged
merged 1 commit into from May 7, 2020
Merged

hasura: init at 1.2.1 #75527

merged 1 commit into from May 7, 2020

Conversation

offlinehacker
Copy link
Contributor

@offlinehacker offlinehacker commented Dec 11, 2019

About

This package is based on https://github.com/input-output-hk/cardano-explorer/tree/master/nix/nixos/graphql-engine who should also get most of the credit

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @ivan @domenkozar

@offlinehacker offlinehacker changed the title hasura: init at 1.0.0-rc.1 [Draft] hasura: init at 1.0.0-rc.1 Dec 11, 2019
@ofborg ofborg bot requested a review from ehmry December 11, 2019 21:16
@offlinehacker offlinehacker marked this pull request as ready for review December 12, 2019 13:18
@offlinehacker offlinehacker changed the title [Draft] hasura: init at 1.0.0-rc.1 hasura: init at 1.0.0-rc.1 Dec 12, 2019
@offlinehacker
Copy link
Contributor Author

Everything works as expected now. To test it locally:

nix-env -iA postgresql hasura-graphql-engine hasura-cli
mkdir -p postgres
initdb -D $PWD/hasuradb -A md5 -U root -W
postgres -D $PWD/hasuradb -k $PWD
createdb -h localhost hasura
graphql-engine --database-url=postgres://root:pass@localhost:5432/hasura serve
hasura console

pkgs/servers/hasura/cli.nix Outdated Show resolved Hide resolved
pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
@offlinehacker offlinehacker changed the title hasura: init at 1.0.0-rc.1 hasura: init at 1.0.0 Dec 19, 2019
@offlinehacker
Copy link
Contributor Author

Updated to version 1.0.0, which was just released :)

@offlinehacker
Copy link
Contributor Author

Can confirm version 1.0.0 working locally.

@elohmeier
Copy link
Contributor

After rebasing onto master (0e6ceb8 as of writing) the build for graphql-engine fails:

Building library for graphql-engine-1.0.0..
...
[ 54 of 145] Compiling Hasura.HTTP      ( src-lib/Hasura/HTTP.hs, dist/build/Hasura/HTTP.o )
[ 55 of 145] Compiling Hasura.Server.CheckUpdates ( src-lib/Hasura/Server/CheckUpdates.hs, dist/build/Hasura/Server/CheckUpdates.o )
[ 56 of 145] Compiling Network.URI.Extended ( src-lib/Network/URI/Extended.hs, dist/build/Network/URI/Extended.o )

src-lib/Network/URI/Extended.hs:29:10: error:
    Duplicate instance declarations:
      instance Lift URI
        -- Defined at src-lib/Network/URI/Extended.hs:29:10
      instance [safe] Lift URI -- Defined in ‘Network.URI’
   |
29 | instance Lift URI
   |          ^^^^^^^^

builder for '/nix/store/5hb8n3ybiaffr0wjs17j4nilkasg3qqi-graphql-engine-1.0.0.drv' failed with exit code 1

I was able to build and run (on your branch) before rebasing successfully.

@bram209
Copy link

bram209 commented Feb 23, 2020

I would like to use this, is there anything I can do to help getting this PR merged?

@domenkozar
Copy link
Member

@GrahamcOfBorg build hasura-cli

@domenkozar
Copy link
Member

@offlinehacker could you rebase?

@offlinehacker offlinehacker changed the title hasura: init at 1.0.0 hasura: init at 1.1.1 Mar 31, 2020
@offlinehacker
Copy link
Contributor Author

Ok, this was quite a challenge, but was able to update to 1.1.1 and rebase package. I had learned quite a bit about haskell packaging, and also described in default.nix how i generated some files. It's still quite a manual process to get all the versions right, but i think (and hope) it should not break on update of haskell packages.

I can confirm that executables run, but i did not do any additional testing yet. So if someone has time it would be nice to check if everything works as expected.

@offlinehacker
Copy link
Contributor Author

@GrahamcOfBorg build hasura-graphql-engine hasura-cli

@ofborg ofborg bot requested a review from kalbasit April 1, 2020 00:47
@elohmeier
Copy link
Contributor

Thanks for the updated PR, @offlinehacker. I've just tested the graphql-engine and the hasura console with a development project, everything works as expected.

@domenkozar
Copy link
Member

I didn't have time to dig in, but those package should be coming from haskellPackages unless they are not on hackage. @offlinehacker did you check?

@offlinehacker
Copy link
Contributor Author

@domenkozar the problem is hasura is quite picky about some package versions(or it does not build) and haskellPackages only have one version, so for all version constrained dependencies that require older versions, I cannot use one from haskellPackages. This also seems one of limitation of haskellPackages, as it asumes only one version of package. Regardless of that I still managed to build hasura, but is not completely automated process, as alternative would probably generate a large file with dependencies, and that's not desirable in nixpkgs, which are already polluted with large auto generated files. Also three packages used by hasura are not on hackage.

pkgs/servers/hasura/graphql-engine.nix Outdated Show resolved Hide resolved
@offlinehacker
Copy link
Contributor Author

I will rebase and rebuild tomorrow, if everything still works let's merge.

@offlinehacker offlinehacker changed the title hasura: init at 1.1.1 hasura: init at 1.2.1 May 7, 2020
@offlinehacker
Copy link
Contributor Author

Updated to 1.2.1 and tested locally, everything seems to work. I will merge after @GrahamcOfBorg builds pass.

@offlinehacker
Copy link
Contributor Author

@GrahamcOfBorg build hasura-graphql-engine hasura-cli

@offlinehacker offlinehacker merged commit 2c58b1d into NixOS:master May 7, 2020
@hgiasac
Copy link

hgiasac commented May 30, 2020

@offlinehacker Several things need to be changed:

  • New Hasura CLI (from 1.2.0) has extension plugin that is installed into ~/.hasura/plugins/bin/hasura-cli_ext when run hasura. This breaking change is due to new feature of v2 migration and action plugins.

This extension binary requires libstdc++.so.6 library.

ldd ~/.hasura/plugins/bin/hasura-cli_ext

linux-vdso.so.1 (0x00007ffd2cbeb000)
        libdl.so.2 => /nix/store/nwsn18fysga1n5s0bj4jp4wfwvlbx8b1-glibc-2.30/lib/libdl.so.2 (0x00007f42c6e18000)
        librt.so.1 => /nix/store/nwsn18fysga1n5s0bj4jp4wfwvlbx8b1-glibc-2.30/lib/librt.so.1 (0x00007f42c6e0e000)
        libstdc++.so.6 => not found
        libm.so.6 => /nix/store/nwsn18fysga1n5s0bj4jp4wfwvlbx8b1-glibc-2.30/lib/libm.so.6 (0x00007f42c6cce000)
        libgcc_s.so.1 => /nix/store/nwsn18fysga1n5s0bj4jp4wfwvlbx8b1-glibc-2.30/lib/libgcc_s.so.1 (0x00007f42c6cb4000)
        libpthread.so.0 => /nix/store/nwsn18fysga1n5s0bj4jp4wfwvlbx8b1-glibc-2.30/lib/libpthread.so.0 (0x00007f42c6c93000)
        libc.so.6 => /nix/store/nwsn18fysga1n5s0bj4jp4wfwvlbx8b1-glibc-2.30/lib/libc.so.6 (0x00007f42c6ad2000)
        /lib64/ld-linux-x86-64.so.2 => /nix/store/nwsn18fysga1n5s0bj4jp4wfwvlbx8b1-glibc-2.30/lib64/ld-linux-x86-64.so.2 (0x00007f42c6e1f000)

The CLI still works with SQL migrations, but metadata doesn't. New commands such as action generator don't work too

@mrkkrp
Copy link
Member

mrkkrp commented Jul 21, 2020

The packages have been removed from nixpkgs in 0085709. :-|

@domenkozar
Copy link
Member

That went exactly as I expected :)

@offlinehacker
Copy link
Contributor Author

offlinehacker commented Jul 21, 2020

@domenkozar well it was best effort to package hasura, with what we have in nixpkgs. I was ready for other suggestions, but Haskell packaging facility in nixpkgs does not seem to be ready to package more complex packages. In fact according to my observations also other Haskell packages in nixpkgs break many times.

@domenkozar
Copy link
Member

My comment wasn't mean to criticize your work, quite on the contrary I think it's a shame that it didn't turn out differently.

I propose to package with haskell.nix and cachix, just as I did with https://github.com/cachix/ghcide-nix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants