Skip to content

Commit dbe4e6f

Browse files
committed
Update test builder
1 parent 4bfd50d commit dbe4e6f

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

test/default.nix

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,36 @@ let
3636
];
3737
};
3838

39-
fetch-bower = import ./.. { inherit pkgs; };
39+
bower2nix = import ./.. { inherit pkgs; };
4040

4141
# fetch-bower-3.0.0 has different command line args from fetch-bower-2.0.0
4242
# nixpkgs will need a pull request for this change.
4343
# Also the quoting of fetch-bower arguments was fixed
4444
fetchbower = name: version: target: outputHash: pkgs.stdenv.mkDerivation {
45-
name = "${name}-${version}";
46-
buildCommand = "fetch-bower --out=$out '${name}' '${target}' '${version}'";
45+
name = "${name}-${bowerVersion version}";
46+
buildCommand = "fetch-bower --quiet --out=$out '${name}' '${target}' '${version}'";
4747
outputHashMode = "recursive";
4848
outputHashAlgo = "sha256";
4949
inherit outputHash;
50-
buildInputs = [pkgs.git fetch-bower];
50+
buildInputs = [ bower2nix ];
51+
};
52+
53+
bowerVersion = version:
54+
let
55+
components = pkgs.lib.splitString "#" version;
56+
hash = pkgs.lib.last components;
57+
ver = if builtins.length components == 1 then version else hash;
58+
in ver;
59+
60+
61+
# running bower2nix from nix can't really work properly.
62+
bowerGeneratedNix = pkgs.stdenv.mkDerivation {
63+
name = "bower-generated.nix";
64+
src = test;
65+
buildInputs = [ bower2nix ];
66+
buildPhase = "bower2nix bower.json $out";
67+
installPhase = "true";
68+
preferLocalBuild = true;
5169
};
5270

5371
in bowerComponents

0 commit comments

Comments
 (0)