1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-09 09:36:20 +09:00

nixos/dnscrypt-proxy2: add package option (#411451)

This commit is contained in:
Lin Jian 2025-06-06 21:21:30 +08:00 committed by GitHub
commit 2302f3c9bd
Signed by: github
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 12 deletions

View file

@ -42,5 +42,7 @@
- `services.clamsmtp` is unmaintained and was removed from Nixpkgs. - `services.clamsmtp` is unmaintained and was removed from Nixpkgs.
- `services.dnscrypt-proxy2` gains a `package` option to specify dnscrypt-proxy package to use.
- `amdgpu` kernel driver overdrive mode can now be enabled by setting [hardware.amdgpu.overdrive.enable](#opt-hardware.amdgpu.overdrive.enable) and customized through [hardware.amdgpu.overdrive.ppfeaturemask](#opt-hardware.amdgpu.overdrive.ppfeaturemask). - `amdgpu` kernel driver overdrive mode can now be enabled by setting [hardware.amdgpu.overdrive.enable](#opt-hardware.amdgpu.overdrive.enable) and customized through [hardware.amdgpu.overdrive.ppfeaturemask](#opt-hardware.amdgpu.overdrive.ppfeaturemask).
This allows for fine-grained control over the GPU's performance and maybe required by overclocking softwares like Corectrl and Lact. These new options replace old options such as {option}`programs.corectrl.gpuOverclock.enable` and {option}`programs.tuxclocker.enableAMD`. This allows for fine-grained control over the GPU's performance and maybe required by overclocking softwares like Corectrl and Lact. These new options replace old options such as {option}`programs.corectrl.gpuOverclock.enable` and {option}`programs.tuxclocker.enableAMD`.

View file

@ -4,22 +4,25 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.dnscrypt-proxy2; cfg = config.services.dnscrypt-proxy2;
in in
{ {
options.services.dnscrypt-proxy2 = { options.services.dnscrypt-proxy2 = {
enable = mkEnableOption "dnscrypt-proxy2"; enable = lib.mkEnableOption "dnscrypt-proxy2";
settings = mkOption { package = lib.mkPackageOption pkgs "dnscrypt-proxy" { };
settings = lib.mkOption {
description = '' description = ''
Attrset that is converted and passed as TOML config file. Attrset that is converted and passed as TOML config file.
For available params, see: <https://github.com/DNSCrypt/dnscrypt-proxy/blob/${pkgs.dnscrypt-proxy.version}/dnscrypt-proxy/example-dnscrypt-proxy.toml> For available params, see: <https://github.com/DNSCrypt/dnscrypt-proxy/blob/${pkgs.dnscrypt-proxy.version}/dnscrypt-proxy/example-dnscrypt-proxy.toml>
''; '';
example = literalExpression '' example = lib.literalExpression ''
{ {
sources.public-resolvers = { sources.public-resolvers = {
urls = [ "https://download.dnscrypt.info/resolvers-list/v2/public-resolvers.md" ]; urls = [ "https://download.dnscrypt.info/resolvers-list/v2/public-resolvers.md" ];
@ -29,27 +32,27 @@ in
}; };
} }
''; '';
type = types.attrs; type = lib.types.attrs;
default = { }; default = { };
}; };
upstreamDefaults = mkOption { upstreamDefaults = lib.mkOption {
description = '' description = ''
Whether to base the config declared in {option}`services.dnscrypt-proxy2.settings` on the upstream example config (<https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml>) Whether to base the config declared in {option}`services.dnscrypt-proxy2.settings` on the upstream example config (<https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml>)
Disable this if you want to declare your dnscrypt config from scratch. Disable this if you want to declare your dnscrypt config from scratch.
''; '';
type = types.bool; type = lib.types.bool;
default = true; default = true;
}; };
configFile = mkOption { configFile = lib.mkOption {
description = '' description = ''
Path to TOML config file. See: <https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml> Path to TOML config file. See: <https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml>
If this option is set, it will override any configuration done in options.services.dnscrypt-proxy2.settings. If this option is set, it will override any configuration done in options.services.dnscrypt-proxy2.settings.
''; '';
example = "/etc/dnscrypt-proxy/dnscrypt-proxy.toml"; example = "/etc/dnscrypt-proxy/dnscrypt-proxy.toml";
type = types.path; type = lib.types.path;
default = default =
pkgs.runCommand "dnscrypt-proxy.toml" pkgs.runCommand "dnscrypt-proxy.toml"
{ {
@ -70,11 +73,11 @@ in
} }
${pkgs.buildPackages.remarshal}/bin/json2toml < config.json > $out ${pkgs.buildPackages.remarshal}/bin/json2toml < config.json > $out
''; '';
defaultText = literalMD "TOML file generated from {option}`services.dnscrypt-proxy2.settings`"; defaultText = lib.literalMD "TOML file generated from {option}`services.dnscrypt-proxy2.settings`";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
networking.nameservers = lib.mkDefault [ "127.0.0.1" ]; networking.nameservers = lib.mkDefault [ "127.0.0.1" ];
@ -94,7 +97,7 @@ in
AmbientCapabilities = "CAP_NET_BIND_SERVICE"; AmbientCapabilities = "CAP_NET_BIND_SERVICE";
CacheDirectory = "dnscrypt-proxy"; CacheDirectory = "dnscrypt-proxy";
DynamicUser = true; DynamicUser = true;
ExecStart = "${pkgs.dnscrypt-proxy}/bin/dnscrypt-proxy -config ${cfg.configFile}"; ExecStart = "${lib.getExe cfg.package} -config ${cfg.configFile}";
LockPersonality = true; LockPersonality = true;
LogsDirectory = "dnscrypt-proxy"; LogsDirectory = "dnscrypt-proxy";
MemoryDenyWriteExecute = true; MemoryDenyWriteExecute = true;