Files
system-config/home-manager/features/mounts/mcp-archive.nix

38 lines
934 B
Nix

{ pkgs, ... }:
{
home.packages = with pkgs; [ sshfs ];
systemd.user.services.mcp-archive = {
Unit = {
Description = "SSHFS mount for remote archive";
After = [ "network-online.target" ];
Before = [ "sleep.target" ];
StopPropagatedFrom = [ "sleep.target" ];
};
Service = {
Type = "simple";
ExecStartPre = "/run/current-system/sw/bin/mkdir -p %h/archive";
ExecStart = ''
${pkgs.sshfs}/bin/sshfs \
-f \
-o reconnect \
-o ServerAliveInterval=15 \
-o ServerAliveCountMax=3 \
-o IdentityFile=%h/.ssh/id_ed25519 \
-o StrictHostKeyChecking=yes \
drew@mcp:/tank/archive/drew \
%h/archive
'';
ExecStop = "/run/wrappers/bin/fusermount -u %h/archive";
Restart = "on-failure";
RestartSec = "10s";
};
Install = {
WantedBy = [ "default.target" ];
};
};
}