-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdefault.nix
67 lines (56 loc) · 2.04 KB
/
default.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
{ holoport ? { outPath = ./.; revCount = 0; shortRev = "master"; }
, nixpkgs ? { outPath = fetchTarball "https://github.com/Holo-Host/nixpkgs-channels/archive/nixos-18.09.tar.gz";
revCount = 0; shortRev = "latest"; }
, system ? builtins.currentSystem, nixpkgsArgs ? { config = { allowUnfree = true; inHydra = true; }; }
}:
let
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
nixpkgsVersion = lib.fileContents "${nixpkgs}/.version";
nixpkgsVersionSuffix = ".${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
mkTest = import "${nixpkgs}/nixos/tests/make-test.nix";
mkTestJob = t:
let
job = lib.hydraJob ((mkTest (import t)) { inherit system; });
in {
name = lib.removePrefix "vm-test-run-" job.name;
value = job;
};
in
rec {
tests = lib.listToAttrs (map mkTestJob (import ./tests/all-tests.nix));
iso = import lib/make-iso.nix { inherit nixpkgs system holoport nixpkgsVersionSuffix; };
channels.nixpkgs = import "${nixpkgs}/nixos/lib/make-channel.nix" {
inherit pkgs nixpkgs;
version = nixpkgsVersion;
versionSuffix = nixpkgsVersionSuffix;
};
channels.holoport = pkgs.releaseTools.makeSourceTarball {
name = "holoport";
src = holoport;
version = lib.fileContents ./.version;
versionSuffix = ".${toString holoport.revCount}.${holoport.shortRev}";
distPhase = ''
rm -rf .git*
echo -n "$VERSION_SUFFIX" > .version-suffix
echo -n ${holoport.rev or holoport.shortRev} > .git-revision
releaseName=holoport-$VERSION$VERSION_SUFFIX
mkdir -p $out/tarballs
cp -prd . ../$releaseName
cd ..
chmod -R u+w $releaseName
tar cfJ $out/tarballs/$releaseName.tar.xz $releaseName
'';
};
tested = lib.hydraJob (pkgs.releaseTools.aggregate {
name = "nixos-${channels.nixpkgs.version}+holoport-${channels.holoport.version}";
meta = {
description = "Release-critical builds for holoportOS";
};
constituents = [
iso
channels.nixpkgs
channels.holoport
] ++ (lib.attrValues tests);
});
}