Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
bmpvieira committed Jan 7, 2019
2 parents 7d94d4e + 6fa475d commit e31ff5e
Show file tree
Hide file tree
Showing 47 changed files with 9,763 additions and 4,573 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: nix
services:
- docker
env:
global:
- secure: IdGFh3a+MP47R7TGqRXJ7MLo3RWWgAX05zKHDmMkYRQbZMjcU5I3Ywu63pFEqiASvhwcdu0UjxLxReQAOLd+/ojyLjS+QQCLtrOLryyROa8DqP7Ci5f1CpZs0RYbXF6hPHOVlMoJ9T/DfEH0eQeuelQBG8Wr/0reigkwNdJi7x/zozIXGH/St2MgV3Qo6bQ2Xdkh3HbUL4zMGbjfqj/9x2lzWPAL5NKPMquSH2y76IsUJngBgHsQegAlnJb5TFMa2J53A6Kkl8lZQmD4nKOirRvqPJMiM1H3X44EKI9+woXWnXnPFz+KmQKhA9nShaqYcmZgWlJtLMtcMsknKrRaPNB21q69HtQjtOvHn9+FQnRvE6cMMFC6DIhsI7x3fKhU+EEeLsIrUSFPB62XTIqhqyuhwf7/4m/k6iL8oSRxEvVCqWKOPzjyGpqY50atKbdMMdkWAy+/NeenrRh6e92rin2m/d0Cwzs1tiknk9XdH/vNcCUjN000ePWnRgnKe01TeBBdVawOzWNQCBklxbW68shvdEu8ds/OYBUkAQDmlf4BjizlMvIRWbcaYfu3FyC8gopGeUX1d7tFBjD4eGOFGY99jPJG78l+z2BkVwhCZAD6wN/iglgtFy2mIRPF/+wLi75D9KRukhcaFF6nBLpyTTIhtse70EzNqC0cQjdSWjg= # DOCKER_USER
- secure: FLCsOdYx7pnXQ6AOjrAQN9WlvEqDio1Z1xeQ4l2DZb/kYPr+m/zpO/Ub7E2wGsTnEb8TRTycyk1Pm7gef7Ql81/W444WAauggICL0L2V294OK+ED/eKLn2UUvSsPicGtCNnW/VJeS4DsrzRvW/wnDXoXxH0Fx1AeeObvpqlt//TJEN+FRX79DjqPeT+PY47opUMPV8KMZjDkrjjmH4FnhawCE5licuE975p5NmqxsQ1c7afMI9/XntZisj2w6mdyF2rtmB2HE0uvg9rUSiTHlYnNQ6t40iKxE0fR3PaCi3pZwOmChJIprPzxit5mwW7PGy74WGKdivDb+G/iFyhxRS3EOyeHzUi0Wp4fHH8gsquKgprhn2v+qpqUa4of/pN2uffIMCc/TDDlkojy+P7GduPFwYbv2Ut3rW7VK3cpddYALPadeBSTTt55Dim7udM5e2bX+xz28mqrzHzV1sQSHkMalqk01KvfkAGhYgwogWhjP+NwkCKGRGhP8GOoYRP/vNW9/j3VSdKe78JKGDYKGgIaDu+ZmfhPeLykXo6QtIhlsjtU4wPR4Gb40sG6GoW04/54xXjbGd/X5dlDSISTKhi985TnA5ABu5iSm8m3S2jqioQYCu/A7YKo3okSDbdjvwPsEiusKStahy6ZHStJ4A6ndyZvb0de/yug+DLkgBI= # DOCKER_PASS
before_script: docker login -u $DOCKER_USER -p $DOCKER_PASS
script: ./buildContainers.sh
branches:
only:
- develop
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ This can be used as a Git submodule to pin nixpkgs to a particular release and a
## Organization
This repo tries to be minimal and thus does not include packages definitions from [NixOS/nixpkgs](https://github.com/NixOS/nixpkgs). Yet it follows the same folder structure so that customs packages added here can easily be copy pasted to a `NixOS/nixpkgs` fork to be included in the official nixpkgs release via pull requests. Custom packages added this way to the official Nix will be maintained there and removed from this repo.

## New projects
Copy `default.nix` and `shell.nix` into the root of your new project and add this repo as a git submodule.
Edit `default.nix` so that the `pkgs` property matches the relative location of `all-packages.nix`.
Edit `shell.nix` so that the name and version are relevant to your project.

## Usage
Edit `shell.nix` to adjust the name and version of your project to anything you want (optional).

Expand Down
19 changes: 19 additions & 0 deletions buildContainers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /bin/bash
source ./nixez.sh
nixez install hello # To test and also get pinned Pkgs repo
repo=bionode
nixVersion=$(jq -r .version ./nixsrc.json)
nix-env -f . -qaPA 'containerReadyPkgs' | awk '{print $2}' | while read pkg; do
echo "Checking if $pkg needs to be pushed to Docker Hubs"
pkgName=${pkg%%-*}
pkgVersion=${pkg##*-}
dockerTag="$pkgVersion"_nix"$nixVersion"
url="https://registry.hub.docker.com/v2/repositories/$repo/$pkgName/tags/"
if ! curl -s $url | jq -r '."results"[]["name"]' 2> /dev/null | grep -q -e "^$dockerTag$" ; then
echo "Building Docker image for $pkg"
nixez docker $pkgName
docker tag $repo/$pkgName:$dockerTag $repo/$pkgName:latest
echo "Pushing $pkg to Docker Hub"
docker push $repo/$pkgName
fi
done
8 changes: 7 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
import ./pkgs/top-level/all-packages.nix
{ system ? builtins.currentSystem, pkg ? null, timestamp ? "1970-01-01T00:00:01Z" }:
let
nixpkgs = import <nixpkgs> { inherit system; };
makeOverridable = nixpkgs.stdenv.lib.makeOverridable;
pkgs = import ./pkgs/top-level/all-packages.nix;
in
makeOverridable pkgs { inherit system; inherit timestamp; pkg = pkg; shellDir = ./shell.nix; }
1 change: 1 addition & 0 deletions lib/maintainers.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ ...}:
{
bmpvieira = "Bruno Vieira <[email protected]>";
jbedo = "Justin Bedő <[email protected]>";
}
20 changes: 20 additions & 0 deletions nixbldOSX.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/bash -e

dseditgroup -o create nixbld -q

gid=$(dscl . -read /Groups/nixbld | awk '($1 == "PrimaryGroupID:") {print $2 }')

echo "created nixbld group with gid $gid"

for i in $(seq 1 10); do
user=/Users/nixbld$i
uid="$((30000 + $i))"
dscl . create $user
dscl . create $user RealName "Nix build user $i"
dscl . create $user PrimaryGroupID "$gid"
dscl . create $user UserShell /usr/bin/false
dscl . create $user NFSHomeDirectory /var/empty
dscl . create $user UniqueID "$uid"
dseditgroup -o edit -a nixbld$i -t user nixbld
echo "created nixbld$i user with uid $uid"
done
34 changes: 30 additions & 4 deletions nixez.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Usage: source ./nixez.fish

function docker-load-nix
if test -n (cat /proc/version | grep Microsoft)
if grep -q -s Microsoft /proc/version
set DIR (pwd | sed 's|/mnt/\(.\)|\1:|' | sed 's|/|\\\|g')
else
set DIR (pwd)
Expand All @@ -15,7 +15,7 @@ function docker-load-nix
set ARGS -ti --rm
end

docker run $ARGS -v $DIR:/data $IMAGE /bin/sh
# docker run $ARGS -v $DIR:/data $IMAGE
end

function read_confirm
Expand Down Expand Up @@ -45,10 +45,34 @@ function nixez
nix-env -q
case build
nix-build (pwd) -A $argv[2]
case nodejs
cd pkgs/development/node-packages
node2nix -6 -i node-packages-v6.json -o node-packages-v6.nix -c composition-v6.nix
cd ../../..
case docker
nix-build (pwd) -A dockerTar --argstr pkg $argv[2]
and docker-load-nix interactive
if uname -a | grep 'Darwin' >/dev/null
sudo (cat ~/.nixpkgs/linuxkit-builder/env) \
NIX_PATH="nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs" \
nix-build (pwd) -A dockerTar --argstr pkg $argv[2] \
--argstr timestamp (date -u +"%Y-%m-%dT%H:%M:%SZ") \
--argstr system "x86_64-linux"
else
nix-build (pwd) -A dockerTar --argstr pkg $argv[2] \
--argstr timestamp (date -u +"%Y-%m-%dT%H:%M:%SZ")
end
if [ -t 1 ]
docker-load-nix interactive
else
docker-load-nix
end
case singularity
sudo (cat ~/.nixpkgs/linuxkit-builder/env) \
NIX_PATH="nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs" \
nix-build (pwd) -A dockerTar --argstr pkg $argv[2]
and docker-load-nix
set NAME (docker ps -l --format "{{.Image}}" | sed 's|:|_|')
and docker export (docker ps -lq) | gzip > $NAME.tar.gz
case singularity-mac
nix-build (pwd) -A dockerTar --argstr pkg $argv[2]
and docker-load-nix
set NAME (docker ps -l --format "{{.Image}}" | sed 's|:|_|')
Expand All @@ -66,6 +90,8 @@ function nixez
if read_confirm
curl https://nixos.org/nix/install | sh
end
case repair
nix-store --verify --check-contents
case '*'
echo "Options: shell, search, install, remove, list, build, docker, singularity, setup, unsafe-setup"
end
Expand Down
31 changes: 28 additions & 3 deletions nixez.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Usage: source ./nixez.sh

function docker-load-nix() {
if grep -q Microsoft /proc/version; then
if grep -q -s Microsoft /proc/version; then
DIR=$(pwd | sed 's|/mnt/\(.\)|\1:|' | sed 's|/|\\|g')
else
DIR=$(pwd)
Expand All @@ -17,7 +17,7 @@ function docker-load-nix() {
ARGS=""
fi

docker run $ARGS -v "$DIR:/data" "$IMAGE" /bin/sh
# docker run $ARGS -v "$DIR:/data" "$IMAGE"
}

function nixez() {
Expand All @@ -28,9 +28,31 @@ function nixez() {
remove) nix-env -e "$2" ;;
list) nix-env -q;;
build) nix-build "$(pwd)" -A "$2" ;;
nodejs)
cd pkgs/development/node-packages
node2nix -6 -i node-packages-v6.json -o node-packages-v6.nix -c composition-v6.nix
cd ../../..
;;
docker)
if [ "$(uname)" == "Darwin" ]; then
sudo $(cat ~/.nixpkgs/linuxkit-builder/env) \
NIX_PATH="nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs" \
nix-build "$(pwd)" -A dockerTar --argstr pkg "$2" \
--argstr timestamp $(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--argstr system "x86_64-linux"
else
nix-build "$(pwd)" -A dockerTar --argstr pkg "$2" \
--argstr timestamp $(date -u +"%Y-%m-%dT%H:%M:%SZ")
fi
if [ -t 0 ]; then
docker-load-nix interactive
else
docker-load-nix
fi
;;
docker-push)
nix-build "$(pwd)" -A dockerTar --argstr pkg "$2" &&
docker-load-nix interactive
docker-load-nix
;;
singularity)
nix-build "$(pwd)" -A dockerTar --argstr pkg "$2" &&
Expand Down Expand Up @@ -63,6 +85,9 @@ function nixez() {
;;
esac
;;
repair)
nix-store --verify --check-contents
;;
* ) echo "Options: shell, search, install, remove, list, build, docker, singularity" ;;
esac
}
6 changes: 3 additions & 3 deletions nixsrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"version": "17.09-beta",
"version": "17.09",
"origin": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6a7066eb53685438564dc50362666d0e7f150110",
"sha256": "1psff8lpp5kmihsg7xv46a0d3rmhsb4kyb9w8r213gn8ggigwg57"
"rev": "39cd40f7bea40116ecb756d46a687bfd0d2e550e",
"sha256": "0kpx4h9p1lhjbn1gsil111swa62hmjs9g93xmsavfiki910s73sh"
}
}
29 changes: 29 additions & 0 deletions pkgs/applications/science/biology/bcftools/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ stdenv, fetchurl, htslib, zlib, bzip2, lzma, curl, perl, bash }:

stdenv.mkDerivation rec {
name = "${pname}-${version}";
pname = "bcftools";
upstreamVersion = "1.6";
version = "${upstreamVersion}noperl";

src = fetchurl {
url = "https://github.com/samtools/bcftools/releases/download/${upstreamVersion}/${pname}-${upstreamVersion}.tar.bz2";
sha256 = "10prgmf09a13mk18840938ijqgfc9y92hfc7sa2gcv07ddri0c19";
};

buildInputs = [ htslib zlib bzip2 lzma curl ];

makeFlags = [
"HSTDIR=${htslib}"
"prefix=$(out)"
"CC=cc"
];

meta = with stdenv.lib; {
description = "Tools for manipulating BCF2/VCF/gVCF format, SNP and short indel sequence variants";
license = licenses.mit;
homepage = http://www.htslib.org/;
platforms = platforms.unix;
maintainers = [ maintainers.mimadrid ];
};
}
26 changes: 26 additions & 0 deletions pkgs/applications/science/biology/bedtools/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{stdenv, fetchFromGitHub, zlib, python}:

stdenv.mkDerivation rec {
name = "bedtools-${version}";
version = "2.26.0";

src = fetchFromGitHub {
owner = "arq5x";
repo = "bedtools2";
rev = "v${version}";
sha256 = "1j2ia68rmcw3qksjm5gvv1cb84bh76vmln59mvncr2an23f5a3ss";
};

buildInputs = [ zlib python ];
cc = if stdenv.cc.isClang then "clang++" else "g++";
buildPhase = "make prefix=$out SHELL=${stdenv.shell} CXX=${cc} -j $NIX_BUILD_CORES";
installPhase = "make prefix=$out SHELL=${stdenv.shell} CXX=${cc} install";

meta = with stdenv.lib; {
description = "A powerful toolset for genome arithmetic.";
license = licenses.gpl2;
homepage = https://bedtools.readthedocs.io/en/latest/;
maintainers = with maintainers; [ jbedo ];
platforms = platforms.unix;
};
}
26 changes: 26 additions & 0 deletions pkgs/applications/science/biology/bowtie2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ stdenv, fetchFromGitHub, zlib, tbb }:

