mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
50 lines
1.1 KiB
Nix
50 lines
1.1 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib ? pkgs.lib,
|
|
...
|
|
}:
|
|
with lib; let
|
|
cfg = config.services.oott;
|
|
in {
|
|
# Service options
|
|
options.services.oott = {
|
|
enable = mkEnableOption "Enable oott as a service";
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = self.packages.${system}.oott;
|
|
description = "oott package to use";
|
|
};
|
|
networking.interface = mkOption {
|
|
type = types.str;
|
|
description = "Network interface to use for scans";
|
|
default = "eno1";
|
|
};
|
|
log.level = mkOption {
|
|
type = types.str;
|
|
description = "Log level for the oott service";
|
|
default = "info";
|
|
};
|
|
};
|
|
|
|
# Service implementation
|
|
config = mkIf cfg.enable {
|
|
environment.systemPackages = [pkgs.oott];
|
|
systemd.services.oott = {
|
|
description = "oott - network device scanner";
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
serviceConfig = {
|
|
ExecStart = "${cfg.package}/bin/oott ${
|
|
builtins.toFile "oott.toml"
|
|
(generators.toTOML {} cfg)
|
|
}";
|
|
ProtectHome = "read-only";
|
|
Restart = "on-failure";
|
|
Type = "exec";
|
|
};
|
|
};
|
|
};
|
|
}
|