-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
66 lines (57 loc) · 1.54 KB
/
flake.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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, ... } @ inputs:
let
inherit (builtins) intersectAttrs;
inherit (inputs.nixpkgs) lib;
in
with lib;
let
systems = [
"aarch64-linux"
"armv7l-linux"
"i686-linux"
"x86_64-linux"
];
forAllSystems = fn: genAttrs systems (system:
fn (intersectAttrs (functionArgs fn) {
inherit system;
nixpkgs = inputs.nixpkgs.legacyPackages.${system};
}));
in
{
nixosModule = import ./module.nix { inherit self; };
packages = forAllSystems ({ system, nixpkgs }: rec {
openhab = nixpkgs.callPackage ./pkg.nix { };
openhabWithAddons = openhab.override { withAddons = true; };
});
checks = forAllSystems ({ system, nixpkgs }:
let
mkTest = withAddons: nixpkgs.nixosTest ({ pkgs, ... }: {
name = "openhab";
machine = { ... }: {
imports = [
self.nixosModule
];
config = {
services.openhab = {
enable = true;
inherit withAddons;
};
};
};
testScript = ''
start_all()
machine.wait_for_unit("openhab.service")
machine.succeed("openhab-cli status")
'';
});
in
{
openhab = mkTest false;
openhab-with-addons = mkTest true;
});
};
}