pscand/nix/modules/nixos.nix
NotAShelf d8f0bf3b09
nix: add package & NixOS module
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I5bfbacb984356f912f1f40d6209f0a896a6a6964
2026-02-19 00:13:18 +03:00

38 lines
996 B
Nix

self: {
config,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) package;
cfg = config.services.pscand;
in {
options.services.pscand = {
enable = mkEnableOption "Pluggable System Condition Monitoring Daemon";
package = mkOption {
type = package;
default = self.packages.${pkgs.hostPlatform.system.pscand};
defaultText = "self.packages.$${pkgs.hostPlatform.system}.pscand";
description = "The pscand package to use";
};
};
config = mkIf cfg.enable {
systemd.packages = [cfg.package];
systemd.services.pscand = {
wantedBy = ["multi-user.target"];
after = ["network.target"];
serviceConfig = {
Type = "simple";
ExecStart = "${cfg.package}/bin/pscand";
Restart = "on-failure";
RestartSec = "5s";
Environment = ["${cfg.package}/lib/pscand/scanners"]; # FIXME: make this configurable
};
};
};
}