1 { config, lib, pkgs, ... }:
4 cfg = config.services.syncthing.autoRegister;
5 localpkgs = import ../. { inherit pkgs; };
6 register-script = pkgs.writeShellScript "syncthing-autoregister-script" ''
7 ${localpkgs.syncthing-set-id}/bin/syncthing-set-id /tmp/syncthing-auto-register-test-device-ids.nix
11 services.syncthing.autoRegister = {
12 enable = mkEnableOption ''
13 Automatically write the local syncthing device id to /tmp/syncthing-auto-register-test-device-ids.nix
17 config = mkIf cfg.enable {
18 systemd.services.syncthing-autoregister = {
19 after = [ "syncthing.service" "syncthing-init.service" ];
20 wantedBy = [ "multi-user.target" ];
21 environment.NIX_PATH = config.environment.variables.NIX_PATH;
23 User = config.services.syncthing.user;
24 RemainAfterExit = true;
26 ExecStart = register-script;