stdenv.mkDerivation rec {
pname = "bowtie2";
version = "2.3.3.1";
name = "${pname}-${version}";

src = fetchFromGitHub {
owner = "BenLangmead";
repo = pname;
rev = "v${version}";
sha256 = "1pcyks76bnnkq6h0gqjw4fkdddjjnw7k5ibim7ajkbvfw58a99y0";
};

buildInputs = [ zlib tbb ];

installFlags = [ "prefix=$(out)" ];

meta = with stdenv.lib; {
description = "An ultrafast and memory-efficient tool for aligning sequencing reads to long reference sequences";
license = licenses.gpl3;
homepage = http://bowtie-bio.sf.net/bowtie2;
maintainers = with maintainers; [ rybern ];
platforms = platforms.all;
};
}
25 changes: 25 additions & 0 deletions pkgs/applications/science/biology/bwa/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ stdenv, fetchurl, zlib }:

stdenv.mkDerivation rec {
name = "bwa-${version}";
version = "0.7.16a";

src = fetchurl {
url = "mirror://sourceforge/bio-bwa/${name}.tar.bz2";
sha256 = "0w61zxh6b4isydw5qp6pdb1mc50jg1h8vhahw2xm24w7i1gxpv4g";
};

buildInputs = [ zlib ];

installPhase = ''
install -vD bwa $out/bin/bwa
'';

meta = with stdenv.lib; {
description = "A software package for mapping low-divergent sequences against a large reference genome, such as the human genome";
license = licenses.gpl3;
homepage = http://bio-bwa.sourceforge.net/;
maintainers = with maintainers; [ luispedro ];
platforms = [ "x86_64-linux" ];
};
}
3 changes: 2 additions & 1 deletion pkgs/applications/science/biology/fastqc/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{ stdenv, fetchurl, unzip, jre }:

