Show More
@@ -1,60 +1,67 b'' | |||
|
1 | 1 | # Backported buildBowerComponents so that we can also use it with the version |
|
2 | 2 | # 16.03 which is the current stable at the time of this writing. |
|
3 | 3 | # |
|
4 | 4 | # This file can be removed once building with 16.03 is not needed anymore. |
|
5 | 5 | |
|
6 | 6 | { pkgs }: |
|
7 | 7 | |
|
8 | 8 | { buildInputs ? [], generated, ... } @ attrs: |
|
9 | 9 | |
|
10 | 10 | let |
|
11 | bower2nix-src = pkgs.fetchzip { | |
|
12 | url = "https://github.com/rvl/bower2nix/archive/v3.0.1.tar.gz"; | |
|
13 | sha256 = "1zbvz96k2j6g0r4lvm5cgh41a73k9dgayk7x63cmg538dzznxvyb"; | |
|
14 | }; | |
|
15 | ||
|
16 | bower2nix = import "${bower2nix-src}/default.nix" { inherit pkgs; }; | |
|
17 | ||
|
11 | 18 | fetchbower = import ./backport-16.03-fetchbower.nix { |
|
12 | 19 | inherit (pkgs) stdenv lib; |
|
13 |
inherit |
|
|
20 | inherit bower2nix; | |
|
14 | 21 | }; |
|
15 | 22 | |
|
16 | 23 | # Fetches the bower packages. `generated` should be the result of a |
|
17 | 24 | # `bower2nix` command. |
|
18 | 25 | bowerPackages = import generated { |
|
19 | 26 | inherit (pkgs) buildEnv; |
|
20 | 27 | inherit fetchbower; |
|
21 | 28 | }; |
|
22 | 29 | |
|
23 | 30 | in pkgs.stdenv.mkDerivation ( |
|
24 | 31 | attrs |
|
25 | 32 | // |
|
26 | 33 | { |
|
27 | 34 | name = "bower_components-" + attrs.name; |
|
28 | 35 | |
|
29 | 36 | inherit bowerPackages; |
|
30 | 37 | |
|
31 | 38 | builder = builtins.toFile "builder.sh" '' |
|
32 | 39 | source $stdenv/setup |
|
33 | 40 | |
|
34 | 41 | # The project's bower.json is required |
|
35 | 42 | cp $src/bower.json . |
|
36 | 43 | |
|
37 | 44 | # Dereference symlinks -- bower doesn't like them |
|
38 | 45 | cp --recursive --reflink=auto \ |
|
39 | 46 | --dereference --no-preserve=mode \ |
|
40 | 47 | $bowerPackages bc |
|
41 | 48 | |
|
42 | 49 | # Bower install in offline mode -- links together the fetched |
|
43 | 50 | # bower packages. |
|
44 | 51 | HOME=$PWD bower \ |
|
45 | 52 | --config.storage.packages=bc/packages \ |
|
46 | 53 | --config.storage.registry=bc/registry \ |
|
47 | 54 | --offline install |
|
48 | 55 | |
|
49 | 56 | # Sets up a single bower_components directory within |
|
50 | 57 | # the output derivation. |
|
51 | 58 | mkdir -p $out |
|
52 | 59 | mv bower_components $out |
|
53 | 60 | ''; |
|
54 | 61 | |
|
55 | 62 | buildInputs = buildInputs ++ [ |
|
56 | 63 | pkgs.git |
|
57 | 64 | pkgs.nodePackages.bower |
|
58 | 65 | ]; |
|
59 | 66 | } |
|
60 | 67 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now