-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
buildDunePackage: add support function and use it in a few packages #49684
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
Conversation
I can certainly backtrack of the src refactoring but I would find this pretty sad given that virtually all the dune packages that I refactored took their sources from GitHub. Furthermore, this setup makes it simpler for package maintainers to use the dune-release tarball if it is available (just set |
There could be a new fetcher for dune release tarballs. |
OK let's postpone this part then. |
@Mic92 I still do not know what you meant by "build hook" but the composability aspect might not be so important given how similar all dune packages are (and anyways, the current setup allows to override any given phase). |
OMG, this is horrible 😱 Don't count on me to imitate that 😉 |
Updated. This makes it a quite smaller refactoring (although I have updated even more packages). |
Where are these hooks coming from? Where is this documented? How is it different from |
Build phases are described in the stdenv documentation: https://nixos.org/nixpkgs/manual/#sec-stdenv-phases . It is not different from |
OK, I knew about this part of the doc but I had missed that this had to be run from the build phases themselves. Will update. |
Refactoring complete. Doc remains. |
The PR is ready now, and it includes the doc. It was quite time that OCaml got its section in the nixpkgs manual! |
minimumOCamlVersion = "4.01"; | ||
|
||
src = fetchurl { | ||
url = "https://github.com/flowtype/ocaml-${pname}/releases/download/v${version}/${pname}-${version}.tbz"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In future this could be solved with the following trick:
fetchDuneRelease {
url = "https://github.com/flowtype/ocaml-wtf8/releases/download/v${version}/ocaml-wtf8-${version}.tbz";
sha256 = "1msg3vycd3k8qqj61sc23qks541cxpb97vrnrvrhjnqxsqnh6ygq";
};
fetchDuneRelease = { url, ... } @args : fetchurl (args // {
url = "${url}#package.tar.bz2";
})
This would do the trick in the unpack phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative would be override the unpack phase of buildDunePackage to also learn this extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed but voluntarily left for future work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the examples. @vbgl any last comments?
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
CI had passed but an update to odoc meant that I had to rebase the PR and fix the conflicts. Can this PR get merged now? I would like to avoid having to rebase it once more. |
I’m very surprised you did not find any interesting issues with the |
I built all affected packages on Linux. Are there problems on other architectures? |
This might have been not included in the list as ocamlPackages are not recursed. $ nix-shell -p acgtk -p eff -p flow -p fstar -p google-drive-ocamlfuse -p jackline -p libbap -p liquidsoap -p ocaml-top -p ocamlformat -p patdiff -p pyre -p reason -p satysfi -p stog -p trv -p virt-top |
But also that one seems to work: $ nix-shell -p ocamlPackages.zmq
these derivations will be built:
/nix/store/scsiz53z9wyypkrrgndnmp747f477nd5-source.drv
/nix/store/kaxk9z132zkg7mn9j9yd5ah3f7v0d295-ocaml4.06.1-zmq-20180726.drv
these paths will be fetched (0.21 MiB download, 1.06 MiB unpacked):
/nix/store/5217m8ssa8n7x0vpw8ndxplwf72wqrxs-czmq-4.1.1
copying path '/nix/store/5217m8ssa8n7x0vpw8ndxplwf72wqrxs-czmq-4.1.1' from 'https://cache.nixos.org'...
building '/nix/store/scsiz53z9wyypkrrgndnmp747f477nd5-source.drv'...
trying https://github.com/issuu/ocaml-zmq/archive/d312a8458d6b688f75470248f11875fbbfa5bb1a.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 157 0 157 0 0 371 0 --:--:-- --:--:-- --:--:-- 370
100 30169 0 30169 0 0 30259 0 --:--:-- --:--:-- --:--:-- 30259
unpacking source archive /build/d312a8458d6b688f75470248f11875fbbfa5bb1a.tar.gz
building '/nix/store/kaxk9z132zkg7mn9j9yd5ah3f7v0d295-ocaml4.06.1-zmq-20180726.drv'...
unpacking sources
unpacking source archive /nix/store/24j11nwkl20f4v6rm3x8sgb8h51638b7-source
source root is source
patching sources
applying patch /nix/store/kg1vs1b0azdk8i5hyzwrw5z9d7bazifh-ocaml-zmq-issue43.patch
patching file zmq/src/caml_zmq_stubs.c
configuring
no configure script, doing nothing
building
installing
Processing file zmq.install as zmq.
post-installation fixup
moving /nix/store/dr8qcfxiphjpmvjszjnmg9y1zdjv0i8i-ocaml4.06.1-zmq-20180726/doc to /nix/store/dr8qcfxiphjpmvjszjnmg9y1zdjv0i8i-ocaml4.06.1-zmq-20180726/share/doc
shrinking RPATHs of ELF executables and libraries in /nix/store/dr8qcfxiphjpmvjszjnmg9y1zdjv0i8i-ocaml4.06.1-zmq-20180726
shrinking /nix/store/dr8qcfxiphjpmvjszjnmg9y1zdjv0i8i-ocaml4.06.1-zmq-20180726/lib/ocaml/4.06.1/site-lib/stublibs/dllzmq_stubs.so
shrinking /nix/store/dr8qcfxiphjpmvjszjnmg9y1zdjv0i8i-ocaml4.06.1-zmq-20180726/lib/ocaml/4.06.1/site-lib/zmq/deferred/zmq_deferred.cmxs
shrinking /nix/store/dr8qcfxiphjpmvjszjnmg9y1zdjv0i8i-ocaml4.06.1-zmq-20180726/lib/ocaml/4.06.1/site-lib/zmq/zmq.cmxs
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/dr8qcfxiphjpmvjszjnmg9y1zdjv0i8i-ocaml4.06.1-zmq-20180726/lib
patching script interpreter paths in /nix/store/dr8qcfxiphjpmvjszjnmg9y1zdjv0i8i-ocaml4.06.1-zmq-20180726
checking for references to /build in /nix/store/dr8qcfxiphjpmvjszjnmg9y1zdjv0i8i-ocaml4.06.1-zmq-20180726...
bash: /tmp/env-vars: cannot overwrite existing file |
This one is broken: |
I don't see why this should be harder to fix then before. |
@vbgl Can you explain how this makes it harder to fix? The goal of this PR was to make the life of contributors (I included) easier not harder. |
In any case, if zmq is not well served by |
PR to fix |
Motivation for this change
This takes advantage of the uniformization of the OCaml package ecosystem around the dune build system (and often the accompanying dune-release) to simplify the way usual OCaml derivations are prepared in nixpkgs.
cc @vbgl
Things done
I have ported a few packages which allowed me to refine the design of
dunePackage
but not all of them yet.sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)