forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
102 changed files
with
3,659 additions
and
1,557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16150,6 +16150,12 @@ | |
githubId = 1538622; | ||
name = "Michael Reilly"; | ||
}; | ||
ondt = { | ||
name = "Ondrej Telka"; | ||
email = "[email protected]"; | ||
github = "ondt"; | ||
githubId = 20520951; | ||
}; | ||
onedragon = { | ||
name = "YiLong Liu"; | ||
email = "[email protected]"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,108 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
let | ||
json = pkgs.formats.json { }; | ||
cfg = config.programs.openvpn3; | ||
in | ||
{ | ||
|
||
inherit (lib) mkEnableOption mkPackageOption mkOption literalExpression max options lists; | ||
inherit (lib.types) bool submodule ints; | ||
in { | ||
options.programs.openvpn3 = { | ||
enable = lib.mkEnableOption "the openvpn3 client"; | ||
package = lib.mkOption { | ||
type = lib.types.package; | ||
default = pkgs.openvpn3.override { | ||
enableSystemdResolved = config.services.resolved.enable; | ||
enable = mkEnableOption "the openvpn3 client"; | ||
package = mkPackageOption pkgs "openvpn3" { }; | ||
netcfg = mkOption { | ||
description = "Network configuration"; | ||
default = { }; | ||
type = submodule { | ||
options = { | ||
settings = mkOption { | ||
description = "Options stored in {file}`/etc/openvpn3/netcfg.json` configuration file"; | ||
default = { }; | ||
type = submodule { | ||
freeformType = json.type; | ||
options = { | ||
systemd_resolved = mkOption { | ||
type = bool; | ||
description = "Whether to use systemd-resolved integration"; | ||
default = config.services.resolved.enable; | ||
defaultText = literalExpression "config.services.resolved.enable"; | ||
example = false; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
log-service = mkOption { | ||
description = "Log service configuration"; | ||
default = { }; | ||
type = submodule { | ||
options = { | ||
settings = mkOption { | ||
description = "Options stored in {file}`/etc/openvpn3/log-service.json` configuration file"; | ||
default = { }; | ||
type = submodule { | ||
freeformType = json.type; | ||
options = { | ||
journald = mkOption { | ||
description = "Use systemd-journald"; | ||
type = bool; | ||
default = true; | ||
example = false; | ||
}; | ||
log_dbus_details = mkOption { | ||
description = "Add D-Bus details in log file/syslog"; | ||
type = bool; | ||
default = true; | ||
example = false; | ||
}; | ||
log_level = mkOption { | ||
description = "How verbose should the logging be"; | ||
type = (ints.between 0 7) // { | ||
merge = _loc: defs: | ||
lists.foldl max 0 (options.getValues defs); | ||
}; | ||
default = 3; | ||
example = 6; | ||
}; | ||
timestamp = mkOption { | ||
description = "Add timestamp log file"; | ||
type = bool; | ||
default = false; | ||
example = true; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
defaultText = lib.literalExpression ''pkgs.openvpn3.override { | ||
enableSystemdResolved = config.services.resolved.enable; | ||
}''; | ||
description = '' | ||
Which package to use for `openvpn3`. | ||
''; | ||
}; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
services.dbus.packages = [ | ||
cfg.package | ||
]; | ||
services.dbus.packages = [ cfg.package ]; | ||
|
||
users.users.openvpn = { | ||
isSystemUser = true; | ||
uid = config.ids.uids.openvpn; | ||
group = "openvpn"; | ||
}; | ||
|
||
users.groups.openvpn = { | ||
gid = config.ids.gids.openvpn; | ||
users.groups.openvpn = { gid = config.ids.gids.openvpn; }; | ||
|
||
environment = { | ||
systemPackages = [ cfg.package ]; | ||
etc = { | ||
"openvpn3/netcfg.json".source = | ||
json.generate "netcfg.json" cfg.netcfg.settings; | ||
"openvpn3/log-service.json".source = | ||
json.generate "log-service.json" cfg.log-service.settings; | ||
}; | ||
}; | ||
|
||
environment.systemPackages = [ | ||
cfg.package | ||
]; | ||
systemd.packages = [ cfg.package ]; | ||
}; | ||
|
||
meta.maintainers = with lib.maintainers; [ shamilton progrm_jarvis ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.