]> git.scottworley.com Git - syncthing-autoregister/blame - modules/syncthing-autoregister.nix
Syncthing device-id autoregistration
[syncthing-autoregister] / modules / syncthing-autoregister.nix
CommitLineData
b00b144b
SW
1{ config, lib, pkgs, ... }:
2let
3 localpkgs = import ../. { inherit pkgs; };
4 register-script = pkgs.writeShellScript "syncthing-autoregister-script" ''
5 ${localpkgs.syncthing-set-id}/bin/syncthing-set-id /tmp/syncthing-auto-register-test-device-ids.nix
6 '';
7in {
8 config = {
9 systemd.services.syncthing-autoregister = {
10 after = [ "syncthing.service" "syncthing-init.service" ];
11 wantedBy = [ "multi-user.target" ];
12 environment.NIX_PATH = config.environment.variables.NIX_PATH;
13 serviceConfig = {
14 User = config.services.syncthing.user;
15 RemainAfterExit = true;
16 Type = "oneshot";
17 ExecStart = register-script;
18 };
19 };
20 };
21}
22