Tip
Example setup on NixOS with ACLs
Add namescale to your NixOS flake
{
description = "Bane's NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
namescale = {
url = "github:sinanmohd/namescale";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ nixpkgs, namescale, ... }: {
nixosConfigurations = {
hostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
namescale.nixosModules.namescale
];
};
};
};
}Set up namescale in your configuration.nix
{ ... }: {
services.namescale = {
enable = true;
settings.tsnet. = {
coordination_server_url = "https://headscale.example.com";
# services.namescale.environmentFile with TS_AUTHKEY is
# recommended for production
auth_key = "<your tailnet pre auth key>";
};
};
}Using Split DNS make your tailnet to routes all DNS requests to your base domain
to Namescale , on Tailscale you can use the Web GUI for this. if you're using
Headscale you can do the following in your configuration.nix.
{ ... }: {
services.headscale.settings.dns = {
base_domain = "bane.ts.net";
nameservers.split."bane.ts.net" = [ "100.64.0.6" ];
};
}Make sure Tailnet is up and running on your node and build Namescale
git clone https://github.com/sinanmohd/namescale.git
cd namescale
go build ./cmd/namescaleRun Namescale
./namescale \
-auth-key="<your tailnet pre auth key>" \
-coordination-server=https://headscale.example.comUsing Split DNS make your tailnet to routes all DNS requests to your base domain
to Namescale , on Tailscale you can use the Web GUI for this. if you're using
Headscale you can do the following in your headscale.yaml.
dns:
base_domain: bane.ts.net
nameservers:
split:
bane.ts.net:
- 100.64.0.6Run the container image
docker run \
-v namescale:/.config/ \
sinanmohd/namescale:latest \
namescale \
-auth-key="<your tailnet auth key>" \
-coordination-server=https://headscale.example.comBuild container image
nix build .#container
docker image load < result
docker tag sinanmohd/namescale:git sinanmohd/namescale:latest# get namescale
git clone https://github.com/sinanmohd/namescale.git
cd namescale
# setup development environment
nix develop
# run checks
nix flake check
# build go binary
go build ./cmd/namescale
# build nix package
nix build
# build and load container image
nix build .#container
docker image load < result