tinc: use ip from path

This commit is contained in:
lassulus 2022-02-03 08:58:00 +01:00
parent be042e3446
commit 332d4f5e17

View File

@ -26,7 +26,7 @@ with import <stockholm/lib>;
${tinc.config.extraConfig}
'';
"tinc-up" = pkgs.writeDash "${netname}-tinc-up" ''
${tinc.config.iproutePackage}/sbin/ip link set ${netname} up
ip link set ${netname} up
${tinc.config.tincUp}
'';
});
@ -58,15 +58,14 @@ with import <stockholm/lib>;
type = types.str;
default = let
net = tinc.config.host.nets.${netname};
iproute = tinc.config.iproutePackage;
in ''
${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}
ip -4 addr add ${net.ip4.addr} dev ${netname}
ip -4 route add ${net.ip4.prefix} dev ${netname}
''}
${optionalString (net.ip6 != null) /* sh */ ''
${iproute}/sbin/ip -6 addr add ${net.ip6.addr} dev ${netname}
${iproute}/sbin/ip -6 route add ${net.ip6.prefix} dev ${netname}
ip -6 addr add ${net.ip6.addr} dev ${netname}
ip -6 route add ${net.ip6.prefix} dev ${netname}
''}
${tinc.config.tincUpExtra}
'';