How to backup your weechat logs and config
For when you don’t already have a kubernetes cluster
Level 1: Just Back It Up#
-
Install syncthing for your distro and add another device
- This tutorial won’t go into that, see the official syncthing tutorial here
-
Move the weechat folders to ~/Sync (the default syncthing directory) and symlink them back
# Create Syncthing directory for WeeChat
mkdir -p ~/Sync/weechat
# Move WeeChat data to Syncthing directory
mv ~/.local/share/weechat/ ~/Sync/weechat/logs
mv ~/.config/weechat/ ~/Sync/weechat/config
# Create symlinks back to original locations
ln -s ~/Sync/weechat/config ~/.config/weechat
ln -s ~/Sync/weechat/logs ~/.local/share/weechat
- Done! your weechat config and logs will now sync between devices
Level 2: Nix Declarative Config and Versioning#
Create a syncthing.nix:
{ config, pkgs, ... }:
let
allDevices = [ "device1" "device2" ]; # Replace with your device names
in
{
services.syncthing = {
enable = true;
user = "user"; # Replace with your username
dataDir = "/home/user";
configDir = "/home/user/.config/syncthing";
settings = {
devices = {
device1.id = "id"; # Replace with device id
device2.id = "id";
};
folders = {
"/home/user/Sync" = {
label = "Sync";
id = "default";
devices = allDevices;
versioning = {
type = "simple";
params.keep = "3"; # Keep 3 past versions
};
};
};
};
};
}
Level 3: Firejail#
- that’s right we’re going all the way back to my first post for this one!
-
Create directory for the jail:
mkdir -p ~/Sync/jails/weechat
-
Make a
~/bin/weechat
:
#!/bin/sh
firejail \
--noprofile \
--private=$HOME/Sync/jails/weechat \
--keep-var-tmp \ # Can transfer files to/from /var/tmp
--caps.keep=sys_admin,sys_chroot \
--netfilter \
--nodbus \
--nodvd \
--nogroups \
--notv \
--shell=none \
--disable-mnt \
--private-dev \
--private-tmp \
/usr/bin/weechat