mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
034c45dd0c
addresses https://github.com/LnL7/nix-darwin/issues/1043 fix: use exec in launchd daemon config fix: dont use a script thats in the nix store fix: remove manual wait4path in linux-builder fix: remove manual wait4path in karabiner elements fix: remove manual wait4path in nix-daemon fix: remove manual wait4path in nix-optimise fix: remove manual wait4path in tailscaled fix: autossh test Revert "fix: remove manual wait4path in nix-daemon" This reverts commit6aec084fa5
. fix: remove bad exec Reapply "fix: remove manual wait4path in nix-daemon" This reverts commitc8f136ecc5
. fix: update autossh test to reflect changes inf86e6133d9
fix: services-activate-system-changed-label-prefix test fix: services-buildkite-agent test fix: services-activate-system test fix: escape ampersand fix: services-lorri test fix: services-nix-optimise test fix: services-nix-gc test refactor: use script rather than command in daemon fix: use config.command for clarity style: fix indentation fix: use lib.getExe rather than directly pointing to file revert:a87fc7bbbb
- mistaken refactor meant that service waited for nix store and not the relevant path
81 lines
2.8 KiB
Nix
81 lines
2.8 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.tailscale;
|
|
|
|
in
|
|
{
|
|
imports = [
|
|
(mkRemovedOptionModule [ "services" "tailscale" "domain" ] "Tailscale no longer requires setting the search domain manually.")
|
|
(mkRemovedOptionModule [ "services" "tailscale" "magicDNS" ] "MagicDNS no longer requires overriding the DNS servers, if this is necessary you can use `services.tailscale.overrideLocalDns`.")
|
|
];
|
|
|
|
options.services.tailscale = {
|
|
enable = mkEnableOption "Tailscale client daemon";
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = pkgs.tailscale;
|
|
defaultText = literalExpression "pkgs.tailscale";
|
|
description = "The package to use for tailscale";
|
|
};
|
|
|
|
overrideLocalDns = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
example = true;
|
|
description = ''
|
|
This option implements `Override local DNS` as it is not yet implemented in Tailscaled-on-macOS.
|
|
|
|
To use this option, in the Tailscale control panel:
|
|
1. at least one DNS server is added
|
|
2. `Override local DNS` is enabled
|
|
|
|
As this option sets 100.100.100.100 as your sole DNS server, if the requirements above are not met,
|
|
all non-MagicDNS queries WILL fail.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
assertions = [{
|
|
assertion = !cfg.overrideLocalDns || config.networking.dns == [ "100.100.100.100" ];
|
|
message = ''
|
|
DNS servers should be configured on the Tailscale control panel when `services.tailscale.overrideLocalDns` is enabled.
|
|
|
|
A race condition can occur when DNS servers are set locally, leading to MagicDNS to not work.
|
|
'';
|
|
}];
|
|
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
launchd.daemons.tailscaled = {
|
|
# derived from
|
|
# https://github.com/tailscale/tailscale/blob/main/cmd/tailscaled/install_darwin.go#L30
|
|
command = lib.getExe' cfg.package "tailscaled";
|
|
serviceConfig = {
|
|
Label = "com.tailscale.tailscaled";
|
|
RunAtLoad = true;
|
|
};
|
|
};
|
|
|
|
networking.dns = mkIf cfg.overrideLocalDns [ "100.100.100.100" ];
|
|
|
|
# Ensures Tailscale MagicDNS always works even without adding 100.100.100.100 to DNS servers
|
|
environment.etc."resolver/ts.net".text = "nameserver 100.100.100.100";
|
|
|
|
# This file gets created by tailscaled when `Override local DNS` is turned off
|
|
environment.etc."resolver/ts.net".knownSha256Hashes = [
|
|
"2c28f4fe3b4a958cd86b120e7eb799eee6976daa35b228c885f0630c55ef626c"
|
|
];
|
|
|
|
# Cleaning up the .before-nix-darwin file is necessary as any files in /etc/resolver will be used.
|
|
system.activationScripts.etc.text = mkAfter ''
|
|
if [ -e /etc/resolver/ts.net.before-nix-darwin ]; then
|
|
rm /etc/resolver/ts.net.before-nix-darwin
|
|
fi
|
|
'';
|
|
};
|
|
}
|