Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 stdenvNoCC,
3 lib,
4 bower2nix,
5 cacert,
6}:
7let
8 bowerVersion =
9 version:
10 let
11 components = lib.splitString "#" version;
12 hash = lib.last components;
13 ver = if builtins.length components == 1 then (cleanName version) else hash;
14 in
15 ver;
16
17 cleanName = name: lib.replaceStrings [ "/" ":" ] [ "-" "-" ] name;
18
19 fetchbower =
20 name: version: target: outputHash:
21 stdenvNoCC.mkDerivation {
22 name = "${cleanName name}-${bowerVersion version}";
23 buildCommand = ''
24 fetch-bower --quiet --out=$PWD/out "${name}" "${target}" "${version}"
25 # In some cases, the result of fetchBower is different depending
26 # on the output directory (e.g. if the bower package contains
27 # symlinks). So use a local output directory before copying to
28 # $out.
29 cp -R out $out
30 '';
31 outputHashMode = "recursive";
32 outputHashAlgo = "sha256";
33 inherit outputHash;
34 nativeBuildInputs = [
35 bower2nix
36 cacert
37 ];
38 };
39
40in
41fetchbower