-
Notifications
You must be signed in to change notification settings - Fork 10
/
all.nix
42 lines (36 loc) · 1.01 KB
/
all.nix
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
{ tarball ? false }:
let
arm = import ./arm.nix;
x86 = import ./x8664.nix;
pkgs = import ./nix {};
all = pkgs.buildEnv {
name = "all-pxe-images";
paths = [ x86 arm ];
};
allWithTarball = pkgs.runCommand "all-pxe-images-with-tarball" {} ''
now=$(date '+%Y-%m-%d--%H-%M-%S')
cp -r ${all} "./nixos-netboot-images-$now"
chmod u+w "./nixos-netboot-images-$now"
(
cd "./nixos-netboot-images-$now"
sha1sum ./*/* > sha1sums
)
tar --create \
--verbose \
--bzip2 \
--dereference \
--file "./nixos-netboot-images-$now.tar.bz2" \
"./nixos-netboot-images-$now"
mv "./nixos-netboot-images-$now" $out
mv "./nixos-netboot-images-$now.tar.bz2" $out/
'';
in pkgs.runCommand "indexed-pxe-images" {} ''
cp -r ${if tarball then allWithTarball else all} $out
chmod u+w $out
cd $out
for f in $(find -L . -name 'netboot.ipxe' -o -name '*.bz2' | sort -h); do
printf '<li><a href="%s">%s</a></li>\n' \
$f \
$f;
done > $out/index.html
''