mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-10 04:49:19 -08:00
modules/nixos/wireguard-dns: Init
This commit is contained in:
parent
70d95acddb
commit
027c0012de
9 changed files with 57 additions and 35 deletions
|
|
@ -1,6 +1,7 @@
|
|||
{ config, lib, pkgs, ... }: with lib; let
|
||||
cfg = config.services.dht22-exporter;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.dht22-exporter.socat = {
|
||||
enable = mkEnableOption "socat service";
|
||||
package = mkOption {
|
||||
|
|
@ -14,23 +15,27 @@ in {
|
|||
};
|
||||
config = {
|
||||
systemd.services = mkIf cfg.socat.enable {
|
||||
dht22-exporter-socat = let
|
||||
scfg = cfg.socat;
|
||||
service = singleton "dht22-exporter.service";
|
||||
in {
|
||||
after = service;
|
||||
bindsTo = service;
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
dht22-exporter-socat =
|
||||
let
|
||||
scfg = cfg.socat;
|
||||
service = singleton "dht22-exporter.service";
|
||||
in
|
||||
{
|
||||
after = service;
|
||||
bindsTo = service;
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
};
|
||||
script =
|
||||
let
|
||||
port = toString (if cfg.port == null then 8001 else cfg.port);
|
||||
addresser = addr: "${scfg.package}/bin/socat TCP6-LISTEN:${port},bind=${addr},fork TCP4:localhost:${port}";
|
||||
lines = map addresser scfg.addresses;
|
||||
in
|
||||
''
|
||||
${concatStringsSep "\n" lines}
|
||||
'';
|
||||
};
|
||||
script = let
|
||||
port = toString (if cfg.port == null then 8001 else cfg.port);
|
||||
addresser = addr: "${scfg.package}/bin/socat TCP6-LISTEN:${port},bind=${addr},fork TCP4:localhost:${port}";
|
||||
lines = map addresser scfg.addresses;
|
||||
in ''
|
||||
${concatStringsSep "\n" lines}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
users.users.dht22-exporter = {
|
||||
|
|
|
|||
|
|
@ -50,11 +50,12 @@
|
|||
};
|
||||
};
|
||||
|
||||
kw.secrets.variables = mapListToAttrs (field:
|
||||
nameValuePair "glauth-${field}" {
|
||||
path = "services/glauth";
|
||||
inherit field;
|
||||
}) ["password-hash" "kc-password-hash" "postgres"];
|
||||
kw.secrets.variables = mapListToAttrs
|
||||
(field:
|
||||
nameValuePair "glauth-${field}" {
|
||||
path = "services/glauth";
|
||||
inherit field;
|
||||
}) [ "password-hash" "kc-password-hash" "postgres" ];
|
||||
|
||||
secrets.files = {
|
||||
glauth-postgres-file = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue