nix/module: init
Some checks failed
Build and test / check (push) Failing after 55s
Build and test / test (push) Failing after 1m32s
Build and test / build (push) Successful in 1m36s
Build and test / docs (push) Failing after 1m59s

This commit is contained in:
2026-01-05 02:30:25 +09:00
parent 50665fe07b
commit ce71919749
2 changed files with 50 additions and 0 deletions

View File

@@ -48,6 +48,8 @@
};
};
nixosModules.default = ./nix/module.nix;
packages = forAllSystems (system: pkgs: _:
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);

48
nix/module.nix Normal file
View File

@@ -0,0 +1,48 @@
{ config, pkgs, lib, ... }:
let
cfg = config.services.roowho2;
format = pkgs.formats.toml { };
in {
options.services.roowho2 = {
enable = lib.mkEnableOption "the roowho2 daemon, replacement for multiple linux netkit services";
package = lib.mkPackageOption pkgs "roowho2" { };
settings = lib.mkOption {
type = lib.types.submodule {
freeformType = format.type;
options = {
rwhod = {
enable = lib.mkEnableOption "the rwhod service";
# TODO: allow configuring socket config
};
};
};
default = { };
description = "Configuration settings for Roowho2.";
};
};
config = lib.mkIf cfg.enable {
systemd.sockets.roowhoo2-rwhod = lib.mkIf cfg.settings.rwhod.enable {
description = "Roowho2 Rwhod Socket";
listenDatagrams = [ 513 ];
socketConfig = {
Service = "roowho2.service";
FileDescriptorName = "rwhod_socket";
Broadcast = true;
};
};
systemd.services.roowho2 = {
serviceConfig = {
ExecStart = "${lib.getExe' cfg.package "roowho2d"} --config ${format.toFile cfg.settings}";
Restart = "on-failure";
DynamicUser = true;
# TODO: hardening
};
};
};
}