]> git.scottworley.com Git - syncthing-autoregister/blob - README
d462866dbfe67e31e2f79fa91d414b69a967d833
[syncthing-autoregister] / README
1 # syncthing-set-id
2
3 Modify in-place a nix module that configures syncthing device ids. This file can used as a normal `include` in nixos configs. This eliminates the need to copy-paste these device IDs around.
4
5 desktop$ syncthing-set-id syncthing-devices.nix
6 Creating /home/user/myNixOSConfigs/syncthing-devices.nix
7
8 desktop$ cat syncthing-devices.nix
9 {
10 "services" = {
11 "syncthing" = {
12 "declarative" = {
13 "devices" = {
14 "desktop" = {
15 "id" =
16 "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
17 };
18 };
19 };
20 };
21 };
22 }
23
24 Then, later, on another machine:
25
26 laptop$ syncthing-set-id syncthing-devices.nix
27
28 laptop$ cat syncthing-devices.nix
29 {
30 "services" = {
31 "syncthing" = {
32 "declarative" = {
33 "devices" = {
34 "desktop" = {
35 "id" =
36 "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
37 };
38 "laptop" = {
39 "id" =
40 "1111111-2222222-3333333-4444444-5555555-6666666-7777777-8888888";
41 };
42 };
43 };
44 };
45 };
46 }
47
48 Usage
49
50 $ syncthing-set-id
51
52 usage: syncthing-set-device-id file [name] [id]
53 example: syncthing-set-device-id /etc/nixos/modules/syncthing-devices.nix
54 example: syncthing-set-device-id /etc/nixos/modules/syncthing-devices.nix lappy
55 example: syncthing-set-device-id /etc/nixos/modules/syncthing-devices.nix lappy 1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK
56
57 If `name` is not specified, $HOSTNAME is used.
58 If `id` is not specified, the ID of the current system instance is used.