aboutsummaryrefslogtreecommitdiff
path: root/default.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2018-12-18 14:05:19 +1100
committerJustin Bedo <cu@cua0.org>2018-12-18 14:11:57 +1100
commit0418c23f5d3bff108744d96d1075b0e76b580fdd (patch)
tree4a77565abe39bba1dc93139f2d4539496a041198 /default.nix
parent2ec0e115917d194eeea6ef4c1b4b1f7f6a7f416b (diff)
qsub: refactor overriding
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix14
1 files changed, 9 insertions, 5 deletions
diff --git a/default.nix b/default.nix
index d607aa2..6e07a74 100644
--- a/default.nix
+++ b/default.nix
@@ -1,13 +1,15 @@
{nixpkgs ? import <nixpkgs> {}}:
let
- inherit (nixpkgs) fetchurl;
+ inherit (nixpkgs) fetchurl callPackage;
bionix = nixpkgs.lib.makeExtensible (self:
let callBionix = file: attrs: import file ({ bionix = self; nixpkgs = nixpkgs; } // attrs);
in with self; {
callBionix = callBionix;
id = x: x;
+ exec = f: x: y: f x y;
+ callBionixE = p: exec (callBionix p);
types = callBionix ./lib/types.nix {};
@@ -25,12 +27,14 @@ let
samtools = callBionix ./tools/samtools.nix {};
strelka = callBionix ./tools/strelka.nix {};
- qsub = nixpkgs.callPackage ./lib/qsub.nix {};
- qsubAttr = qsubAttrs: f: attrs: i: qsub qsubAttrs (f attrs i);
- qsubAttrs = attrs: nixpkgs.lib.mapAttrs (_: x: qsubAttr attrs x);
ref = callBionix ./lib/references.nix {};
+
+ qsub = attrs: bionix.extend (self: super: with self; rec {
+ qsubDefs = { ppn = 1; mem = 1; walltime = "24:00:00"; tmpDir = "/tmp"; sleepTime = 60; } // attrs;
+ qsub = attrs: (callPackage ./lib/qsub.nix {}) (qsubDefs // attrs);
+ exec = f: x: y: qsub (builtins.intersectAttrs qsubDefs x) (f (builtins.removeAttrs x (builtins.attrNames qsubDefs)) y);
+ });
def = f: defs: attrs: f (defs // attrs);
- defQsub = qsubAttrs: f: defs: qsubAttr qsubAttrs (def f defs);
# Fetching files of specific type
fetchFastQ = attrs: with types; tagFiletype (filetype.fq {}) (fetchurl attrs);