2026-01-24 12:16:24 -05:00
|
|
|
{
|
2026-01-24 15:20:59 -05:00
|
|
|
# description = "OOTT - An easy to setup and use network device monitoring service";
|
2026-01-24 12:16:24 -05:00
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
outputs = {
|
|
|
|
|
self,
|
|
|
|
|
nixpkgs,
|
|
|
|
|
}: let
|
|
|
|
|
# System types to support.
|
|
|
|
|
supportedSystems = ["x86_64-linux"];
|
|
|
|
|
|
|
|
|
|
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
|
|
|
|
|
|
|
|
# Nixpkgs instantiated for supported system types.
|
|
|
|
|
nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
|
|
|
|
|
|
|
|
|
|
version = "0.0.1";
|
|
|
|
|
pname = "oott";
|
|
|
|
|
in {
|
|
|
|
|
packages = forAllSystems (system: let
|
|
|
|
|
pkgs = nixpkgsFor.${system};
|
|
|
|
|
in {
|
|
|
|
|
${pname} = pkgs.rustPlatform.buildRustPackage rec {
|
|
|
|
|
inherit pname;
|
|
|
|
|
inherit version;
|
|
|
|
|
src = ./.;
|
2026-01-24 12:28:22 -05:00
|
|
|
cargoLock = {
|
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
|
};
|
2026-01-24 14:43:46 -05:00
|
|
|
|
|
|
|
|
nativeBuildInputs = [pkgs.pkg-config];
|
|
|
|
|
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
|
2026-01-24 12:16:24 -05:00
|
|
|
};
|
|
|
|
|
});
|
2026-01-24 14:43:46 -05:00
|
|
|
|
|
|
|
|
nixosModule = forAllSystems (system: let
|
|
|
|
|
pkgs = nixpkgsFor.${system};
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
config,
|
|
|
|
|
lib,
|
|
|
|
|
pkgs,
|
|
|
|
|
...
|
|
|
|
|
}:
|
|
|
|
|
with lib; let
|
|
|
|
|
cfg = config.services.oott;
|
|
|
|
|
in {
|
|
|
|
|
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";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
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";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
});
|
2026-01-24 12:16:24 -05:00
|
|
|
};
|
|
|
|
|
}
|