1- { lib
2- , stdenv
3- , fetchurl
4- , makeWrapper
5- , openjdk17
6- , wget
7- , which
8- , gnused
9- , gawk
10- , coreutils
11- , buildFHSEnv
1+ {
2+ lib ,
3+ stdenv ,
4+ fetchFromGitHub ,
5+ makeWrapper ,
6+ openjdk ,
7+ gradle ,
8+ wget ,
9+ which ,
10+ gnused ,
11+ gawk ,
12+ coreutils ,
13+ bash ,
14+ testers ,
15+ nixosTests ,
1216} :
13-
14- let
15- nextflow =
16- stdenv . mkDerivation rec {
17+ stdenv . mkDerivation ( finalAttrs : {
1718 pname = "nextflow" ;
18- version = "22.10.6" ;
19+ # 24.08.0-edge is compatible with Java 21. The current (as of 2024-09-19)
20+ # nextflow release (24.04.4) does not yet support java21, but java19. The
21+ # latter is not in nixpkgs(-unstable) anymore.
22+ version = "24.08.0-edge" ;
1923
20- src = fetchurl {
21- url = "https://github.com/nextflow-io/nextflow/releases/download/v${ version } /nextflow-${ version } -all" ;
22- hash = "sha256-zeYsKxWRnzr0W6CD+yjoAXwCN/AbN5P4HhH1oftnrjY=" ;
24+ src = fetchFromGitHub {
25+ owner = "nextflow-io" ;
26+ repo = "nextflow" ;
27+ rev = "6e866ae81ff3bf8a9729e9dbaa9dd89afcb81a4b" ;
28+ hash = "sha256-SA27cuP3iO5kD6u0uTeEaydyqbyJzOkVtPrb++m3Tv0=" ;
2329 } ;
2430
2531 nativeBuildInputs = [
2632 makeWrapper
27- openjdk17
28- wget
29- which
30- gnused
31- gawk
32- coreutils
33+ gradle
3334 ] ;
3435
35- dontUnpack = true ;
36+ postPatch = ''
37+ # Nextflow invokes the constant "/bin/bash" (not as a shebang) at
38+ # several locations so we fix that globally. However, when running inside
39+ # a container, we actually *want* "/bin/bash". Thus the global fix needs
40+ # to be reverted for this specific use case.
41+ substituteInPlace modules/nextflow/src/main/groovy/nextflow/executor/BashWrapperBuilder.groovy \
42+ --replace-fail "['/bin/bash'," "['${ bash } /bin/bash'," \
43+ --replace-fail "if( containerBuilder ) {" "if( containerBuilder ) {
44+ launcher = launcher.replaceFirst(\"/nix/store/.*/bin/bash\", \"/bin/bash\")"
45+ '' ;
46+
47+ mitmCache = gradle . fetchDeps {
48+ inherit ( finalAttrs ) pname ;
49+ data = ./deps.json ;
50+ } ;
51+ __darwinAllowLocalNetworking = true ;
52+
53+ # During the build, some additional dependencies are downloaded ("detached
54+ # configuration"). We thus need to run a full build on instead of the default
55+ # one.
56+ # See https://github.com/NixOS/nixpkgs/pull/339197#discussion_r1747749061
57+ gradleUpdateTask = "pack" ;
58+ # The installer attempts to copy a final JAR to $HOME/.nextflow/...
59+ gradleFlags = [ "-Duser.home=\ $TMPDIR" ] ;
60+ preBuild = ''
61+ # See Makefile (`make pack`)
62+ export BUILD_PACK=1
63+ '' ;
64+ gradleBuildTask = "pack" ;
3665
3766 installPhase = ''
3867 runHook preInstall
3968
4069 mkdir -p $out/bin
41- install -Dm755 $src $out/bin/nextflow
70+ install -Dm755 build/releases/nextflow- ${ finalAttrs . version } -dist $out/bin/nextflow
4271
4372 runHook postInstall
4473 '' ;
4574
4675 postFixup = ''
4776 wrapProgram $out/bin/nextflow \
48- --prefix PATH : ${ lib . makeBinPath nativeBuildInputs } \
49- --set JAVA_HOME ${ openjdk17 . home }
77+ --prefix PATH : ${
78+ lib . makeBinPath [
79+ coreutils
80+ gawk
81+ gnused
82+ wget
83+ which
84+ ]
85+ } \
86+ --set JAVA_HOME ${ openjdk . home }
5087 '' ;
5188
89+ passthru . tests . default = nixosTests . nextflow ;
90+ # versionCheckHook doesn't work as of 2024-09-23.
91+ # See https://github.com/NixOS/nixpkgs/pull/339197#issuecomment-2363495060
92+ passthru . tests . version = testers . testVersion {
93+ package = finalAttrs . finalPackage ;
94+ command = "env HOME=$TMPDIR nextflow -version" ;
95+ } ;
96+
5297 meta = with lib ; {
5398 description = "DSL for data-driven computational pipelines" ;
5499 longDescription = ''
@@ -61,17 +106,11 @@ stdenv.mkDerivation rec {
61106 homepage = "https://www.nextflow.io/" ;
62107 changelog = "https://github.com/nextflow-io/nextflow/releases" ;
63108 license = licenses . asl20 ;
64- maintainers = with maintainers ; [ Etjean edmundmiller ] ;
109+ maintainers = with maintainers ; [
110+ Etjean
111+ edmundmiller
112+ ] ;
65113 mainProgram = "nextflow" ;
66114 platforms = platforms . unix ;
67115 } ;
68- } ;
69- in
70- if stdenv . hostPlatform . isLinux then
71- buildFHSEnv
72- {
73- name = "nextflow" ;
74- targetPkgs = pkgs : [ nextflow ] ;
75- runScript = "nextflow" ;
76- }
77- else nextflow
116+ } )
0 commit comments