mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
51 lines
1.1 KiB
Nix
51 lines
1.1 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib ? pkgs.lib,
|
|
...
|
|
}:
|
|
with lib; let
|
|
cfg = config.services.oott;
|
|
in {
|
|
# Service options
|
|
options.services.oott = rec {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to run the oott service
|
|
'';
|
|
};
|
|
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 = "${pkgs.oott}/bin/oott ${
|
|
builtins.toFile "oott.toml"
|
|
(generators.toTOML {} cfg)
|
|
}";
|
|
# ExecStart = "${pkgs.oott}/bin/oott";
|
|
ProtectHome = "read-only";
|
|
Restart = "on-failure";
|
|
Type = "exec";
|
|
};
|
|
};
|
|
};
|
|
}
|