-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
52 lines (46 loc) · 1.67 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
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixpkgs-unstable";
outputs = { self, nixpkgs }:
let
systems = [ "aarch64-linux" "x86_64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
nixosModules.default = { config, lib, pkgs, ... }: {
imports = [ ./nix/module.nix ];
services.prometheus.exporters.cgroup.package =
lib.mkDefault self.packages.${pkgs.system}.default;
};
overlays.default = final: prev: {
cgroup-exporter = final.callPackage ./nix/package.nix { };
};
packages = forAllSystems (system: {
default = import ./nix/package.nix {
inherit (nixpkgs.legacyPackages.${system}) buildGoModule;
};
});
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt);
devShells = forAllSystems (system: {
default = with nixpkgs.legacyPackages.${system};
mkShell {
name = "cgroups-exporter";
nativeBuildInputs = [ go ];
};
});
checks = forAllSystems (system: {
package = self.packages.${system}.default;
integration-test = nixpkgs.lib.nixos.runTest {
name = "cgroup-exporter";
hostPkgs = nixpkgs.legacyPackages.${system};
nodes.machine = {
imports = [ self.nixosModules.default ];
services.prometheus.exporters.cgroup.enable = true;
services.prometheus.exporters.cgroup.port = 8080;
};
testScript = ''
machine.wait_for_unit("cgroup-exporter.service");
machine.succeed("curl http://localhost:8080/metrics");
'';
};
});
};
}