summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-25 14:36:45 +0000
committertv <tv@krebsco.de>2026-11-25 14:36:45 +0000
commit1b222d87d04bc7953175f46f3aaf07026a1747cb (patch)
tree10ed51c0fec841c55f07360bd9681cbac1a711bd
parent91e42893b29da5f94e42872e3fde1223ce1cfaca (diff)
retiolum-tincr: init
Retiolum by tincr's NixOS module, which runs tincd without root: networkd creates the TUN device for it.
-rw-r--r--configs/retiolum-tincr.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/configs/retiolum-tincr.nix b/configs/retiolum-tincr.nix
new file mode 100644
index 00000000..f57dc78b
--- /dev/null
+++ b/configs/retiolum-tincr.nix
@@ -0,0 +1,47 @@
+{ config, inputs, lib, mylib, pkgs, ... }: let
+ host = config.krebs.build.host;
+ net = host.nets.retiolum;
+in {
+ imports = [
+ # The module only uses crane for its default package.
+ (import (inputs.tincr + "/nix/module.nix") { crane = null; })
+ ];
+ config = lib.mkMerge [
+ {
+ services.tincr.package = pkgs.tincr;
+ services.tincr.networks.retiolum = {
+ nodeName = host.name;
+ listenPort = net.tinc.port;
+ ed25519PrivateKeyFile =
+ "${config.krebs.secret.directory}/retiolum.ed25519_key.priv";
+ hosts =
+ lib.mapAttrs (_: host: host.nets.retiolum.tinc.config)
+ (lib.filterAttrs
+ (_: host: host.nets ? retiolum && host.nets.retiolum.tinc.config or null != null)
+ config.krebs.hosts);
+ connectTo = builtins.filter (mylib.ne host.name) [
+ "ne"
+ "neoprism"
+ "eve"
+ ];
+ interfaceName = "retiolum";
+ addresses = [
+ "${net.ip4.addr}/${toString net.ip4.prefixLength}"
+ "${net.ip6.addr}/${toString net.ip6.prefixLength}"
+ ];
+ extraConfig = ''
+ Broadcast = no
+ '';
+ };
+ hrm.systemd.services.tincr-retiolum.restartIfCredentialsChange = true;
+ }
+ (lib.mkIf (!config.hrm.nftables.enable) {
+ tv.iptables.input-internet-accept-tcp = [ "tinc" ];
+ tv.iptables.input-internet-accept-udp = [ "tinc" ];
+ })
+ (lib.mkIf config.hrm.nftables.enable {
+ hrm.nftables.input.internet.tcp = [ "tinc" ];
+ hrm.nftables.input.internet.udp = [ "tinc" ];
+ })
+ ];
+}