Repository navigation
nextflow: 22.10.6 -> 24.08.0-edge + remove buildFHSEnv + compile from source + add tests - #339197
Conversation
f0a467f to
5ecf091
Compare
There was a problem hiding this comment.
Think we could get away with a nextflow run hello too?
There was a problem hiding this comment.
Mh, I think this needs internet access, right? I tried to run this and this yields:
❯ nix build path:.#nextflow.tests.hello
error: builder for '/nix/store/k7ic1jfrcmyiaxckk5ziqgcjvic1ckaw-nextflow-run-hello.drv' failed with exit code 1;
last 10 log lines:
> sourcing setup hook '/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh'
> sourcing setup hook '/nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh'
> sourcing setup hook '/nix/store/aazf105snicrlvyzzbdj85sx4179rpfp-set-source-date-epoch-to-latest.sh'
> sourcing setup hook '/nix/store/gps9qrh99j7g02840wv5x78ykmz30byp-strip.sh'
>
> N E X T F L O W ~ version 24.04.4
>
> Pulling nextflow-io/hello ...
> WARN: Cannot read project manifest -- Cause: api.github.com
> Cannot find `nextflow-io/hello` -- Make sure exists a GitHub repository at this address `https://github.com/nextflow-io/hello`
For full logs, run 'nix log /nix/store/k7ic1jfrcmyiaxckk5ziqgcjvic1ckaw-nextflow-run-hello.drv'.- passthru.tests.version = testers.testVersion {
- package = nextflow;
- command = "HOME=$TMPDIR nextflow -version";
+ passthru.tests = {
+ version = testers.testVersion {
+ package = nextflow;
+ command = "HOME=$TMPDIR nextflow -version";
+ };
+ hello = runCommand "nextflow-run-hello" {nativeBuildInputs = [nextflow];} ''
+ HOME=$TMPDIR
+ nextflow run hello
+ touch $out
+ '';
};There was a problem hiding this comment.
I have added a hello test by simply downloading the necessary pipeline upfront.
|
Ah, and upon further testing, not using EDIT: It does now. |
f9690a8 to
e1b45a9
Compare
There was a problem hiding this comment.
I have not checked whether all the listed nativeBuildInputs are really necessary.
There was a problem hiding this comment.
Sort of related: I've been cleaning up error: makeWrapper/makeShellWrapper must be in nativeBuildInputs in cross-compilation scenarios, and while makeWrapper is correctly placed in nativeBuildInputs here, using lib.makeBinPath on it causes the error to appear in builds of reverse dependencies (in this case nf-test). I think it would make sense to keep only makeWrapper inside the actual nativeBuildInputs attribute and move the rest (or at least the ones that are necessary) to be just passed directly to lib.makeBinPath. Currently still running a build without your PR, but with this change.
nf-test needs a similar fix itself as well.
There was a problem hiding this comment.
(See this commit for an implementation of the suggested approach)
There was a problem hiding this comment.
@SFrijters I adapted the code as you suggested and sucessfully run nix build -L path:.#nextflow.tests.hello. I have updated this PR now.
There was a problem hiding this comment.
I'm unhappy with this but could not get nextflow to compile otherwise. I don't know whether this is an issue with mitm-cache (i.e. maybe it does not correctly provide the dependencies) or an issue with nextflow's gradle config (i.e. it does not correctly list [transitive?] deps).
I was able to compile nextflow without issues in a nix-shell env with just javac & make at hand. But using the mitm-cache approach (as necessary for a derivation which should build deterministically), some deps were simply not fetched. For example, when removing api "org.ow2.asm:asm-util:9.7" (from the patch), the compilation aborts with:
...
nextflow> > Task :plugins:nf-wave:processResources
nextflow> > Task :nf-commons:compileGroovy FAILED
nextflow> > Task :plugins:nf-azure:copyPluginLibs
nextflow> > Task :plugins:nf-amazon:copyPluginLibs
nextflow> > Task :plugins:nf-google:copyPluginLibs
nextflow> FAILURE: Build failed with an exception.
nextflow> * What went wrong:
nextflow> Execution failed for task ':nf-commons:compileGroovy'.
nextflow> > Could not resolve all files for configuration ':nf-commons:detachedConfiguration1'.
nextflow> > Could not find org.ow2.asm:asm-util:9.7.
nextflow> Searched in the following locations:
nextflow> - https://repo.maven.apache.org/maven2/org/ow2/asm/asm-util/9.7/asm-util-9.7.pom
nextflow> - https://repo.eclipse.org/content/groups/releases/org/ow2/asm/asm-util/9.7/asm-util-9.7.pom
nextflow> - https://oss.sonatype.org/content/repositories/snapshots/org/ow2/asm/asm-util/9.7/asm-util-9.7.pom
nextflow> - https://s3-eu-west-1.amazonaws.com/maven.seqera.io/releases/org/ow2/asm/asm-util/9.7/asm-util-9.7.pom
nextflow> - https://s3-eu-west-1.amazonaws.com/maven.seqera.io/snapshots/org/ow2/asm/asm-util/9.7/asm-util-9.7.pom
nextflow> Required by:
nextflow> project :nf-commons > org.apache.groovy:groovy-console:4.0.22
nextflow> * Try:
nextflow> > Run with --stacktrace option to get the stack trace.
nextflow> > Run with --info or --debug option to get more log output.
nextflow> > Run with --scan to get full insights.
nextflow> > Get more help at https://help.gradle.org.
nextflow> Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
nextflow> You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
nextflow> For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
nextflow> BUILD FAILED in 40s
nextflow> 19 actionable tasks: 19 executedI tested with
nix build -L .#nextflow.mitmCache.updateScript && ./result && nix build -L .#nextflowThe mitmCache.updateScript runs throught but building itself yields the above errors.
Here is the diff to reproduce the error:
diff --git a/pkgs/development/interpreters/nextflow/add-build-dependencies.patch b/pkgs/development/interpreters/nextflow/add-build-dependencies.patch
index ccc774245d8c..cfd4d3629c16 100644
--- a/pkgs/development/interpreters/nextflow/add-build-dependencies.patch
+++ b/pkgs/development/interpreters/nextflow/add-build-dependencies.patch
@@ -2,7 +2,7 @@ diff --git a/modules/nf-commons/build.gradle b/modules/nf-commons/build.gradle
index 2a5c6ec70..a29305106 100644
--- a/modules/nf-commons/build.gradle
+++ b/modules/nf-commons/build.gradle
-@@ -26,6 +26,12 @@ sourceSets {
+@@ -26,6 +26,11 @@ sourceSets {
dependencies {
api "ch.qos.logback:logback-classic:1.4.14"
@@ -10,7 +10,6 @@ index 2a5c6ec70..a29305106 100644
+ api "org.apache.groovy:groovy-datetime:4.0.22"
+ api "org.apache.groovy:groovy-dateutil:4.0.22"
+ api "org.apache.groovy:groovy-sql:4.0.22"
-+ api "org.ow2.asm:asm-util:9.7"
+ api "org.abego.treelayout:org.abego.treelayout.core:1.0.3"
api "org.apache.groovy:groovy:4.0.22"
api "org.apache.groovy:groovy-nio:4.0.22"I basically just copy & pasted the "missing" deps from the error messages and build the patch accordingly.
|
@edmundmiller @Etjean I went down the rabbit hole of compiling nextflow on my own. I feel that the result is promising. Please check out the current state. I haven't sqashed my work yet. |
There was a problem hiding this comment.
| src = fetchurl { | |
| src = fetchFromGitHub { | |
| rev = "6e866ae81ff3bf8a9729e9dbaa9dd89afcb81a4b"; | |
| owner = "nextflow-io"; | |
| repo = "nextflow"; |
Make sure to regenerate the hash, just in case
There was a problem hiding this comment.
The default update task simply downloads every dependency, but additional dependencies may be added during the build process (it's called detached configurations). You can either work around the issue by getting rid of the Gradle code that uses detached configurations, make the update script run use these configurations by running a full build.
For the former approach, you'd have to locate the code that uses detached configurations. For example, for an app using Launch4j you'd have to build a jar instead of a bash wrapper and wrap it manually.
For the latter approach, you can just do
| patches = [ ./add-build-dependencies.patch ]; | |
| gradleUpdateTask = "pack"; |
There was a problem hiding this comment.
Thank you for looking into this! Your suggestions (gradleUpdateTask) works fine. It is much better than a not-so-future-proof patch.
There was a problem hiding this comment.
| src = fetchurl { | |
| url = "https://github.com/nextflow-io/hello/archive/afff16a9b45c8e8a4f5a3743780ac13a541762f8.tar.gz"; | |
| src = fetchFromGitHub { | |
| owner = "nextflow-io"; | |
| repo = "hello"; | |
| rev = "afff16a9b45c8e8a4f5a3743780ac13a541762f8"; |
There was a problem hiding this comment.
which of these are actually needed? bash and openjdk most likely aren't
There was a problem hiding this comment.
Yes, you're right. I removed both. I check the others and found that wget as well as ata least one of the others (I commented out accordingly) are needed. Than I stopped investigating. I assume now that the dependencies haven't changed.
b9923b6 to
b963c70
Compare
b963c70 to
8af6bfa
Compare
|
I realize that something is still wrong with the "fixed" shebang. While execution works fine when running on the host, using |
There was a problem hiding this comment.
Could you switch to versionCheckHook? https://nixos.org/manual/nixpkgs/unstable/#versioncheckhook
|
Looks good overall. |
|
@doronbehar Thank you for your review. I'll address you remarks. |
|
@doronbehar I adressed your concerns. The EDIT: ❯ env --chdir=/ --argv0=nextflow --ignore-environment /nix/store/2dhvjd654ymb2n7fwm4lfw5jgnianpdd-nextflow-24.08.0-edge/bin/nextflow
mkdir: cannot create directory '/.nextflow': Permission denied
Exception in thread "main" java.lang.ExceptionInInitializerError
at nextflow.cli.Launcher.init(Launcher.groovy:126)
at nextflow.cli.Launcher.<init>(Launcher.groovy:87)
at nextflow.cli.Launcher.main(Launcher.groovy:657)
Caused by: java.lang.IllegalStateException: Cannot create path '/.nextflow' -- check file system access permission
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
at nextflow.Const.getHomeDir(Const.groovy:63)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
at nextflow.Const.<clinit>(Const.groovy:47)
... 3 more
Groovy code EDIT: for future reference: # TODO: Set NXF_HOME=$TMPDIR or similar.
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true; |
doronbehar
left a comment
There was a problem hiding this comment.
Looks good, is this a draft because of the versionCheckHook failing?
There was a problem hiding this comment.
I don't see a mean to use the hook right now. Let me know what you think.
Yes so it seems.. I wonder whether this is maybe case is not that extreme, and we should support adding arbitrary arguments to the env command. For now, I'll leave it as it is, and we can go with passthru.tests on this one.
There was a problem hiding this comment.
Yes, I also wondered whether this package justifies adapting versionCheckHook. This is beyond my exptertise.
I have added & used testers.testVersion again.
66af062 to
f71f792
Compare
Yes. It it builds for me (locally) and I also integrated your remarks. Thanks again! The PR is ready from my point of view. I'll keep it as a draft for some time (this week?) since I'd like to test it more (using my local machine). I've had issues before (with docker, see above) that I only realized when actually using the package. I'd like to make sure it works at least for my use case. Here is the last diff, btw. |
There was a problem hiding this comment.
I'm pretty sure you aware of that due to the draft state, but I'm just noting that it'd be nice to take a decision here.
f71f792 to
430f3b8
Compare
Done. I also addressed your other remarks. |
doronbehar
left a comment
There was a problem hiding this comment.
I'll be ready to merge this when you are :)
|
@doronbehar This is fine from my point of view now. I don't understand the merge conflict I'm currently seeing. I'm converting this to "ready for review". I think it could be merged (assuming the merge conflict is a GitHub bug?). @edmundmiller and @Etjean (the maintainers) haven't said anything though. |
`nextflow` is no build by compiling from source instead of using the downloaded release file. This improves the overall accesibility (`version` will be shown on https://search.nixos.org/packages?query=nextflow) and allows to add & run tests more easily.
430f3b8 to
8d15ee1
Compare
|
@rollf the merge conflict is not a mistake. I was because someone did a change that changed |
|
@doronbehar Ping as requested :) |
doronbehar
left a comment
There was a problem hiding this comment.
Sorry to hold this further.. Found this issue:
| bash = pkgs.dockerTools.pullImage { | ||
| imageName = "quay.io/nextflow/bash"; | ||
| imageDigest = "sha256:bea0e244b7c5367b2b0de687e7d28f692013aa18970941c7dd184450125163ac"; | ||
| sha256 = "161s9f24njjx87qrwq0c9nmnwvyc6iblcxka7hirw78lm7i9x4w5"; |
There was a problem hiding this comment.
This hash is different for aarch64-linux apparently (quoting from ofborg):
error: hash mismatch in fixed-output derivation '/nix/store/75i49g2lqizqy7wynln75imsw7dhznfx-docker-image-quay.io-nextflow-bash-latest.tar.drv':
specified: sha256-hZOe4qkUHZ4jPGp2Rlc0zG9uq00MYJ7xQV1KS4RLOpg=
got: sha256-oUiM5XRHWbogXfjmSMDaKvG2ZQy0d4GziFWyLFWc0C4=
I wonder if we should simply do this:
| sha256 = "161s9f24njjx87qrwq0c9nmnwvyc6iblcxka7hirw78lm7i9x4w5"; | |
| sha256 = { | |
| x86_64-linux = "161s9f24njjx87qrwq0c9nmnwvyc6iblcxka7hirw78lm7i9x4w5"; | |
| aarch64-linux = "sha256-oUiM5XRHWbogXfjmSMDaKvG2ZQy0d4GziFWyLFWc0C4="; | |
| }.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"); |
Or disable the test on platforms not x86_64-linux. I tend to the do the later, as it would be hard to fix further issues with aarch64-linux we might encounter, and I assume that both of us are losing patience :).
There was a problem hiding this comment.
Currently openjdk doesn't build for me in cross, so I don't think we'll be getting around to running the tests (or the application itself) in cross any time soon anyway. I don't have a big stake in this but I would recommend indeed just disabling the tests for cross.
There was a problem hiding this comment.
Currently openjdk doesn't build for me in cross, so I don't think we'll be getting around to running the tests (or the application itself) in cross any time soon anyway. I don't have a big stake in this but I would recommend indeed just disabling the tests for cross.
We are not talking about cross compilation from x86_64-linux to aarch64-linux, but rather native building of the NixOS test derivation on aarch64-linux. openjdk builds fine on aarch64-linux according to hydra-check.
There was a problem hiding this comment.
Oh, wow. Why could the hash be different in the first place? I don't have an opinion here so I'd follow @doronbehar suggestions to only support x86_64-linux. I would disable the test within the nextflow-derivation itself (i.e. passthru.tests.default = if host platform ...), right?
There was a problem hiding this comment.
I would disable the test within the
nextflow-derivation itself (i.e.passthru.tests.default = if host platform ...), right?
That would make ofborg avoid building that derivation when it looks up nextflow.passthru.tests, but still your commit nixos/nextflow will make at least Hydra try to build that test on aarch64-linux. You can use the handleTestOn function that is used in all-tests.nix.
There was a problem hiding this comment.
I pushed a new commit using handleTestOn.
There was a problem hiding this comment.
I think the hash is different because the data on the docker image differs among architectures/systems. Maybe one could have both hashes, depending on the $system. That might be something for the future.
The docker image hash seems to differ on different systems. See NixOS#339197 (comment)
|
I have some more bad news, the x86_64-darwin build of And on Hydra the |
|
@doronbehar I checked this. I think the issues stems from here in combination with this copy operation. I wonder why this is not a problem on Linux. Maybe the gradle build is different. I just pushed a fix but forgot to compile it locally first. I am doing this right now. At least, I can check on Linux that it still works. Fingers crossed then for the x86_64-darwin build. |
|
Similar error: |
|
The above was taken from The community's Darwin builder |
ea490db to
f481bad
Compare
|
I update my fix commit. I guess setting |
doronbehar
left a comment
There was a problem hiding this comment.
Well done 🎉 I tested it on the darwin build box and it worked :).
|
Thank you all very much for the work on this! 💯 🙌 |
|
Cool! Thank you @doronbehar for your support. It did feel like a team effort 👍 . |

There is no need to use buildFHSEnv (anymore) on Linux. I removed it here because a) it makes the code cleaner, b) improves access (e.g. theversionwill be shown on https://search.nixos.org/packages?query=nextflow) and c) allows to add & run tests.Update 2024-09-06
This PR is a complete rewrite of the
nextflowderivation:buildFSHEnvanymore but rather patch the original source (so that/bin/bashis not referenced anymore)gradleThis PR supersedes a previous one prepared by @edmundmiller. I have incorporated his
openjdkchange.Description of changes
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.