File tailscale issue
This commit is contained in:
@@ -12,10 +12,6 @@
|
||||
};
|
||||
};
|
||||
config = {config, pkgs, ...}: {
|
||||
imports = [
|
||||
./tailscale.nix
|
||||
];
|
||||
|
||||
networking.nameservers = [ "1.1.1.1" ];
|
||||
networking.useHostResolvConf = false;
|
||||
|
||||
@@ -26,8 +22,8 @@
|
||||
services.tailscale = {
|
||||
enable = true;
|
||||
useRoutingFeatures = "client";
|
||||
authTokenPath = "/var/tailauth";
|
||||
authUrl = authServer;
|
||||
authKeyFile = "/var/tailauth";
|
||||
extraUpFlags = ["--login-server" "${authServer}"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
{config, pkgs, lib, ...}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.tailscale;
|
||||
defPath = if config.services.headscale.enable then "${config.services.headscale.settings.server_url}" else null;
|
||||
in {
|
||||
# Configure tailscale to allow specifiying user login and auth path
|
||||
options.services.tailscale = {
|
||||
authTokenPath = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = "Should tailscale automatically login with the given authtoken file";
|
||||
};
|
||||
authUrl = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = defPath;
|
||||
description = "Server URL of head/tailscale";
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
waitGen = optional (cfg.authTokenPath == defPath) "headscale-preauth-regen-${name}";
|
||||
in {
|
||||
systemd.services.tailscale_autologin = mkIf (cfg.enable && cfg.authTokenPath != null) {
|
||||
wantedBy = ["tailscaled.service"];
|
||||
after = ["tailscaled.service"] ++ waitGen;
|
||||
script = ''
|
||||
${pkgs.tailscale}/bin/tailscale up --login-server ${cfg.authUrl} --authkey $(cat ${cfg.authTokenPath})
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user