Skip to content

Instantly share code, notes, and snippets.

@tarneaux
Created July 4, 2025 12:22
Show Gist options
  • Save tarneaux/7376d06f5e40d53a5b08dd37da6f376c to your computer and use it in GitHub Desktop.
Save tarneaux/7376d06f5e40d53a5b08dd37da6f376c to your computer and use it in GitHub Desktop.
Nixos AutoFS + sshfs minimum working setup
{ pkgs, ... }:
{
environment.systemPackages = [
pkgs.fuse
pkgs.sshfs
];
services.autofs.enable = true;
services.autofs.debug = true;
services.autofs.autoMaster = let
mappingFile = pkgs.writeText "autofs.sshfs" ''
zk -fstype=fuse,user,rw,allow_other,IdentityFile=/home/tarneo/.ssh/id_ed25519,ServerAliveInterval=60,ServerAliveCountMax=10,reconnect,noatime :${pkgs.sshfs}/bin/sshfs\#tarneo@<server>\:zk
'';
in ''
/automount ${mappingFile} uid=1000,gid=1000,--timeout=10,--ghost
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment