From 0808fc803e3226d2f478229832bb827d7dfcbd0d Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Wed, 19 Dec 2018 09:55:29 +1100 Subject: link: introduce high-level linking functions --- default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 84bb3c8..1e647dd 100644 --- a/default.nix +++ b/default.nix @@ -37,6 +37,20 @@ let def = f: defs: attrs: f (defs // attrs); pipe = let g = fs: with builtins; let h = head fs; t = tail fs; in if t != [] then x: (g t (h x)) else h; in g; + link = {src, dst}: '' + d=$(dirname ${dst}) + if [ ! -e $out/$d ] ; then + mkdir -p $out/$d + fi + ln -s ${src} $out/${dst} + ''; + mkLinks = nixpkgs.lib.concatMapStringsSep "\n" link; + linkDrv = x: nixpkgs.stdenvNoCC.mkDerivation { + name = "link"; + buildCommand = mkLinks x; + }; + ln = x: y: { src = x; dst = y; }; + # Fetching files of specific type fetchFastQ = attrs: with types; tagFiletype (filetype.fq {}) (fetchurl attrs); fetchFastA = attrs: with types; tagFiletype (filetype.fa {}) (fetchurl attrs); -- cgit v1.2.3