Tinc: Difference between revisions

imported>Makefu
pre -> syntaxHighlight
imported>Joepie91
Fix formatting for tinc-up/tinc-down example
Line 86: Line 86:


<syntaxHighlight lang=nix># for heinz
<syntaxHighlight lang=nix># for heinz
environment.etc."tinc/private/tinc-up".source = pkgs.writeScript &quot;tinc-up-private'
environment.etc = {
  #!${pkgs.stdenv.shell}
    "tinc/private/tinc-up".source = pkgs.writeScript "tinc-up-private" ''
  ${pkgs.nettools}/bin/ifconfig $INTERFACE 10.1.1.25 netmask 255.255.255.0
        #!${pkgs.stdenv.shell}
'';
        ${pkgs.nettools}/bin/ifconfig $INTERFACE 10.1.1.25 netmask 255.255.255.0
environment.etc."tinc/private/tinc-down".source = pkgs.writeScript "tinc-down-private''
    '';
  #!${pkgs.stdenv.shell}
    "tinc/private/tinc-down".source = pkgs.writeScript "tinc-down-private" ''
  /run/wrappers/bin/sudo ${pkgs.nettools}/bin/ifconfig $INTERFACE down
        #!${pkgs.stdenv.shell}
'';</syntaxHighlight>
        /run/wrappers/bin/sudo ${pkgs.nettools}/bin/ifconfig $INTERFACE down
    '';
};</syntaxHighlight>
For the <code>tinc-down</code> we need to use sudo, because the user <code>tinc.private</code> who starts the service is not able to tear down the interface.
For the <code>tinc-down</code> we need to use sudo, because the user <code>tinc.private</code> who starts the service is not able to tear down the interface.