services: tailscale: move to service

This commit is contained in:
Antoine Martin 2021-07-13 23:48:41 +02:00
parent 3862992b76
commit 1d8750efed
4 changed files with 40 additions and 22 deletions

View file

@ -32,11 +32,6 @@ in
}; };
}; };
services.tailscale = {
enable = true;
package = pkgs.unstable.tailscale;
};
networking.hostName = "boreal"; # Define your hostname. networking.hostName = "boreal"; # Define your hostname.
networking.domain = "alarsyo.net"; networking.domain = "alarsyo.net";
@ -87,6 +82,8 @@ in
pipewire.enable = true; pipewire.enable = true;
tailscale.enable = true;
wireguard = { wireguard = {
enable = false; enable = false;
iface = "wg"; iface = "wg";

View file

@ -21,11 +21,6 @@ in
boot.supportedFilesystems = [ "btrfs" ]; boot.supportedFilesystems = [ "btrfs" ];
boot.kernel.sysctl = {
"net.ipv6.conf.all.forwarding" = true;
"net.ipv4.ip_forward" = true;
};
services.btrfs = { services.btrfs = {
autoScrub = { autoScrub = {
enable = true; enable = true;
@ -33,18 +28,6 @@ in
}; };
}; };
services.tailscale = {
enable = true;
package = pkgs.unstable.tailscale;
};
systemd.services.tailscaled = {
path = [ pkgs.procps ];
};
networking.firewall = {
trustedInterfaces = [ "tailscale0" ];
allowedUDPPorts = [ config.services.tailscale.port ];
};
virtualisation.docker = { virtualisation.docker = {
enable = true; enable = true;
}; };
@ -140,6 +123,8 @@ in
enable = true; enable = true;
}; };
tailscale.enable = true;
tgv = { tgv = {
enable = true; enable = true;
}; };

View file

@ -19,6 +19,7 @@
./pipewire.nix ./pipewire.nix
./postgresql-backup.nix ./postgresql-backup.nix
./postgresql.nix ./postgresql.nix
./tailscale.nix
./tgv.nix ./tgv.nix
./transmission.nix ./transmission.nix
./wireguard.nix ./wireguard.nix

35
services/tailscale.nix Normal file
View file

@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.services.tailscale;
in
{
options.my.services.tailscale = {
enable = lib.mkEnableOption "Tailscale";
};
config = mkIf cfg.enable {
services.tailscale = {
enable = true;
package = pkgs.unstable.tailscale;
};
# FIXME: remove when upgrading to 21.11, added to module by default
systemd.services.tailscaled = {
path = [ pkgs.procps ];
};
networking.firewall = {
trustedInterfaces = [ "tailscale0" ];
allowedUDPPorts = [ config.services.tailscale.port ];
};
# enable IP forwarding to use as exit node
boot.kernel.sysctl = {
"net.ipv6.conf.all.forwarding" = true;
"net.ipv4.ip_forward" = true;
};
};
}