nixpkgs/pkgs/build-support/fetchbower/default.nix
Rodney Lorrimar 457eddd18f bower2nix: 2.1.0 -> 3.0.1
1. Update bower2nix version and add new/updated dependencies into
   node-packages-generated.nix. This was done manually, with npm2nix
   generating the initial set of derivations. In future, it would be
   nice to have an automatic process (see #10358, #9332).

2. Add an override to nodePackages.bower2nix wrapping the commands so
   that git is on the PATH.

3. Update fetchbower to support new command-line options of bower2nix,
   and to allow github URL tag versions.
2016-03-28 08:23:06 +01:00

27 lines
841 B
Nix

{ stdenv, lib, bower2nix }:
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}";
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