fix(syncthing): Persist Syncthing state
Previously, the device ID would be lost and consequently regenerated on boot. This means that previous connections will recognise it as a new, different device.
This commit is contained in:
@@ -179,6 +179,8 @@ sydnix-cli is a command-line utility written in Clojure wrapping various sydnix-
|
||||
|
||||
** Emacs from scratch
|
||||
|
||||
*** TODO [#A] [[id:6141dc5c-2232-4bc0-9464-410c21135c86][Strategies]]
|
||||
|
||||
*** TODO Completions w/ [[https://github.com/minad/corfu][Corfu]]
|
||||
|
||||
*** TODO Overlay org-mode links with the domain name
|
||||
@@ -231,10 +233,6 @@ If a comment immediately proceeds a sexp, open the new sexp /before/ the comment
|
||||
|
||||
*** DONE Evil operators like ~=~ should not move point
|
||||
|
||||
*** TODO Fix ~syd-forward-up-sexp~
|
||||
|
||||
*** TODO Fix defun text object
|
||||
|
||||
*** TODO ESC should immediately close minibuffer, even whilst in insert state
|
||||
|
||||
*** DONE Daemon
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
./files.nix
|
||||
];
|
||||
|
||||
xdg.enable = true;
|
||||
|
||||
sydnix = {
|
||||
sops = {
|
||||
enable = true;
|
||||
|
||||
@@ -1,46 +1,81 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let mutableSymlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
in {
|
||||
# TODO: Move to programs/age.nix.
|
||||
xdg.configFile."sops/age/keys.txt".source =
|
||||
mutableSymlink "/persist/vault/${config.home.username}/keys/melbourne";
|
||||
in lib.mkMerge [
|
||||
{
|
||||
# TODO: Move to programs/age.nix.
|
||||
xdg.configFile."sops/age/keys.txt".source =
|
||||
mutableSymlink "/persist/vault/${config.home.username}/keys/melbourne";
|
||||
}
|
||||
|
||||
sydnix.impermanence = {
|
||||
enable = true;
|
||||
directories = [
|
||||
"Music"
|
||||
"Pictures"
|
||||
"Documents"
|
||||
"Videos"
|
||||
"src"
|
||||
"org"
|
||||
".ssh"
|
||||
{
|
||||
directory = ".local/share/Steam";
|
||||
method = "symlink";
|
||||
}
|
||||
".passage"
|
||||
];
|
||||
};
|
||||
{
|
||||
### Some basic impermanence setup.
|
||||
|
||||
# TODO: sydnix.syncthing module
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
settings = {
|
||||
overrideDevices = true;
|
||||
overrideFolders = true;
|
||||
devices = {
|
||||
"guix-rebound".id =
|
||||
"Q5B6LIV-5HQMWWV-XFQL5IT-PHP7PVE-XFWUVHK-F6WJ42C-OPMR4M7-GFNK3AG";
|
||||
};
|
||||
folders = {
|
||||
"org" = {
|
||||
path = "~/org";
|
||||
devices = [ "guix-rebound" ];
|
||||
ignorePerms = true;
|
||||
sydnix.impermanence = {
|
||||
enable = true;
|
||||
directories = [
|
||||
"Music"
|
||||
"Pictures"
|
||||
"Documents"
|
||||
"Videos"
|
||||
"src"
|
||||
# Should "org" be declared in emacs.nix? I don't think so. I
|
||||
# conjecture that my org files are extremely valuable with or without
|
||||
# Emacs.
|
||||
"org"
|
||||
".ssh"
|
||||
{
|
||||
directory = ".local/share/Steam";
|
||||
method = "symlink";
|
||||
}
|
||||
".passage"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
### Syncthing
|
||||
|
||||
# TODO: sydnix.syncthing module
|
||||
sydnix.impermanence.directories =
|
||||
let xdg-state-dir =
|
||||
"${config.home.stateHome
|
||||
or "${config.home.homeDirectory}/.local/state"}";
|
||||
in [
|
||||
# HACK: This relies on behaviour that is not explicitly defined by the
|
||||
# Syncthing Home-manager module. We have to trust that $XDG_STATE_DIR,
|
||||
# at the time of syncthing.service's start, does not differ from this
|
||||
# value defined in Nix. Perhaps a PR to home-manager adding an option
|
||||
# `services.syncthing.stateDir` would be good.
|
||||
#
|
||||
# If Syncthing ever breaks, make sure they didn't start using a different path:
|
||||
# https://github.com/nix-community/home-manager/blob/master/modules/services/syncthing.nix
|
||||
#
|
||||
# Evidence for using this path is found at: (permalink)
|
||||
# https://github.com/nix-community/home-manager/blob/6d3163aea47fdb1fe19744e91306a2ea4f602292/modules/services/syncthing.nix#L624
|
||||
|
||||
# Hack aside, this directory must be persisted to, at least
|
||||
# 1. Preserve the device ID.
|
||||
"${xdg-state-dir}/syncthing"
|
||||
];
|
||||
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
settings = {
|
||||
overrideDevices = true;
|
||||
overrideFolders = true;
|
||||
devices = {
|
||||
"guix-rebound".id =
|
||||
"Q5B6LIV-5HQMWWV-XFQL5IT-PHP7PVE-XFWUVHK-F6WJ42C-OPMR4M7-GFNK3AG";
|
||||
};
|
||||
folders = {
|
||||
"org" = {
|
||||
path = "~/org";
|
||||
devices = [ "guix-rebound" ];
|
||||
ignorePerms = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user