feat(services): opt-in Tailscale + Syncthing (nomarchy.services.*)
Start the opt-in services surface: nomarchy.services.{tailscale,syncthing},
off by default, in modules/nixos/services.nix. Tailscale ships the daemon
(authenticate with `sudo tailscale up`); Syncthing runs as the login user
with its GUI on 127.0.0.1:8384 (overrideDevices/Folders off so GUI-managed
folders survive rebuilds). username is read lazily, only when Syncthing is
on. Commented examples in the downstream system.nix template per the opt-in
convention.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,7 @@ let
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ./plymouth.nix ./file-manager.nix ./power.nix ];
|
||||
imports = [ ./options.nix ./plymouth.nix ./file-manager.nix ./power.nix ./services.nix ];
|
||||
|
||||
config = {
|
||||
# The safe half of distro branding: distroName flows into
|
||||
|
||||
40
modules/nixos/services.nix
Normal file
40
modules/nixos/services.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
# Opt-in services & integrations — off by default, one toggle each, enabled
|
||||
# in system.nix (see the commented examples in the downstream template).
|
||||
# These are system services: Tailscale is system-only, and Syncthing runs as
|
||||
# the login user. Their own `nomarchy.services.*` namespace, distinct from the
|
||||
# distro's core `nomarchy.system.*` toggles. `username` (from specialArgs) is
|
||||
# read lazily, only when Syncthing is enabled.
|
||||
{ config, lib, ... }@args:
|
||||
|
||||
let
|
||||
cfg = config.nomarchy.services;
|
||||
in
|
||||
{
|
||||
options.nomarchy.services = {
|
||||
tailscale.enable = lib.mkEnableOption ''
|
||||
Tailscale, the mesh VPN — ships the daemon; authenticate once with
|
||||
`sudo tailscale up`'';
|
||||
|
||||
syncthing.enable = lib.mkEnableOption ''
|
||||
Syncthing continuous file sync, running as the login user — add
|
||||
folders and devices in the web UI at http://127.0.0.1:8384'';
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf cfg.tailscale.enable {
|
||||
services.tailscale.enable = true;
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.syncthing.enable {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
user = args.username;
|
||||
# Manage folders/devices in the GUI; don't let the (empty) declarative
|
||||
# config wipe them on a rebuild.
|
||||
overrideDevices = false;
|
||||
overrideFolders = false;
|
||||
guiAddress = "127.0.0.1:8384";
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user