-
Notifications
You must be signed in to change notification settings - Fork 29
/
release.nix
90 lines (71 loc) · 2.46 KB
/
release.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ minibsdiff ? { outPath = ./.; revCount = 0; shortRev = "abcdef"; rev = "HEAD"; }
, officialRelease ? false
}:
let
pkgs = import <nixpkgs> { };
systems = [ "i686-linux" "x86_64-linux" ];
version = "0.0.1" + (pkgs.lib.optionalString (!officialRelease)
"-pre${toString minibsdiff.revCount}_${minibsdiff.shortRev}");
jobs = rec {
## -- Tarballs -------------------------------------------------------------
tarball = pkgs.releaseTools.sourceTarball {
name = "minibsdiff-tarball";
src = minibsdiff;
inherit version;
officialRelease = true; # hack
buildInputs = [ pkgs.git pkgs.xz ];
distPhase = ''
relname=minibsdiff-${version}
mkdir ../$relname
cp -prd . ../$relname
rm -rf ../$relname/.git ../$relname/svn-revision
mkdir $out/tarballs
tar cvfJ $out/tarballs/$relname.tar.xz -C .. $relname
'';
};
## -- Build ----------------------------------------------------------------
build = pkgs.lib.genAttrs systems (system:
with import <nixpkgs> { inherit system; };
releaseTools.nixBuild {
name = "minibsdiff";
src = tarball;
enableParallelBuilding = true;
doCheck = false;
installPhase = "make install PREFIX=$out";
}
);
## -- Release build --------------------------------------------------------
release = pkgs.releaseTools.aggregate
{ name = "minibsdiff-${tarball.version}";
constituents =
[ tarball
build.x86_64-linux
];
meta.description = "Release-critical builds";
};
};
## -- Utilities --------------------------------------------------------------
makeRPM_i686 = makeRPM "i686-linux";
makeRPM_x86_64 = makeRPM "x86_64-linux";
makeRPM =
system: diskImageFun: prio:
with import <nixpkgs> { inherit system; };
releaseTools.rpmBuild rec {
name = "minibsdiff-rpm";
src = jobs.tarball;
diskImage = diskImageFun vmTools.diskImages;
meta = { schedulingPriority = prio; };
};
makeDeb_i686 = makeDeb "i686-linux";
makeDeb_x86_64 = makeDeb "x86_64-linux";
makeDeb =
system: diskImageFun: prio:
with import <nixpkgs> { inherit system; };
releaseTools.debBuild {
name = "minibsdiff-deb";
src = jobs.tarball;
diskImage = diskImageFun vmTools.diskImages;
meta = { schedulingPriority = prio; };
debMaintainer = "Austin Seipp <[email protected]>";
};
in jobs