-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.sh
executable file
·66 lines (50 loc) · 1.63 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
set -euo pipefail
: "${NIXPKGS}"
wififw_models=(
MacBookAir8,1
MacBookAir9,1
MacBookPro15,1
MacBookPro15,2
MacBookPro15,3
MacBookPro16,1
MacBookPro16,2
)
packages=(
kernel/linux-mbp
)
modules=(
apple-bce
apple-ib-drv
)
built_drvs=()
nnix () {
nix --extra-experimental-features 'nix-command flakes' "${@}"
}
for p in ${packages[@]}; do
echo ">>> Building '${p}'"
drv="$(nix-build --no-out-link -I nixpkgs="${NIXPKGS}" -E 'let pkgs = import <nixpkgs> {}; in pkgs.callPackage ./packages/'"${p}"' {}')"
built_drvs+=($(nnix show-derivation "${drv}" | jq -r '.[keys[0]].outputs | .[].path'))
echo ">>> Built '${p}' (-> '${drv}')"
du -sh "${drv}"
done
for model in ${wififw_models[@]}; do
p='firmware/apple-wifi-firmware'
echo ">>> Building '${p}' for model '${model}'"
drv="$(nix-build --no-out-link -I nixpkgs="${NIXPKGS}" -E 'let pkgs = import <nixpkgs> {}; in pkgs.callPackage ./packages/'"${p}"' { macModel = "'"${model}"'"; }')"
built_drvs+=($(nnix show-derivation "${drv}" | jq -r '.[keys[0]].outputs | .[].path'))
echo ">>> Built '${p}' (-> '${drv}')"
du -sh "${drv}"
done
for p in ${modules[@]}; do
echo ">>> Building '${p}'"
drv="$(nix-build --no-out-link -I nixpkgs="${NIXPKGS}" -E 'let pkgs = import <nixpkgs> {}; mbp = pkgs.callPackage ./packages/kernel/linux-mbp {}; in pkgs.callPackage ./packages/kernel-modules/'"${p}"' { kernel = mbp; }')"
built_drvs+=($(nnix show-derivation "${drv}" | jq -r '.[keys[0]].outputs | .[].path'))
echo ">>> Built '${p}' (-> '${drv}')"
du -sh "${drv}"
done
if [ -n "${CACHIX_AUTH_TOKEN:-}" ]; then
for d in ${built_drvs[@]}; do
cachix push t2linux "${d}"
done
fi