summaryrefslogtreecommitdiffstats
path: root/krebs/3modules
diff options
context:
space:
mode:
authorlassulus <git@lassul.us>2023-01-31 00:34:07 +0100
committerlassulus <git@lassul.us>2023-01-31 00:34:07 +0100
commit62bd490d1e7217898bc793afc20de853ac1e6622 (patch)
tree454b9cbf6f72c54b993487ebc1f8deeb1cbb6506 /krebs/3modules
parent369fa6b7eb3f0fa3e1034bcad438eeda017949f8 (diff)
parenta85de9a0deb81f8b8759bfc6a54db0d823ab7a19 (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'krebs/3modules')
-rw-r--r--krebs/3modules/tinc.nix30
1 files changed, 11 insertions, 19 deletions
diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix
index f6727e4d4..52cdafe67 100644
--- a/krebs/3modules/tinc.nix
+++ b/krebs/3modules/tinc.nix
@@ -26,10 +26,7 @@ with import <stockholm/lib>;
Port = ${toString tinc.config.host.nets.${netname}.tinc.port}
${tinc.config.extraConfig}
'';
- "tinc-up" = pkgs.writeDash "${netname}-tinc-up" ''
- ${tinc.config.iproutePackage}/sbin/ip link set ${netname} up
- ${tinc.config.tincUp}
- '';
+ "tinc-up" = pkgs.writeDash "${netname}-tinc-up" tinc.config.tincUp;
});
};
@@ -60,7 +57,8 @@ with import <stockholm/lib>;
default = let
net = tinc.config.host.nets.${netname};
iproute = tinc.config.iproutePackage;
- in ''
+ in /* sh */ ''
+ ${tinc.config.iproutePackage}/sbin/ip link set ${netname} up
${optionalString (net.ip4 != null) /* sh */ ''
${iproute}/sbin/ip -4 addr add ${net.ip4.addr} dev ${netname}
${iproute}/sbin/ip -4 route add ${net.ip4.prefix} dev ${netname}
@@ -69,14 +67,13 @@ with import <stockholm/lib>;
${iproute}/sbin/ip -6 addr add ${net.ip6.addr} dev ${netname}
${iproute}/sbin/ip -6 route add ${net.ip6.prefix} dev ${netname}
''}
- ${tinc.config.tincUpExtra}
'';
- defaultText = ''
- ip -4 addr add ‹net.ip4.addr› dev ${netname}
- ip -4 route add ‹net.ip4.prefix› dev ${netname}
- ip -6 addr add ‹net.ip6.addr› dev ${netname}
- ip -6 route add ‹net.ip6.prefix› dev ${netname}
- ${tinc.config.tincUpExtra}
+ defaultText = /* sh */ ''
+ ip link set ‹netname› up
+ ip -4 addr add ‹net.ip4.addr› dev ‹netname›
+ ip -4 route add ‹net.ip4.prefix› dev ‹netname›
+ ip -6 addr add ‹net.ip6.addr› dev ‹netname›
+ ip -6 route add ‹net.ip6.prefix› dev ‹netname›
'';
description = ''
tinc-up script to be used. Defaults to setting the
@@ -85,11 +82,6 @@ with import <stockholm/lib>;
'';
};
- tincUpExtra = mkOption {
- type = types.str;
- default = "";
- };
-
tincPackage = mkOption {
type = types.package;
default = pkgs.tinc_pre;
@@ -128,9 +120,9 @@ with import <stockholm/lib>;
default =
pkgs.write "${tinc.config.netname}-tinc-hosts"
(mapAttrs'
- (_: host: (nameValuePair "/${host.name}" {
+ (_: host: nameValuePair "/${host.name}" {
text = host.nets.${tinc.config.netname}.tinc.config;
- }))
+ })
tinc.config.hosts);
defaultText = "‹netname›-tinc-hosts";
description = ''