mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 20:39:18 -08:00
feat(rtl): service
This commit is contained in:
parent
6931de7d18
commit
b4dbcc71f0
7 changed files with 156 additions and 6 deletions
34
modules/system/exports/rtl.nix
Normal file
34
modules/system/exports/rtl.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
lib,
|
||||
gensokyo-zone,
|
||||
...
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
|
||||
inherit (lib.modules) mkIf;
|
||||
in {
|
||||
config.exports.services.rtl_tcp = {config, ...}: {
|
||||
id = mkAlmostOptionDefault "rtl";
|
||||
nixos = {
|
||||
serviceAttr = "rtl_tcp";
|
||||
assertions = let
|
||||
mkAssertion = f: nixosConfig: let
|
||||
cfg = nixosConfig.services.rtl_tcp;
|
||||
in
|
||||
f nixosConfig cfg;
|
||||
in
|
||||
mkIf config.enable [
|
||||
(mkAssertion (nixosConfig: cfg: {
|
||||
assertion = config.ports.tcp.port == cfg.port;
|
||||
message = "port mismatch";
|
||||
}))
|
||||
];
|
||||
};
|
||||
defaults.port.listen = mkAlmostOptionDefault "lan";
|
||||
ports = {
|
||||
tcp = {
|
||||
port = mkAlmostOptionDefault 1234;
|
||||
transport = "tcp";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue