aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/openvpn.nix
blob: d070cb2741f41f0b214bb662af63b0b2698aee92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ config, lib, pkgs, ... }:

with lib;

let

  cnf = config.cynerd.openvpn;

in {

  options = {
    cynerd.openvpn = {
      personal = mkOption {
        type = types.bool;
        default = false;
        description = "My personal OpenVPN";
      };
      oldpersonal = mkOption {
        type = types.bool;
        default = false;
        description = "My personal old OpenVPN";
      };
      elektroline = mkOption {
        type = types.bool;
        default = false;
        description = "Elektroline OpenVPN";
      };
    };
  };

  config = {
    services.openvpn.servers = {
      personal = mkIf cnf.personal {
        config = "config /run/secrets/personal.ovpn";
      };
      oldpersonal = mkIf cnf.oldpersonal {
        config = "config /run/secrets/old.ovpn";
      };
      elektroline = mkIf  cnf.elektroline {
        autoStart = false;
        config = "config /run/secrets/elektroline.ovpn";
      };
    };
  };

}