2017-01-23 17:50:18 +03:00
|
|
|
{ stdenv, lib, bower2nix, cacert }:
|
2016-03-26 17:27:24 +03:00
|
|
|
let
|
|
|
|
bowerVersion = version:
|
|
|
|
let
|
|
|
|
components = lib.splitString "#" version;
|
|
|
|
hash = lib.last components;
|
|
|
|
ver = if builtins.length components == 1 then version else hash;
|
|
|
|
in ver;
|
|
|
|
|
|
|
|
fetchbower = name: version: target: outputHash: stdenv.mkDerivation {
|
|
|
|
name = "${name}-${bowerVersion version}";
|
2017-01-23 17:50:18 +03:00
|
|
|
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
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;
|
|
|
|
buildInputs = [ bower2nix ];
|
|
|
|
};
|
|
|
|
|
|
|
|
in fetchbower
|