From dd32d23249fc9c06ecaf22495c8809c7db83097d Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Mon, 21 Jul 2025 16:16:47 +1000 Subject: [PATCH] modified: common/home.nix modified: hosts/nix-minimal/configuration.nix --- common/home.nix | 24 ++++++++++++++++++- hosts/nix-minimal/configuration.nix | 36 ++++++++++++++--------------- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/common/home.nix b/common/home.nix index 063aa28..80b735c 100644 --- a/common/home.nix +++ b/common/home.nix @@ -1,6 +1,9 @@ { config, pkgs, lib, ... }: - { +let + remote = "root@proxmox-ip:/var/lib/vz/template/iso"; + localMount = "${config.home.homeDirectory}/proxmox-iso"; +in { imports = [ ./aliases.nix @@ -26,13 +29,32 @@ programs.bash.enable = true; vim tmux nano + sshfs ]; # Optional: set environment vars home.sessionVariables = { EDITOR = "nano"; }; + systemd.user.services.mount-proxmox-iso = { + Unit = { + Description = "Mount Proxmox ISO dir via SSHFS"; + After = [ "network-online.target" ]; + Wants = [ "network-online.target" ]; + }; + Service = { + Type = "simple"; + ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${localMount}"; + ExecStart = "${pkgs.sshfs}/bin/sshfs -o IdentityFile=${config.home.homeDirectory}/.ssh/id_ed25519,allow_other,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 root@proxmox-ip:/var/lib/vz/template/iso ${localMount}"; + ExecStop = "${pkgs.fuse3}/bin/fusermount3 -u ${localMount}"; + Restart = "on-failure"; + }; + + Install = { + WantedBy = [ "default.target" ]; + }; + }; # Optional: enable bash (or zsh, fish...) # programs.bash.enable = true; diff --git a/hosts/nix-minimal/configuration.nix b/hosts/nix-minimal/configuration.nix index 0349b62..d963a3d 100644 --- a/hosts/nix-minimal/configuration.nix +++ b/hosts/nix-minimal/configuration.nix @@ -23,25 +23,25 @@ ''; # Allow mounting with user permissions (optional, see note) - security.wrappers.sshfs = { - source = "${pkgs.sshfs}/bin/sshfs"; - owner = "nixos"; - group = "users"; - permissions = "4755"; + # security.wrappers.sshfs = { + # source = "${pkgs.sshfs}/bin/sshfs"; + # owner = "nixos"; + # group = "users"; + # permissions = "4755"; - fileSystems."/mnt/proxmox-iso" = { - device = "root@pve:/var/lib/vz/template/iso"; - fsType = "fuse.sshfs"; - options = [ - "IdentityFile=/home/nixos/.ssh/id_ed25519.pub" # or your SSH key path - "allow_other" - "reconnect" - "ServerAliveInterval=15" - "ServerAliveCountMax=3" - "StrictHostKeyChecking=no" # only if you're OK with this - ]; - }; - }; + # fileSystems."/mnt/proxmox-iso" = { + # device = "root@pve:/var/lib/vz/template/iso"; + # fsType = "fuse.sshfs"; + # options = [ + # "IdentityFile=/home/nixos/.ssh/id_ed25519.pub" # or your SSH key path + # "allow_other" + # "reconnect" + # "ServerAliveInterval=15" + # "ServerAliveCountMax=3" + # "StrictHostKeyChecking=no" # only if you're OK with this + # ]; + # }; + # }; # Open ports in the firewall.