diff --git a/hscontrol/config/load_test.go b/hscontrol/config/load_test.go index 9ad62e878..984a2876d 100644 --- a/hscontrol/config/load_test.go +++ b/hscontrol/config/load_test.go @@ -3047,7 +3047,9 @@ func unsetHeadscaleEnv(t *testing.T) { // nix/example-configuration.nix // (services.headscale.configFile, environment.etc."headscale/config.yaml") and // for the nixpkgs module with only server_url, dns.base_domain and -// dns.nameservers.global set; hsic-* mirror integration/hsic's +// dns.nameservers.global set; nixos-module-minimal.yaml is the flake module's +// configFile with only those three set, before the module moved to the +// generated options; hsic-* mirror integration/hsic's // MinimumConfigYAML and DefaultConfigEnv. -strict is the same source // as updated for the strict loader, -pruned without the keys removed // for having no effect. diff --git a/hscontrol/config/testdata/compat/nixos-module-minimal.golden.json b/hscontrol/config/testdata/compat/nixos-module-minimal.golden.json new file mode 100644 index 000000000..fe56d426f --- /dev/null +++ b/hscontrol/config/testdata/compat/nixos-module-minimal.golden.json @@ -0,0 +1,191 @@ +{ + "config": { + "ServerURL": "https://headscale.example.com", + "Addr": "127.0.0.1:8080", + "MetricsAddr": "", + "TrustedProxies": null, + "Node": { + "Expiry": 0, + "Ephemeral": { + "InactivityTimeout": 1800000000000 + }, + "Routes": { + "HA": { + "ProbeInterval": 10000000000, + "ProbeTimeout": 5000000000 + } + } + }, + "PreAuthKeys": { + "RevokedRetention": 604800000000000 + }, + "PrefixV4": "100.64.0.0/10", + "PrefixV6": "fd7a:115c:a1e0::/48", + "IPAllocation": "sequential", + "NoisePrivateKeyPath": "/var/lib/headscale/noise_private.key", + "BaseDomain": "tailnet.example.com", + "Log": { + "Format": "text", + "Level": "info" + }, + "DisableUpdateCheck": true, + "Database": { + "Type": "sqlite3", + "Debug": false, + "Gorm": { + "Debug": false, + "SlowThreshold": 0, + "SkipErrRecordNotFound": false, + "ParameterizedQueries": false + }, + "Sqlite": { + "Path": "/var/lib/headscale/db.sqlite", + "WriteAheadLog": true, + "WALAutoCheckPoint": 1000 + }, + "Postgres": { + "Host": "", + "Port": 0, + "Name": "", + "User": "", + "Ssl": "false", + "MaxOpenConnections": 10, + "MaxIdleConnections": 10, + "ConnMaxIdleTimeSecs": 3600 + } + }, + "DERP": { + "ServerEnabled": false, + "AutomaticallyAddEmbeddedDerpRegion": true, + "ServerRegionID": 0, + "ServerRegionCode": "", + "ServerRegionName": "", + "ServerPrivateKeyPath": "/var/lib/headscale/derp_server_private.key", + "ServerVerifyClients": true, + "STUNAddr": "", + "URLs": [ + { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "controlplane.tailscale.com", + "Path": "/derpmap/default", + "Fragment": "", + "RawQuery": "", + "RawPath": "", + "RawFragment": "", + "ForceQuery": false, + "OmitHost": false + } + ], + "Paths": [], + "DERPMap": null, + "AutoUpdate": true, + "UpdateFrequency": 86400000000000, + "IPv4": "", + "IPv6": "" + }, + "TLS": { + "CertPath": "", + "KeyPath": "", + "ACME": { + "Hostname": "", + "ChallengeType": "HTTP-01", + "HTTPListen": ":http", + "URL": "", + "Email": "", + "CacheDir": "/var/lib/headscale/cache" + } + }, + "DNSConfig": { + "MagicDNS": true, + "BaseDomain": "tailnet.example.com", + "OverrideLocalDNS": true, + "Nameservers": { + "Global": [ + "1.1.1.1", + "8.8.8.8" + ], + "Split": {} + }, + "SearchDomains": [], + "ExtraRecords": null, + "ExtraRecordsPath": "", + "Certificates": { + "Enabled": false, + "Zone": "tailnet.example.com" + } + }, + "TailcfgDNSConfig": { + "Resolvers": [ + { + "Addr": "1.1.1.1" + }, + { + "Addr": "8.8.8.8" + } + ], + "Domains": [ + "tailnet.example.com" + ], + "Proxied": true + }, + "DNSChallenge": { + "PropagationTimeout": 120000000000, + "Resolvers": [ + "9.9.9.9:53", + "149.112.112.112:53" + ], + "ProviderName": "" + }, + "UnixSocket": "/run/headscale/headscale.sock", + "UnixSocketPermission": 504, + "OIDC": { + "OnlyStartIfOIDCIsAvailable": true, + "Issuer": "", + "ClientID": "", + "Scope": [ + "openid", + "profile", + "email" + ], + "ExtraParams": {}, + "AllowedDomains": [], + "AllowedUsers": [], + "AllowedGroups": null, + "EmailVerifiedRequired": true, + "UseExpiryFromToken": false, + "PKCE": { + "Enabled": false, + "Method": "S256" + } + }, + "LogTail": { + "Enabled": false + }, + "Taildrop": { + "Enabled": true + }, + "AutoUpdate": { + "Enabled": false + }, + "CLI": { + "Address": "", + "Timeout": 5000000000, + "Insecure": false + }, + "Policy": { + "Path": "", + "Mode": "file" + }, + "Tuning": { + "BatchChangeDelay": 800000000, + "NodeMapSessionBufferedChanSize": 30, + "BatcherWorkers": 0, + "RegisterCacheExpiration": 900000000000, + "RegisterCacheMaxEntries": 1024, + "NodeStoreBatchSize": 100, + "NodeStoreBatchTimeout": 500000000 + } + } +} diff --git a/hscontrol/config/testdata/compat/nixos-module-minimal.yaml b/hscontrol/config/testdata/compat/nixos-module-minimal.yaml new file mode 100644 index 000000000..1700a5190 --- /dev/null +++ b/hscontrol/config/testdata/compat/nixos-module-minimal.yaml @@ -0,0 +1,76 @@ +%YAML 1.1 +--- +database: + postgres: + host: null + name: null + port: null + user: null + sqlite: + path: /var/lib/headscale/db.sqlite + write_ahead_log: true + type: sqlite +derp: + auto_update_enabled: true + paths: [] + server: + private_key_path: /var/lib/headscale/derp_server_private.key + update_frequency: 24h + urls: + - https://controlplane.tailscale.com/derpmap/default +disable_check_updates: true +dns: + base_domain: tailnet.example.com + certificates: + enabled: false + zone: '' + challenge: + provider: null + extra_records: null + magic_dns: true + nameservers: + global: + - 1.1.1.1 + - 8.8.8.8 + split: {} + override_local_dns: true + search_domains: [] +listen_addr: 127.0.0.1:8080 +log: + format: text + level: info +node: + ephemeral: + inactivity_timeout: 30m + expiry: '0' +noise: + private_key_path: /var/lib/headscale/noise_private.key +oidc: + allowed_domains: [] + allowed_users: [] + client_id: '' + extra_params: {} + issuer: '' + pkce: + enabled: false + method: S256 + scope: + - openid + - profile + - email +policy: + mode: file + path: null +prefixes: + allocation: sequential + v4: 100.64.0.0/10 + v6: fd7a:115c:a1e0::/48 +server_url: https://headscale.example.com +tls: + acme: + challenge_type: null + hostname: '' + http_listen: null + cert_path: null + key_path: null +unix_socket: /run/headscale/headscale.sock