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.
7 desktop$ syncthing-set-id syncthing-devices.nix
8 Creating /home/user/myNixOSConfigs/syncthing-devices.nix
10 desktop$ cat syncthing-devices.nix
18 "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
26 Then, later, on another machine:
28 laptop$ syncthing-set-id syncthing-devices.nix
30 laptop$ cat syncthing-devices.nix
38 "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
42 "1111111-2222222-3333333-4444444-5555555-6666666-7777777-8888888";
55 usage: syncthing-set-device-id file [name] [id]
56 example: syncthing-set-device-id /etc/nixos/modules/syncthing-devices.nix
57 example: syncthing-set-device-id /etc/nixos/modules/syncthing-devices.nix lappy
58 example: syncthing-set-device-id /etc/nixos/modules/syncthing-devices.nix lappy 1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK
60 If `name` is not specified, $HOSTNAME is used.
61 If `id` is not specified, the ID of the current system instance is used.
66 You can use this repo as a channel.
68 Or, you can use an overlay. For example, you could create a `~/.config/nixpkgs/overlays/syncthing-set-id.nix` with this in it:
72 syncthing-set-id-pkgs = import (builtins.fetchGit {
73 url = "https://scottworley.com/syncthing-set-id.git";
75 rev = "0c29f01e83fdadd491b930a9108519be03c7937d";
77 in { inherit (syncthing-set-id-pkgs) syncthing-set-id; }
81 $ nix-env -iA nixos.syncthing-set-id