From 57ccba7da6feb46475f1ad58126a663356efe358 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 14 Feb 2020 08:09:08 +1100 Subject: add gdrive downloader - fetch dbNSFP automatically via gdrive.pl --- lib/google.nix | 20 ++++++++++++++++++++ lib/references.nix | 20 ++++++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 lib/google.nix (limited to 'lib') diff --git a/lib/google.nix b/lib/google.nix new file mode 100644 index 0000000..354b5c5 --- /dev/null +++ b/lib/google.nix @@ -0,0 +1,20 @@ +{ bionix }: + +{ url, sha256 }: + +with bionix.pkgs; + +let + gdown = fetchurl { + url = + "https://raw.githubusercontent.com/circulosmeos/gdown.pl/master/gdown.pl"; + sha256 = "1pw3vg70bgf33akbbphpr6zn3jndv0khmsa3k0m877hgzg1v52qv"; + }; +in runCommand "gdown" { + nativeBuildInputs = [ perl wget ]; + outputHashAlgo = "sha256"; + outputHash = sha256; + outputHashMode = "flat"; +} '' + perl ${gdown} "${url}" $out +'' diff --git a/lib/references.nix b/lib/references.nix index c56ad0f..333888c 100644 --- a/lib/references.nix +++ b/lib/references.nix @@ -60,14 +60,12 @@ rec { ''; }; dbnsfp = { - db = pkgs.requireFile { - name = "dbNSFP.txt.gz"; - message = "download the dbNSFP database manually from https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlSTY5dDJjcHVRZ3M and add to nix store"; + db = fetchgdrive { + url = "https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlSTY5dDJjcHVRZ3M"; sha256 = "0gfzbid3pc10zds7ya50w4qfynsxgpyh7dx35vhm5f3h64mw75pm"; }; - index = pkgs.requireFile { - name = "dbNSFP.txt.gz.tbi"; - message = "download the dbNSFP index manually from https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlOTV5RllpRjNHU2s and add to nix store"; + index = fetchgdrive { + url = "https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlOTV5RllpRjNHU2s"; sha256 = "0bwwigbnz32mmc8bczidjf68vv8x8i28zwkl2kgcbpj542zk5q86"; }; }; @@ -146,14 +144,12 @@ rec { ''; }; dbnsfp = { - db = pkgs.requireFile { - name = "dbNSFP.txt.gz"; - message = "download the dbNSFP database manually from https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlbTZodjlGUDZnTGc and add to nix store"; + db = fetchgdrive { + url = "https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlbTZodjlGUDZnTGc"; sha256 = "0gahnwkc7v2q6p6ixkhvsgqvvm6xf0c3bdh4nf0alih83h3wffd0"; }; - index = pkgs.requireFile { - name = "dbNSFP.txt.gz.tbi"; - message = "download the dbNSFP index manually from https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlNVBJdFA5cFZRYkE and add to nix store"; + index = fetchgdrive { + url = "https://drive.google.com/uc?export=download&id=0B7Ms5xMSFMYlNVBJdFA5cFZRYkE"; sha256 = "18blkly6gvg7r0sx968xlb1zl2kqg5j1kpbrm2r7ajlxlfyvrx3w"; }; }; -- cgit v1.2.3