stdenv.mkDerivation rec {
name = "fastqc-${version}";
pname = "fastqc";
version = "0.11.5";
name = "${pname}-${version}";

src = fetchurl {
url = "https://www.bioinformatics.babraham.ac.uk/projects/fastqc/fastqc_v${version}.zip";
Expand Down
29 changes: 29 additions & 0 deletions pkgs/applications/science/biology/freebayes/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ stdenv, fetchFromGitHub, cmake, gcc, zlib, bzip2, lzma }:

stdenv.mkDerivation rec {
name = "freebayes-${version}";
version = "2017-08-23";

src = fetchFromGitHub {
name = "freebayes-${version}-src";
owner = "ekg";
repo = "freebayes";
rev = "8d2b3a060da473e1f4f89be04edfce5cba63f1d3";
sha256 = "0yyrgk2639lz1yvg4jf0ccahnkic31dy77q05pb3i28rjf37v45z";
fetchSubmodules = true;
};

buildInputs = [ zlib bzip2 lzma ];

installPhase = ''
install -vD bin/freebayes bin/bamleftalign scripts/* -t $out/bin
'';

meta = with stdenv.lib; {
description = "Bayesian haplotype-based polymorphism discovery and genotyping";
license = licenses.mit;
homepage = https://github.com/ekg/freebayes;
maintainers = with maintainers; [ jdagilliland ];
platforms = [ "x86_64-linux" ];
};
}
Loading

0 comments on commit e31ff5e

Please sign in to comment.