mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-19 08:31:01 +03:00

After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev 0128fbb0a5
result/bin/apply-formatting $NIXPKGS_PATH
80 lines
1.7 KiB
Nix
80 lines
1.7 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
options,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.prometheus.exporters.smartctl;
|
|
|
|
inherit (lib) mkOption types literalExpression;
|
|
|
|
args = lib.escapeShellArgs (
|
|
[
|
|
"--web.listen-address=${cfg.listenAddress}:${toString cfg.port}"
|
|
"--smartctl.interval=${cfg.maxInterval}"
|
|
]
|
|
++ map (device: "--smartctl.device=${device}") cfg.devices
|
|
++ cfg.extraFlags
|
|
);
|
|
|
|
in
|
|
{
|
|
port = 9633;
|
|
|
|
extraOpts = {
|
|
devices = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [ ];
|
|
example = literalExpression ''
|
|
[ "/dev/sda", "/dev/nvme0n1" ];
|
|
'';
|
|
description = ''
|
|
Paths to the disks that will be monitored. Will autodiscover
|
|
all disks if none given.
|
|
'';
|
|
};
|
|
|
|
maxInterval = mkOption {
|
|
type = types.str;
|
|
default = "60s";
|
|
example = "2m";
|
|
description = ''
|
|
Interval that limits how often a disk can be queried.
|
|
'';
|
|
};
|
|
};
|
|
|
|
serviceOpts = {
|
|
serviceConfig = {
|
|
AmbientCapabilities = [
|
|
"CAP_SYS_RAWIO"
|
|
"CAP_SYS_ADMIN"
|
|
];
|
|
CapabilityBoundingSet = [
|
|
"CAP_SYS_RAWIO"
|
|
"CAP_SYS_ADMIN"
|
|
];
|
|
DevicePolicy = "closed";
|
|
DeviceAllow = lib.mkOverride 50 [
|
|
"block-blkext rw"
|
|
"block-sd rw"
|
|
"char-nvme rw"
|
|
];
|
|
ExecStart = "${pkgs.prometheus-smartctl-exporter}/bin/smartctl_exporter ${args}";
|
|
PrivateDevices = lib.mkForce false;
|
|
ProtectProc = "invisible";
|
|
ProcSubset = "pid";
|
|
SupplementaryGroups = [
|
|
"disk"
|
|
"smartctl-exporter-access"
|
|
];
|
|
SystemCallFilter = [
|
|
"@system-service"
|
|
"~@privileged"
|
|
];
|
|
};
|
|
};
|
|
}
|