Skip to content

deprecate home-manager (4/7): migrate darwin syncthing to launchd agents #314

Description

@etrobert-bot

Part of #197 (remove home-manager). Atomic PR 4 of 7.

Migrate darwin syncthing (aaron only) off home-manager into native nix-darwin config. home-manager stays functional after this PR; verify with an aaron build.

What moves

From modules/home/darwin.nix (flake.homeModules.darwin):

services.syncthing = {
  enable = true;
  guiAddress = "0.0.0.0:8384";
  settings = import (self + /lib/syncthing-settings.nix) { dataDir = config.home.homeDirectory; };
};

(config.home.homeDirectory on darwin = /Users/soft.)

Target

nix-darwin has no services.syncthing module, so reproduce it with launchd.user.agents:

  • A syncthing agent that runs ${pkgs.syncthing}/bin/syncthing --no-default-folder --gui-address=0.0.0.0:8384 --home=… (keep-alive, run at load).
  • Pushing the declarative settings (folders/devices from lib/syncthing-settings.nix) is the tricky part. The Linux system module (modules/nixos-base.nix:70) already consumes lib/syncthing-settings.nix via the NixOS services.syncthing.settings option — but launchd has no equivalent. Reproduce it with a second launchd.user.agents.syncthing-init one-shot that POSTs the settings to the syncthing REST API (/rest/config) after start, OR writes the generated config.xml. Reuse lib/syncthing-settings.nix so the device/folder definitions stay single-sourced. Document the chosen approach in the PR.

Keep guiAddress = 0.0.0.0:8384 behavior.

Where it lands

aaron only. modules/hosts/aaron/configuration.nix already has home-manager.users.soft = self.homeModules.darwin (line 231). Add the launchd agents to aaron's darwin config (configuration.nix or a darwin module). Remove the services.syncthing block from modules/home/darwin.nix.

Verify

  • nix build .#darwinConfigurations.aaron.system (or the appropriate aaron darwin build attr).
  • Confirm a syncthing launchd user agent is generated and the settings/devices match lib/syncthing-settings.nix.

Scope guard

Only darwin syncthing. The .hushlogin + bg alias (also in darwin.nix) are a separate PR. Do not touch mpd/hyprlock/hypridle/prettier/teardown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions