1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-11 07:04:28 +00:00
nixpkgs/pkgs/build-support/fetchbower/default.nix
Tuomas Tynkkynen 6ed0fe7e45 Merge remote-tracking branch 'upstream/master' into staging
Conflicts:
	pkgs/build-support/fetchbower/default.nix
	pkgs/build-support/fetchdarcs/default.nix
	pkgs/build-support/fetchgx/default.nix
	pkgs/development/python-modules/botocore/default.nix
	pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix
	pkgs/tools/admin/awscli/default.nix
2018-01-14 21:18:27 +02:00

29 lines
958 B
Nix

{ stdenvNoCC, lib, bower2nix, cacert }:
let
bowerVersion = version:
let
components = lib.splitString "#" version;
hash = lib.last components;
ver = if builtins.length components == 1 then (cleanName version) else hash;
in ver;
cleanName = name: lib.replaceStrings ["/" ":"] ["-" "-"] name;
fetchbower = name: version: target: outputHash: stdenvNoCC.mkDerivation {
name = "${cleanName name}-${bowerVersion version}";
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;
nativeBuildInputs = [ bower2nix cacert ];
};
in fetchbower