]> git.scottworley.com Git - syncthing-autoregister/blob - modules/syncthing-autoregister.nix
d1f0a7ce117f01bc2217bf93522490a6124f2d86
[syncthing-autoregister] / modules / syncthing-autoregister.nix
1 { config, lib, pkgs, ... }:
2 let
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 '';
7 in {
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