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