mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
refactor(openwebrx): pull out common module config
This commit is contained in:
parent
047f240b6a
commit
d92c986f8a
12 changed files with 477 additions and 166 deletions
48
nixos/openwebrx.nix
Normal file
48
nixos/openwebrx.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
cfg = config.services.openwebrx;
|
||||
user = "openwebrx";
|
||||
in {
|
||||
services.openwebrx = {
|
||||
enable = mkDefault true;
|
||||
package = mkDefault pkgs.openwebrxplus;
|
||||
user = mkDefault user;
|
||||
};
|
||||
|
||||
users = mkIf cfg.enable {
|
||||
users.${user} = {
|
||||
uid = 912;
|
||||
isSystemUser = true;
|
||||
home = cfg.dataDir;
|
||||
group = user;
|
||||
extraGroups = mkIf config.hardware.rtl-sdr.enable [
|
||||
"plugdev"
|
||||
];
|
||||
};
|
||||
groups.${user} = {
|
||||
gid = config.users.users.${user}.uid;
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets = let
|
||||
sopsFile = mkDefault ./secrets/openwebrx.yaml;
|
||||
in mkIf cfg.enable {
|
||||
openwebrx-users = {
|
||||
inherit sopsFile;
|
||||
owner = cfg.user;
|
||||
group = cfg.group;
|
||||
path = "${cfg.dataDir}/users.json";
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall = mkIf cfg.enable {
|
||||
interfaces.lan.allowedTCPPorts = mkIf cfg.enable [
|
||||
cfg.port
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue