2018-01-10 02:38:19 +03:00
|
|
|
{ stdenvNoCC, lib, bower2nix, cacert }:
|
2016-03-26 17:27:24 +03:00
|
|
|
let
|
|
|
|
bowerVersion = version:
|
|
|
|
let
|
|
|
|
components = lib.splitString "#" version;
|
|
|
|
hash = lib.last components;
|
2017-10-30 01:07:48 +03:00
|
|
|
ver = if builtins.length components == 1 then (cleanName version) else hash;
|
2016-03-26 17:27:24 +03:00
|
|
|
in ver;
|
|
|
|
|
2017-10-30 01:07:48 +03:00
|
|
|
cleanName = name: lib.replaceStrings ["/" ":"] ["-" "-"] name;
|
2017-07-27 23:14:31 +03:00
|
|
|
|
2018-01-10 02:38:19 +03:00
|
|
|
fetchbower = name: version: target: outputHash: stdenvNoCC.mkDerivation {
|
2017-10-30 01:07:48 +03:00
|
|
|
name = "${cleanName name}-${bowerVersion version}";
|
2016-03-26 17:27:24 +03:00
|
|
|
buildCommand = ''
|
|
|
|
fetch-bower --quiet --out=$PWD/out "${name}" "${target}" "${version}"
|
|
|
|
# In some cases, the result of fetchBower is different depending
|
|
|
|
# on the output directory (e.g. if the bower package contains
|
|
|
|
# symlinks). So use a local output directory before copying to
|
|
|
|
# $out.
|
|
|
|
cp -R out $out
|
|
|
|
'';
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
inherit outputHash;
|
2018-01-14 22:18:27 +03:00
|
|
|
nativeBuildInputs = [ bower2nix cacert ];
|
2016-03-26 17:27:24 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
in fetchbower
|