Created
August 26, 2022 21:29
-
-
Save apraga/1b1175e96822efa5cbfc329c4a2833d7 to your computer and use it in GitHub Desktop.
PATH issue with Nextflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputs = { | |
nixpkgs.url = "nixpkgs/nixos-unstable"; | |
}; | |
description = "test"; | |
outputs = { self, nixpkgs }: | |
let | |
system = "x86_64-linux"; | |
pkgs = import nixpkgs { inherit system; }; | |
generateConfig = pkgs.runCommand "generateConfig" { | |
propagatedBuildInputs = [ pkgs.nextflow pkgs.bwa ]; | |
} '' | |
mkdir $out | |
cat << EOF > $out/main.nf | |
#!/usr/bin/env nextflow | |
nextflow.enable.dsl=2 | |
process Bwa { | |
output: | |
file "test.txt" | |
""" | |
bwa | |
""" | |
} | |
workflow { | |
Bwa() | view | |
} | |
EOF | |
''; | |
in { | |
packages.${system}.default = generateConfig; | |
apps.${system}.default = { | |
type = "app"; | |
name = "nextflowRun"; | |
program = "${pkgs.nextflow}/bin/nextflow"; | |
}; | |
}; | |
} |
or this for a generic solution that makes stuff available to all calls of the default app
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
};
description = "test";
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
generateConfig = pkgs.runCommand "generateConfig" {
propagatedBuildInputs = [ pkgs.nextflow pkgs.bwa ];
} ''
mkdir $out
cat << EOF > $out/main.nf
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
process Bwa {
output:
file "test.txt"
"""
bwa
"""
}
workflow {
Bwa() | view
}
EOF
'';
in {
packages.${system}.default = generateConfig;
apps.${system}.default = {
type = "app";
name = "nextflowRun";
program = "${pkgs.writeShellScript "nextflow" ''
export PATH="${pkgs.lib.makeBinPath generateConfig.propagatedBuildInputs}:$PATH"
exec ${pkgs.nextflow}/bin/nextflow "$@"
''}";
};
};
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this runs
bwa
when invoked asnix build && nix run . run result/main.nf
: