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
, here host is the tailnet ip
address assigned to your node running namescale.
{ ... }: {
services.namescale = {
enable = true;
settings = {
host = "100.64.0.6";
port = 53;
base_domain = "bane.ts.net";
};
};
}
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/namescale
Run Namescale, here host is the tailnet ip address assigned to your node running namescale
sudo ./namescale -host "100.64.0.6" -base-domain "bane.ts.net"
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 headscale.yaml
.
dns:
base_domain: bane.ts.net
nameservers:
split:
bane.ts.net:
- 100.64.0.6
Note
I don't use Tailnet on K8S or Docker, but it should be moderately okay to
set up namescale using Docker Compose or Helm Charts following the
GNU/Linux Distros section and
Tailscale Containers and virtualization
documentation. if you do, please open a pr to update the readme. you can get
the image from docker.io/sinanmohd/namescale
Build and run the container image
nix build .#container
docker image load < result
docker run sinanmohd/namescale:git
# 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