Nix
On this page
The repository is a flake with the starmole package,
static Linux builds, and modules for NixOS, home-manager and nix-darwin.
Add it as an input:
inputs.starmole.url = "git+file:///home/you/src/starmole"; # or wherever your copy livesnix build .#default # starmole for this machine
nix build .#static-x86_64 # static Linux binaries, to copy anywhere
nix build .#static-aarch64Which daemon you need
Most of starmole runs as an ordinary user: shells and commands as yourself, forwards, SOCKS, invites. Only two things need more:
| You want | The daemon needs |
|---|---|
| the tun device or subnet routes | CAP_NET_ADMIN on Linux, root on macOS |
sessions as other local users (as = [...]) |
root |
NixOS, as a system service
imports = [ inputs.starmole.nixosModules.default ];
services.starmole = {
enable = true;
tun = true; # CAP_NET_ADMIN for the tun device
# runAsRoot = true; # for sessions as other local users
};Without runAsRoot, the daemon runs as a
starmole user with only CAP_NET_ADMIN (if
tun) and keeps its identity in
/var/lib/starmole. With it, the daemon runs as root with
its config in /etc/starmole, like the root daemon in setup.
Either way the CLI finds it at
/var/run/starmole/daemon.sock, and the users in
[daemon] operators can do everything there without
sudo. Enroll the machine as one of them with
starmole join.
settings writes config.toml from Nix instead of by
hand:
services.starmole.settings = {
network = { id = "<network id>"; issuer = "<issuer node id>"; port = 4433; };
daemon.operators = [ "alice" ];
tun.enable = true;
};
services.starmole.openFirewall = true; # opens network.portThe file is then read-only. starmole join still works
once network.id and network.issuer are set,
but commands that edit config.toml, like starmole peer add,
don't.
home-manager, as a user service
imports = [ inputs.starmole.homeManagerModules.default ];
services.starmole.enable = true;That's a systemd user service on Linux and a launchd agent on macOS,
with config in ~/.config/starmole as usual. It takes
settings too.
For the tun device under a user service on NixOS, install the
capability wrapper in the system config and point the user service at
it. Unlike setcap, it survives upgrades:
# NixOS
programs.starmole = { enable = true; tunWrapper = true; };
# home-manager
services.starmole.executable = "/run/wrappers/bin/starmole";nix-darwin, as root
imports = [ inputs.starmole.darwinModules.default ];
services.starmole.enable = true;A launch daemon running as root, with config in
/etc/starmole and logs in
/var/log/starmole.log. Use it for the tun device on a Mac;
for access only, the home-manager agent is enough.