mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-10 08:39:08 +03:00
nixos/knot: compatibility with 23.05 config
- run conf-check iff keyFiles == [] (like in 23.05; this was my bug) - support extraConfig + keyFiles - but warning will still be shown if extraConfig is used, and it might be slightly confusing
This commit is contained in:
parent
860c01bd39
commit
6b66e2fc9c
@ -109,7 +109,7 @@
|
||||
|
||||
- `pass` now does not contain `password-store.el`. Users should get `password-store.el` from Emacs lisp package set `emacs.pkgs.password-store`.
|
||||
|
||||
- `services.knot` now supports `.settings` from RFC42. The change is not 100% compatible with the previous `.extraConfig`.
|
||||
- `services.knot` now supports `.settings` from RFC42. The previous `.extraConfig` still works the same, but it displays a warning now.
|
||||
|
||||
- `mu` now does not install `mu4e` files by default. Users should get `mu4e` from Emacs lisp package set `emacs.pkgs.mu4e`.
|
||||
|
||||
|
@ -103,11 +103,15 @@ let
|
||||
in result;
|
||||
|
||||
configFile = if cfg.settingsFile != null then
|
||||
assert cfg.settings == {} && cfg.keyFiles == [];
|
||||
# Note: with extraConfig, the 23.05 compat code did include keyFiles from settingsFile.
|
||||
assert cfg.settings == {} && (cfg.keyFiles == [] || cfg.extraConfig != null);
|
||||
cfg.settingsFile
|
||||
else pkgs.writeTextFile {
|
||||
else
|
||||
mkConfigFile yamlConfig;
|
||||
|
||||
mkConfigFile = configString: pkgs.writeTextFile {
|
||||
name = "knot.conf";
|
||||
text = (concatMapStringsSep "\n" (file: "include: ${file}") cfg.keyFiles) + "\n" + yamlConfig;
|
||||
text = (concatMapStringsSep "\n" (file: "include: ${file}") cfg.keyFiles) + "\n" + configString;
|
||||
# TODO: maybe we could do some checks even when private keys complicate this?
|
||||
checkPhase = lib.optionalString (cfg.keyFiles == []) ''
|
||||
${cfg.package}/bin/knotc --config=$out conf-check
|
||||
@ -174,7 +178,7 @@ in {
|
||||
description = lib.mdDoc ''
|
||||
As alternative to ``settings``, you can provide whole configuration
|
||||
directly in the almost-YAML format of Knot DNS.
|
||||
You might want to utilize ``writeTextFile`` for this.
|
||||
You might want to utilize ``pkgs.writeText "knot.conf" "longConfigString"`` for this.
|
||||
'';
|
||||
};
|
||||
|
||||
@ -189,9 +193,9 @@ in {
|
||||
};
|
||||
};
|
||||
imports = [
|
||||
# Compatibility with NixOS 23.05. At least partial, as it fails assert if used with keyFiles.
|
||||
# Compatibility with NixOS 23.05.
|
||||
(mkChangedOptionModule [ "services" "knot" "extraConfig" ] [ "services" "knot" "settingsFile" ]
|
||||
(config: pkgs.writeText "knot.conf" config.services.knot.extraConfig)
|
||||
(config: mkConfigFile config.services.knot.extraConfig)
|
||||
)
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user