aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix19
1 files changed, 18 insertions, 1 deletions
diff --git a/default.nix b/default.nix
index 538ddf4..6ddcd1b 100644
--- a/default.nix
+++ b/default.nix
@@ -58,7 +58,24 @@ let
fetchFastQGZ = attrs: with types; tagFiletype (filetype.gz (filetype.fq {})) (fetchurl attrs);
fetchFastAGZ = attrs: with types; tagFiletype (filetype.gz (filetype.fa {})) (fetchurl attrs);
- # Export nixpkgs' lib
+ # Export nixpkgs and standard library lib
+ pkgs = nixpkgs;
lib = nixpkgs.lib;
+ stage = nixpkgs.stdenvNoCC.mkDerivation;
+
+ # splitting/joining
+ splitFile = file: drv: stage {
+ name = "split-${file}";
+ buildCommand = "ln -s ${drv}/${file} $out";
+ };
+ split = drv: lib.mapAttrs (p: _: splitFile p drv) (builtins.readDir drv);
+ join = drvs: stage {
+ name = "join";
+ buildCommand = ''
+ mkdir $out
+ ${builtins.concatStringsSep "\n" (builtins.attrValues (lib.mapAttrs (n: d: "ln -s ${d} $out/${n}") drvs))}
+ '';
+ };
+ each = f: drv: join (lib.mapAttrs (_: f) (split drv));
});
in bionix