mirror of
https://codeberg.org/icewind/wifi-prometheus-exporter.git
synced 2026-06-03 08:34:25 +02:00
fmt
This commit is contained in:
parent
a531df8b3f
commit
dfb6dd0b57
3 changed files with 44 additions and 45 deletions
23
flake.nix
23
flake.nix
|
|
@ -10,22 +10,23 @@
|
|||
inputs.flakelight.follows = "flakelight";
|
||||
};
|
||||
};
|
||||
outputs = { mill-scale, ... }: mill-scale ./. {
|
||||
packages.wifi-prometheus-exporter = import ./package.nix;
|
||||
outputs = {mill-scale, ...}:
|
||||
mill-scale ./. {
|
||||
packages.wifi-prometheus-exporter = import ./package.nix;
|
||||
|
||||
nixosModules = { outputs, ... }: {
|
||||
default =
|
||||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
nixosModules = {outputs, ...}: {
|
||||
default = {
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [ ./module.nix ];
|
||||
imports = [./module.nix];
|
||||
config = {
|
||||
nixpkgs.overlays = [ outputs.overlays.default ];
|
||||
nixpkgs.overlays = [outputs.overlays.default];
|
||||
services.prometheus.exporters.wifi.package = lib.mkDefault pkgs.wifi-prometheus-exporter;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
21
module.nix
21
module.nix
|
|
@ -1,11 +1,12 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.services.prometheus.exporters.wifi;
|
||||
format = pkgs.formats.toml { };
|
||||
format = pkgs.formats.toml {};
|
||||
configFile = format.generate "wifi-prometheus-exporter-config.toml" {
|
||||
ssh = {
|
||||
inherit (cfg.ssh) address user;
|
||||
|
|
@ -20,9 +21,7 @@ with lib; let
|
|||
password_file = "$CREDENTIALS_DIRECTORY/mqtt_password";
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.services.prometheus.exporters.wifi = {
|
||||
enable = mkEnableOption "WiFi prometheus exporter";
|
||||
|
||||
|
|
@ -99,7 +98,7 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services."wifi-prometheus-exporter" = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wantedBy = ["multi-user.target"];
|
||||
environment = {
|
||||
RUST_LOG = cfg.log;
|
||||
};
|
||||
|
|
@ -133,9 +132,9 @@ in
|
|||
RestrictAddressFamilies = "AF_INET AF_INET6";
|
||||
RestrictRealtime = true;
|
||||
ProtectProc = "noaccess";
|
||||
SystemCallFilter = [ "@system-service" "~@resources" "~@privileged" ];
|
||||
SystemCallFilter = ["@system-service" "~@resources" "~@privileged"];
|
||||
IPAddressDeny = "any";
|
||||
IPAddressAllow = [ "192.168.0.0/16" "localhost" ];
|
||||
IPAddressAllow = ["192.168.0.0/16" "localhost"];
|
||||
PrivateUsers = true;
|
||||
ProcSubset = "pid";
|
||||
};
|
||||
|
|
|
|||
45
package.nix
45
package.nix
|
|
@ -1,30 +1,29 @@
|
|||
{ rustPlatform
|
||||
, openssl
|
||||
, pkg-config
|
||||
, lib
|
||||
,
|
||||
}:
|
||||
let
|
||||
{
|
||||
rustPlatform,
|
||||
openssl,
|
||||
pkg-config,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.sources) sourceByRegex;
|
||||
src = sourceByRegex ./. [ "Cargo.*" "(src)(/.*)?" ];
|
||||
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"];
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "wifi-prometheus-exporter";
|
||||
version = "0.1.0";
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "wifi-prometheus-exporter";
|
||||
version = "0.1.0";
|
||||
|
||||
inherit src;
|
||||
inherit src;
|
||||
|
||||
buildInputs = [
|
||||
openssl
|
||||
];
|
||||
buildInputs = [
|
||||
openssl
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
doCheck = false;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
}
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue