Show More
@@ -0,0 +1,60 b'' | |||
|
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. | |
|
3 | # | |
|
4 | # This file can be removed once building with 16.03 is not needed anymore. | |
|
5 | ||
|
6 | { pkgs }: | |
|
7 | ||
|
8 | { buildInputs ? [], generated, ... } @ attrs: | |
|
9 | ||
|
10 | let | |
|
11 | fetchbower = import ./backport-16.03-fetchbower.nix { | |
|
12 | inherit (pkgs) stdenv lib; | |
|
13 | inherit (pkgs.nodePackages) bower2nix; | |
|
14 | }; | |
|
15 | ||
|
16 | # Fetches the bower packages. `generated` should be the result of a | |
|
17 | # `bower2nix` command. | |
|
18 | bowerPackages = import generated { | |
|
19 | inherit (pkgs) buildEnv; | |
|
20 | inherit fetchbower; | |
|
21 | }; | |
|
22 | ||
|
23 | in pkgs.stdenv.mkDerivation ( | |
|
24 | attrs | |
|
25 | // | |
|
26 | { | |
|
27 | name = "bower_components-" + attrs.name; | |
|
28 | ||
|
29 | inherit bowerPackages; | |
|
30 | ||
|
31 | builder = builtins.toFile "builder.sh" '' | |
|
32 | source $stdenv/setup | |
|
33 | ||
|
34 | # The project's bower.json is required | |
|
35 | cp $src/bower.json . | |
|
36 | ||
|
37 | # Dereference symlinks -- bower doesn't like them | |
|
38 | cp --recursive --reflink=auto \ | |
|
39 | --dereference --no-preserve=mode \ | |
|
40 | $bowerPackages bc | |
|
41 | ||
|
42 | # Bower install in offline mode -- links together the fetched | |
|
43 | # bower packages. | |
|
44 | HOME=$PWD bower \ | |
|
45 | --config.storage.packages=bc/packages \ | |
|
46 | --config.storage.registry=bc/registry \ | |
|
47 | --offline install | |
|
48 | ||
|
49 | # Sets up a single bower_components directory within | |
|
50 | # the output derivation. | |
|
51 | mkdir -p $out | |
|
52 | mv bower_components $out | |
|
53 | ''; | |
|
54 | ||
|
55 | buildInputs = buildInputs ++ [ | |
|
56 | pkgs.git | |
|
57 | pkgs.nodePackages.bower | |
|
58 | ]; | |
|
59 | } | |
|
60 | ) |
@@ -0,0 +1,26 b'' | |||
|
1 | { stdenv, lib, bower2nix }: | |
|
2 | let | |
|
3 | bowerVersion = version: | |
|
4 | let | |
|
5 | components = lib.splitString "#" version; | |
|
6 | hash = lib.last components; | |
|
7 | ver = if builtins.length components == 1 then version else hash; | |
|
8 | in ver; | |
|
9 | ||
|
10 | fetchbower = name: version: target: outputHash: stdenv.mkDerivation { | |
|
11 | name = "${name}-${bowerVersion version}"; | |
|
12 | buildCommand = '' | |
|
13 | fetch-bower --quiet --out=$PWD/out "${name}" "${target}" "${version}" | |
|
14 | # In some cases, the result of fetchBower is different depending | |
|
15 | # on the output directory (e.g. if the bower package contains | |
|
16 | # symlinks). So use a local output directory before copying to | |
|
17 | # $out. | |
|
18 | cp -R out $out | |
|
19 | ''; | |
|
20 | outputHashMode = "recursive"; | |
|
21 | outputHashAlgo = "sha256"; | |
|
22 | inherit outputHash; | |
|
23 | buildInputs = [ bower2nix ]; | |
|
24 | }; | |
|
25 | ||
|
26 | in fetchbower |
@@ -30,6 +30,10 b' let' | |||
|
30 | 30 | then pythonPackages |
|
31 | 31 | else getAttr pythonPackages pkgs; |
|
32 | 32 | |
|
33 | buildBowerComponents = | |
|
34 | pkgs.buildBowerComponents or | |
|
35 | (import ./pkgs/backport-16.03-build-bower-components.nix { inherit pkgs; }); | |
|
36 | ||
|
33 | 37 | elem = builtins.elem; |
|
34 | 38 | basename = path: with pkgs.lib; last (splitString "/" path); |
|
35 | 39 | startsWith = prefix: full: let |
@@ -58,7 +62,7 b' let' | |||
|
58 | 62 | }; |
|
59 | 63 | nodeDependencies = nodeEnv.shell.nodeDependencies; |
|
60 | 64 | |
|
61 |
bowerComponents = |
|
|
65 | bowerComponents = buildBowerComponents { | |
|
62 | 66 | name = "enterprise-ce-${version}"; |
|
63 | 67 | generated = ./pkgs/bower-packages.nix; |
|
64 | 68 | src = rhodecode-enterprise-ce-src; |
General Comments 0
You need to be logged in to leave comments.
Login now