tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
gclient2nix: add importGclientDeps & gclientUnpackHook
Yureka
11 months ago
0e730af4
082d26cd
+72
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
gc
gclient2nix
gclient-unpack-hook.sh
package.nix
+28
pkgs/by-name/gc/gclient2nix/gclient-unpack-hook.sh
···
1
1
+
# shellcheck shell=bash
2
2
+
3
3
+
gclientUnpackHook() {
4
4
+
echo "Executing gclientUnpackHook"
5
5
+
6
6
+
runHook preUnpack
7
7
+
8
8
+
if [ -z "${gclientDeps-}" ]; then
9
9
+
echo "gclientDeps missing"
10
10
+
exit 1
11
11
+
fi
12
12
+
13
13
+
for dep in $(@jq@ -c "to_entries[]" "$gclientDeps")
14
14
+
do
15
15
+
local name="$(echo "$dep" | @jq@ -r .key)"
16
16
+
echo "copying $name..."
17
17
+
local path="$(echo "$dep" | @jq@ -r .value.path)"
18
18
+
mkdir -p $(dirname "$name")
19
19
+
cp -r "$path/." "$name"
20
20
+
chmod u+w -R "$name"
21
21
+
done
22
22
+
23
23
+
runHook postUnpack
24
24
+
}
25
25
+
26
26
+
if [ -z "${dontGclientUnpack-}" ] && [ -z "${unpackPhase-}" ]; then
27
27
+
unpackPhase=(gclientUnpackHook)
28
28
+
fi
+44
pkgs/by-name/gc/gclient2nix/package.nix
···
6
6
path,
7
7
fetchgit,
8
8
nurl,
9
9
+
writers,
10
10
+
callPackage,
11
11
+
fetchFromGitiles,
12
12
+
fetchFromGitHub,
9
13
}:
10
14
11
15
let
16
16
+
fetchers = {
17
17
+
inherit fetchgit fetchFromGitiles fetchFromGitHub;
18
18
+
};
19
19
+
20
20
+
importGclientDeps =
21
21
+
depsAttrsOrFile:
22
22
+
let
23
23
+
depsAttrs = if lib.isAttrs depsAttrsOrFile then depsAttrsOrFile else lib.importJSON depsAttrsOrFile;
24
24
+
fetchdep = dep: fetchers.${dep.fetcher} dep.args;
25
25
+
fetchedDeps = lib.mapAttrs (_name: fetchdep) depsAttrs;
26
26
+
manifestContents = lib.mapAttrs (_: dep: {
27
27
+
path = dep;
28
28
+
}) fetchedDeps;
29
29
+
manifest = writers.writeJSON "gclient-manifest.json" manifestContents;
30
30
+
in
31
31
+
manifestContents
32
32
+
// {
33
33
+
inherit manifest;
34
34
+
__toString = _: manifest;
35
35
+
};
36
36
+
37
37
+
gclientUnpackHook = callPackage (
38
38
+
{
39
39
+
lib,
40
40
+
makeSetupHook,
41
41
+
jq,
42
42
+
}:
43
43
+
44
44
+
makeSetupHook {
45
45
+
name = "gclient-unpack-hook";
46
46
+
substitutions = {
47
47
+
jq = lib.getExe jq;
48
48
+
};
49
49
+
} ./gclient-unpack-hook.sh
50
50
+
) { };
51
51
+
12
52
python = python3.withPackages (
13
53
ps: with ps; [
14
54
joblib
···
31
71
url = "https://chromium.googlesource.com/chromium/tools/depot_tools";
32
72
rev = "452fe3be37f78fbecefa1b4b0d359531bcd70d0d";
33
73
hash = "sha256-8IiJOm0FLa/u1Vd96tb33Ruj4IUTCeYgBpTk88znhPw=";
74
74
+
};
75
75
+
76
76
+
passthru = {
77
77
+
inherit fetchers importGclientDeps gclientUnpackHook;
34
78
};
35
79
}
36
80
''