1
0

modules/monitoring: add nixos-exporter

This commit is contained in:
clerie 2023-01-02 19:10:33 +01:00
parent fb4e0ecd33
commit 64122a7149
3 changed files with 57 additions and 1 deletions

View File

@ -1,5 +1,25 @@
{ {
"nodes": { "nodes": {
"nixos-exporter": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1672682716,
"narHash": "sha256-JCoUwtUoIR6Xtdx0Cdo6q6MbwX4V2XuL6TL6+KV0Grk=",
"ref": "refs/heads/main",
"rev": "698f36518d9ddf1ac773fac0a2781d668bb44916",
"revCount": 3,
"type": "git",
"url": "https://git.clerie.de/clerie/nixos-exporter.git"
},
"original": {
"type": "git",
"url": "https://git.clerie.de/clerie/nixos-exporter.git"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1667142599, "lastModified": 1667142599,
@ -18,6 +38,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"nixos-exporter": "nixos-exporter",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View File

@ -1,8 +1,12 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-exporter = {
url = "git+https://git.clerie.de/clerie/nixos-exporter.git";
inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { self, nixpkgs, ... }: let };
outputs = { self, nixpkgs, nixos-exporter, ... }: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
overlays = [ overlays = [
(import ./pkgs/overlay.nix) (import ./pkgs/overlay.nix)
@ -16,6 +20,14 @@
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./configuration/common ./configuration/common
({ ... }: {
nixpkgs.overlays = [
(_: _: {
inherit (nixos-exporter.packages.${system})
nixos-exporter;
})
];
})
(./hosts + "/${name}/configuration.nix") (./hosts + "/${name}/configuration.nix")
]; ];
}; };

View File

@ -76,5 +76,28 @@ in
ip_protocol_fallback: false ip_protocol_fallback: false
''; '';
}; };
users.users."nixos-exporter" = {
isSystemUser = true;
group = "nixos-exporter";
};
users.groups."nixos-exporter" = {};
systemd.services."prometheus-nixos-exporter" = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Restart = "always";
PrivateTmp = true;
WorkingDirectory = "/tmp";
RuntimeDirectory = "prometheus-nixos-exporter";
User = "nixos-exporter";
Group = "nixos-exporter";
ExecStart = ''
${pkgs.nixos-exporter}/bin/nixos-exporter
'';
};
};
}; };
} }