]> git.scottworley.com Git - syncthing-autoregister/blob - README
Prefer modulesPath over <nixos/nixos/modules>
[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 ### Example
6
7 desktop$ syncthing-set-id syncthing-devices.nix
8 Creating /home/user/myNixOSConfigs/syncthing-devices.nix
9
10 desktop$ cat syncthing-devices.nix
11 {
12 "services" = {
13 "syncthing" = {
14 "devices" = {
15 "desktop" = {
16 "id" =
17 "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
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 "devices" = {
33 "desktop" = {
34 "id" =
35 "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
36 };
37 "laptop" = {
38 "id" =
39 "1111111-2222222-3333333-4444444-5555555-6666666-7777777-8888888";
40 };
41 };
42 };
43 };
44 }
45
46
47 ### Usage
48
49 $ syncthing-set-id
50
51 usage: syncthing-set-device-id file [name] [id]
52 example: syncthing-set-device-id /etc/nixos/modules/syncthing-devices.nix
53 example: syncthing-set-device-id /etc/nixos/modules/syncthing-devices.nix lappy
54 example: syncthing-set-device-id /etc/nixos/modules/syncthing-devices.nix lappy 1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK
55
56 If `name` is not specified, $HOSTNAME is used.
57 If `id` is not specified, the ID of the current system instance is used.
58
59
60 ### Installation
61
62 You can use this repo as a channel.
63
64 Or, you can use an overlay. For example, you could create a `~/.config/nixpkgs/overlays/syncthing-set-id.nix` with this in it:
65
66 self: super:
67 let
68 syncthing-set-id-pkgs = import (builtins.fetchGit {
69 url = "https://scottworley.com/syncthing-set-id.git";
70 ref = "master";
71 rev = "0c29f01e83fdadd491b930a9108519be03c7937d";
72 }) { pkgs = self; };
73 in { inherit (syncthing-set-id-pkgs) syncthing-set-id; }
74
75 And then
76
77 $ nix-env -iA nixos.syncthing-set-id