mirror of
https://codeberg.org/icewind/mitemp-prometheus.git
synced 2026-06-03 09:04:13 +02:00
fmt
This commit is contained in:
parent
8be6c6fe27
commit
95b0cb6c38
3 changed files with 43 additions and 42 deletions
|
|
@ -51,7 +51,8 @@ sensor_humidity{name="Sensor 2", mac="58:2d:34:39:1a:02"} 55.9
|
||||||
|
|
||||||
Licensed under either of
|
Licensed under either of
|
||||||
|
|
||||||
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||||
at your option.
|
at your option.
|
||||||
|
|
||||||
|
|
|
||||||
26
module.nix
26
module.nix
|
|
@ -1,25 +1,25 @@
|
||||||
{ config
|
{
|
||||||
, lib
|
config,
|
||||||
, pkgs
|
lib,
|
||||||
, ...
|
pkgs,
|
||||||
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.services.mitemp;
|
cfg = config.services.mitemp;
|
||||||
format = pkgs.formats.toml { };
|
format = pkgs.formats.toml {};
|
||||||
configFile = format.generate "mitemp-config.toml" {
|
configFile = format.generate "mitemp-config.toml" {
|
||||||
inherit (cfg) names;
|
inherit (cfg) names;
|
||||||
listen = {
|
listen = {
|
||||||
inherit (cfg) socket;
|
inherit (cfg) socket;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.services.mitemp = {
|
options.services.mitemp = {
|
||||||
enable = mkEnableOption "mitemp";
|
enable = mkEnableOption "mitemp";
|
||||||
|
|
||||||
names = mkOption {
|
names = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
default = { };
|
default = {};
|
||||||
description = "Names for mitemp sensors";
|
description = "Names for mitemp sensors";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -45,8 +45,8 @@ in
|
||||||
|
|
||||||
services.dbus.packages = [cfg.package];
|
services.dbus.packages = [cfg.package];
|
||||||
systemd.services."mitemp" = {
|
systemd.services."mitemp" = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = ["multi-user.target"];
|
||||||
after = [ "dbus.service" ];
|
after = ["dbus.service"];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${cfg.package}/bin/mitemp-prometheus ${configFile}";
|
ExecStart = "${cfg.package}/bin/mitemp-prometheus ${configFile}";
|
||||||
|
|
@ -68,18 +68,18 @@ in
|
||||||
ProtectHostname = true;
|
ProtectHostname = true;
|
||||||
LockPersonality = true;
|
LockPersonality = true;
|
||||||
ProtectKernelTunables = true;
|
ProtectKernelTunables = true;
|
||||||
RestrictAddressFamilies = [ "AF_UNIX" ];
|
RestrictAddressFamilies = ["AF_UNIX"];
|
||||||
RuntimeDirectory = "mitemp";
|
RuntimeDirectory = "mitemp";
|
||||||
RestrictRealtime = true;
|
RestrictRealtime = true;
|
||||||
ProtectProc = "invisible";
|
ProtectProc = "invisible";
|
||||||
SystemCallFilter = [ "@system-service" "~@resources" "~@privileged" ];
|
SystemCallFilter = ["@system-service" "~@resources" "~@privileged"];
|
||||||
IPAddressDeny = "any";
|
IPAddressDeny = "any";
|
||||||
PrivateUsers = true;
|
PrivateUsers = true;
|
||||||
ProcSubset = "pid";
|
ProcSubset = "pid";
|
||||||
RemoveIPC = true;
|
RemoveIPC = true;
|
||||||
PrivateDevices = true;
|
PrivateDevices = true;
|
||||||
RestrictSUIDSGID = true;
|
RestrictSUIDSGID = true;
|
||||||
BindPaths = [ "/run/dbus" ];
|
BindPaths = ["/run/dbus"];
|
||||||
};
|
};
|
||||||
|
|
||||||
confinement = {
|
confinement = {
|
||||||
|
|
|
||||||
20
package.nix
20
package.nix
|
|
@ -1,16 +1,16 @@
|
||||||
{ stdenv
|
{
|
||||||
, rustPlatform
|
stdenv,
|
||||||
, lib
|
rustPlatform,
|
||||||
, pkg-config
|
lib,
|
||||||
, dbus
|
pkg-config,
|
||||||
}:
|
dbus,
|
||||||
let
|
}: let
|
||||||
inherit (lib.sources) sourceByRegex;
|
inherit (lib.sources) sourceByRegex;
|
||||||
inherit (builtins) fromTOML readFile;
|
inherit (builtins) fromTOML readFile;
|
||||||
src = sourceByRegex ./. [ "Cargo.*" "(src)(/.*)?" ];
|
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"];
|
||||||
cargoToml = (fromTOML (readFile ./Cargo.toml)).package;
|
cargoToml = (fromTOML (readFile ./Cargo.toml)).package;
|
||||||
in
|
in
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage rec {
|
||||||
pname = cargoToml.name;
|
pname = cargoToml.name;
|
||||||
|
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
@ -35,4 +35,4 @@ rustPlatform.buildRustPackage rec {
|
||||||
"btleplug-0.11.6" = "sha256-Y9QZ6er/zaXALiQUUw8mMvzg15Dhz9NsWQ2WAM/ouh0=";
|
"btleplug-0.11.6" = "sha256-Y9QZ6er/zaXALiQUUw8mMvzg15Dhz9NsWQ2WAM/ouh0=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue