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
17 "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
24 Then, later, on another machine:
26 laptop$ syncthing-set-id syncthing-devices.nix
28 laptop$ cat syncthing-devices.nix
35 "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
39 "1111111-2222222-3333333-4444444-5555555-6666666-7777777-8888888";
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
56 If `name` is not specified, $HOSTNAME is used.
57 If `id` is not specified, the ID of the current system instance is used.
62 You can use this repo as a channel.
64 Or, you can use an overlay. For example, you could create a `~/.config/nixpkgs/overlays/syncthing-set-id.nix` with this in it:
68 syncthing-set-id-pkgs = import (builtins.fetchGit {
69 url = "https://scottworley.com/syncthing-set-id.git";
71 rev = "0c29f01e83fdadd491b930a9108519be03c7937d";
73 in { inherit (syncthing-set-id-pkgs) syncthing-set-id; }
77 $ nix-env -iA nixos.syncthing-set-id