mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-23 17:28:33 +02:00
feat: add netbird for homelab, keep tailscale for work (#225)
This commit is contained in:
@@ -72,6 +72,7 @@ in
|
|||||||
|
|
||||||
# network
|
# network
|
||||||
"/var/lib/tailscale"
|
"/var/lib/tailscale"
|
||||||
|
"/var/lib/netbird-homelab" # netbird's homelab client
|
||||||
"/var/lib/bluetooth"
|
"/var/lib/bluetooth"
|
||||||
"/var/lib/NetworkManager"
|
"/var/lib/NetworkManager"
|
||||||
"/var/lib/iwd"
|
"/var/lib/iwd"
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
# enable tailscale on aquamarine
|
|
||||||
services.tailscale = {
|
|
||||||
enable = true;
|
|
||||||
useRoutingFeatures = "server";
|
|
||||||
extraSetFlags = [
|
|
||||||
# access home network via tailscale
|
|
||||||
"--advertise-routes=192.168.5.0/24"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
28
hosts/idols-aquamarine/vpn.nix
Normal file
28
hosts/idols-aquamarine/vpn.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
# tailscale do not support running multiple clients on the same host,
|
||||||
|
# so we use netbird for homelab instead.
|
||||||
|
#
|
||||||
|
# services.tailscale = {
|
||||||
|
# enable = true;
|
||||||
|
# port = 41641;
|
||||||
|
# interfaceName = "tailscale0";
|
||||||
|
# # allow the Tailscale UDP port through the firewall
|
||||||
|
# openFirewall = true;
|
||||||
|
#
|
||||||
|
# useRoutingFeatures = "server";
|
||||||
|
# extraSetFlags = [
|
||||||
|
# # access home network via tailscale
|
||||||
|
# "--advertise-routes=192.168.5.0/24"
|
||||||
|
# "--accept-routes=false"
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
|
||||||
|
services.netbird.useRoutingFeatures = "server";
|
||||||
|
services.netbird.clients.homelab = {
|
||||||
|
port = 51820;
|
||||||
|
name = "homelab";
|
||||||
|
interface = "netbird-homelab";
|
||||||
|
hardened = true;
|
||||||
|
autoStart = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -171,6 +171,7 @@ in
|
|||||||
"joplin" # note taking app
|
"joplin" # note taking app
|
||||||
|
|
||||||
"tailscale-app" # tailscale macos app (with gui)
|
"tailscale-app" # tailscale macos app (with gui)
|
||||||
|
"netbirdio/tap/netbird-ui" # netbird gui app
|
||||||
|
|
||||||
# AI
|
# AI
|
||||||
"lm-studio"
|
"lm-studio"
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
{
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
# =============================================================
|
|
||||||
#
|
|
||||||
# Tailscale - your own private network(VPN) that uses WireGuard
|
|
||||||
#
|
|
||||||
# It's open source and free for personal use,
|
|
||||||
# and it's really easy to setup and use.
|
|
||||||
# Tailscale has great client coverage for Linux, windows, Mac, android, and iOS.
|
|
||||||
# Tailscale is more mature and stable compared to other alternatives such as netbird/netmaker.
|
|
||||||
# Maybe I'll give netbird/netmaker a try when they are more mature, but for now, I'm sticking with Tailscale.
|
|
||||||
#
|
|
||||||
# How to use:
|
|
||||||
# 1. Create a Tailscale account at https://login.tailscale.com
|
|
||||||
# 2. Login via `tailscale login`
|
|
||||||
# 3. join into your Tailscale network via `tailscale up --accept-routes`
|
|
||||||
# 4. If you prefer automatic connection to Tailscale, use the `authKeyFile` option` in the config below.
|
|
||||||
#
|
|
||||||
# Status Data:
|
|
||||||
# `journalctl -u tailscaled` shows tailscaled's logs
|
|
||||||
# logs indicate that tailscale store its data in /var/lib/tailscale
|
|
||||||
# which is already persistent across reboots(via preservation)
|
|
||||||
#
|
|
||||||
# References:
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-25.05/nixos/modules/services/networking/tailscale.nix
|
|
||||||
#
|
|
||||||
# =============================================================
|
|
||||||
{
|
|
||||||
# make the tailscale command usable to users
|
|
||||||
environment.systemPackages = [ pkgs.tailscale ];
|
|
||||||
|
|
||||||
# enable the tailscale service
|
|
||||||
services.tailscale = {
|
|
||||||
enable = lib.mkDefault false;
|
|
||||||
port = 41641;
|
|
||||||
interfaceName = "tailscale0";
|
|
||||||
# allow the Tailscale UDP port through the firewall
|
|
||||||
openFirewall = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
{ mylib, ... }:
|
{ mylib, ... }:
|
||||||
{
|
{
|
||||||
imports = mylib.scanPaths ./.;
|
imports = mylib.scanPaths ./.;
|
||||||
|
|
||||||
# enable tailscae for all desktop hosts
|
|
||||||
services.tailscale.enable = true;
|
|
||||||
}
|
}
|
||||||
|
|||||||
38
modules/nixos/desktop/networking/netbird.nix
Normal file
38
modules/nixos/desktop/networking/netbird.nix
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
# =============================================================
|
||||||
|
#
|
||||||
|
# NetBird - your own private network(VPN) that uses WireGuard, Coturn, etc.
|
||||||
|
#
|
||||||
|
# It's similar to tailscale, but netbird's more opensouse and less mature.
|
||||||
|
#
|
||||||
|
# NetBird natively supports running multiple clients on the same host — something
|
||||||
|
# Tailscale can’t do easily.
|
||||||
|
# Its NixOS module ships a dedicated CLI wrapper for every client, so managing them is effortless.
|
||||||
|
#
|
||||||
|
# How to use:
|
||||||
|
# 1. Create a NetBird account at https://app.netbird.io/
|
||||||
|
# 3. Login & join into your homelab network via `netbird-homelab up`
|
||||||
|
#
|
||||||
|
# Status Data:
|
||||||
|
# `journalctl -u netbird-homelab` shows netbird's logs
|
||||||
|
# netbird client store its data in /var/lib/netbird-homelab
|
||||||
|
# which is already persistent across reboots(via preservation)
|
||||||
|
#
|
||||||
|
# References:
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/networking/netbird.nix
|
||||||
|
#
|
||||||
|
# =============================================================
|
||||||
|
{
|
||||||
|
services.netbird.useRoutingFeatures = "client";
|
||||||
|
services.netbird.clients.homelab = {
|
||||||
|
port = 51820;
|
||||||
|
name = "homelab";
|
||||||
|
interface = "netbird-homelab";
|
||||||
|
hardened = true;
|
||||||
|
autoStart = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,7 +1,44 @@
|
|||||||
{
|
{
|
||||||
# enable tailscale on aquamarine
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
# =============================================================
|
||||||
|
#
|
||||||
|
# Tailscale - your own private network(VPN) that uses WireGuard
|
||||||
|
#
|
||||||
|
# It's open source and free for personal use,
|
||||||
|
# and it's really easy to setup and use.
|
||||||
|
# Tailscale has great client coverage for Linux, windows, Mac, android, and iOS.
|
||||||
|
# Tailscale is more mature and stable compared to other alternatives such as netbird/netmaker.
|
||||||
|
#
|
||||||
|
# How to use:
|
||||||
|
# 1. Create a Tailscale account at https://login.tailscale.com
|
||||||
|
# 2. Login via `tailscale login`
|
||||||
|
# 3. join into your Tailscale network via `tailscale up --accept-routes`
|
||||||
|
# 4. If you prefer automatic connection to Tailscale, use the `authKeyFile` option` in the config below.
|
||||||
|
#
|
||||||
|
# Status Data:
|
||||||
|
# `journalctl -u tailscaled` shows tailscaled's logs
|
||||||
|
# logs indicate that tailscale store its data in /var/lib/tailscale
|
||||||
|
# which is already persistent across reboots(via preservation)
|
||||||
|
#
|
||||||
|
# References:
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-25.05/nixos/modules/services/networking/tailscale.nix
|
||||||
|
#
|
||||||
|
# =============================================================
|
||||||
|
{
|
||||||
|
# make the tailscale command usable to users
|
||||||
|
environment.systemPackages = [ pkgs.tailscale ];
|
||||||
|
|
||||||
|
# enable the tailscale service
|
||||||
services.tailscale = {
|
services.tailscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
port = 41641;
|
||||||
|
interfaceName = "tailscale0";
|
||||||
|
# allow the Tailscale UDP port through the firewall
|
||||||
|
openFirewall = true;
|
||||||
|
|
||||||
useRoutingFeatures = "client";
|
useRoutingFeatures = "client";
|
||||||
extraSetFlags = [
|
extraSetFlags = [
|
||||||
"--accept-routes"
|
"--accept-routes"
|
||||||
|
|||||||
Reference in New Issue
Block a user