1 { config, pkgs, lib, ... }:
3 cfg = config.myServices.vpn;
7 vpn.enable = lib.mkEnableOption "Enable vpn service";
10 config = lib.mkIf cfg.enable {
11 myServices.chatonsProperties.hostings.vpn = {
12 file.datetime = "2022-08-27T18:00:00";
16 website = "https://vpn.immae.eu";
17 logo = "https://tinc-vpn.org/favicon.ico";
19 status.description = "OK";
20 registration.load = "FULL";
21 install.type = "PACKAGE";
25 website = "https://tinc-vpn.org/";
26 license.url = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html";
27 license.name = "GNU General Public License v2.0";
28 version = pkgs.tinc.version;
29 source.url = "https://tinc-vpn.org/git/browse?p=tinc";
37 text = config.myEnv.vpn.eldiron.privateKey;
43 text = config.myEnv.vpn.eldiron.publicKey;
46 networking.firewall.allowedTCPPorts = [ 655 1194 ];
47 system.activationScripts.tinc = let
48 configFiles = pkgs.runCommand "tinc-files" {
49 mainInterface = "eth0";
52 keyFile = config.secrets.fullPaths."tinc/key.priv";
55 for i in ${./tinc}/*; do
56 substituteAll $i $out/$(basename $i)
60 install -m750 -o root -g root -d /var/lib/tinc/ /var/lib/tinc/Immae
61 install -m700 -o root -g root -t /var/lib/tinc/Immae ${configFiles}/{host-*,tinc-*}
62 install -m400 -o root -g root -t /var/lib/tinc/Immae ${configFiles}/tinc.conf
63 if [ ! -d /var/lib/tinc/Immae/hosts ]; then
64 ${pkgs.git}/bin/git clone -b master https://git.immae.eu/perso/Immae/Config/tinc/hosts /var/lib/tinc/Immae/hosts
68 systemd.slices.tinc = {
69 description = "Tinc slice";
72 systemd.services.tinc-Immae = {
73 description = "Tinc Daemon - Immae";
74 wantedBy = [ "multi-user.target" ];
75 after = [ "network.target" ];
76 path = [ pkgs.tinc pkgs.bashInteractive pkgs.iproute pkgs.gnused pkgs.gawk pkgs.git pkgs.glibc ];
82 ExecStart = "${pkgs.tinc}/bin/tincd -d1 -D -c /var/lib/tinc/Immae --pidfile /run/tinc.Immae.pid";