I keep my file servers peristently connected to the direct connect network using the ncdc client. Ncdc is for better or worse a curses client that must be attached to a terminal, so I need to start it at boot within a Tmux session.
{ config, lib, pkgs, ... }: { programs.tmux = { enable = true; secureSocket = false; # Use a socket in /tmp instead of /run/users }; systemd.services.tmux-emery = let tmux = "${lib.getBin pkgs.tmux}/bin/tmux"; in { wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; serviceConfig = { User = "emery"; Type = "forking"; ExecStart = "${tmux} new-session -d"; ExecStop = "${tmux} kill-session"; WorkingDirectory = "~"; }; postStart = '' ${tmux} set-option -g status-style bg=magenta ${tmux} new-window ${pkgs.ncdc}/bin/ncdc ''; }; }