summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-01-23 18:24:47 +0100
committertv <tv@krebsco.de>2023-01-23 18:27:04 +0100
commitc8c916ccf1a95f0e755094fd3d24403af91a0b67 (patch)
tree34ab7819c58a65524bbcab77085761dab260f109
parentef6ddd1de3f39623d3c7bfa8ec4c616ac6b9fae2 (diff)
tinc: untangle tincUp and tincUpExtra
-rw-r--r--krebs/3modules/tinc.nix20
1 files changed, 10 insertions, 10 deletions
diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix
index 7154ecdc3..4afd0a3a6 100644
--- a/krebs/3modules/tinc.nix
+++ b/krebs/3modules/tinc.nix
@@ -26,9 +26,9 @@ 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-up" = pkgs.writeDash "${netname}-tinc-up" /* sh */ ''
${tinc.config.tincUp}
+ ${tinc.config.tincUpExtra}
'';
});
};
@@ -60,7 +60,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 +70,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