mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-19 11:57:07 +09:00
config: let NixOS DNS records pass unknown fields to headscale
Updates #1926
This commit is contained in:
1 parent
c7d097d65e
commit
f0a4f6ca67
2 files changed
+5
-2
No files matched your search
@@ -159,7 +159,9 @@ func nixOption(k keyInfo, indent int) (string, error) {
|
||||
fmt.Fprintf(&fields, "%s%s = %s;\n", pad, f.Name, mkOption(in+6, attrs))
|
||||
}
|
||||
|
||||
typ = fmt.Sprintf("lib.types.listOf (\n%[1]s lib.types.submodule {\n%[1]s options = {\n%[2]s%[1]s };\n%[1]s }\n%[1]s)",
|
||||
// Freeform, so an unknown field reaches headscale, whose check names
|
||||
// it, instead of failing evaluation.
|
||||
typ = fmt.Sprintf("lib.types.listOf (\n%[1]s lib.types.submodule {\n%[1]s freeformType = lib.types.attrsOf lib.types.anything;\n%[1]s options = {\n%[2]s%[1]s };\n%[1]s }\n%[1]s)",
|
||||
strings.Repeat(" ", in), fields.String())
|
||||
default:
|
||||
return "", fmt.Errorf("%w for %s", errNoNixType, k.Field.Type)
|
||||
|
||||
@@ -217,7 +217,8 @@ func TestGenerateNixOptions(t *testing.T) {
|
||||
{
|
||||
path: "dns.extra_records",
|
||||
want: []string{
|
||||
"\n type = lib.types.listOf (\n lib.types.submodule {\n options = {\n name = lib.mkOption {\n",
|
||||
// An unknown field reaches headscale's check, not a Nix error.
|
||||
"\n type = lib.types.listOf (\n lib.types.submodule {\n freeformType = lib.types.attrsOf lib.types.anything;\n options = {\n name = lib.mkOption {\n",
|
||||
"\n default = [ ];\n",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user