aboutsummaryrefslogtreecommitdiff
path: root/modules/services/nixos/selfhost/headscale.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/services/nixos/selfhost/headscale.nix')
-rw-r--r--modules/services/nixos/selfhost/headscale.nix25
1 files changed, 19 insertions, 6 deletions
diff --git a/modules/services/nixos/selfhost/headscale.nix b/modules/services/nixos/selfhost/headscale.nix
index 9319691..9989742 100644
--- a/modules/services/nixos/selfhost/headscale.nix
+++ b/modules/services/nixos/selfhost/headscale.nix
@@ -7,12 +7,14 @@
cfg = config.collinux.services.selfhost.headscale;
acl_file = (pkgs.formats.json {}).generate "acl.json" {
- ssh = {
- src = ["*"];
- dst = ["*"];
- users = ["autogroup:nonroot" "root"];
- action = "accept";
- };
+ ssh = [
+ {
+ src = ["collin@"];
+ dst = ["collin@"];
+ users = ["autogroup:nonroot" "root"];
+ action = "accept";
+ }
+ ];
};
in
lib.mkIf cfg.enable {
@@ -47,6 +49,17 @@ in
};
};
+ # make sure headscale can start before tailscale
+ systemd.services."headscale" = lib.mkIf config.collinux.services.networking.tailscale.enable {
+ after = lib.mkForce ["network.target"];
+ before = lib.mkForce ["headscale.target"];
+ wants = lib.mkForce ["network.target" "headscale.target"];
+ };
+
+ systemd.targets."headscale" = {
+ description = "Target represents headscale is running. started by headscale.service";
+ };
+
services.caddy.virtualHosts.${cfg.root_url}.extraConfig = lib.mkIf config.collinux.services.selfhost.caddy.enable ''
reverse_proxy localhost:8080
'';