modified: common/home.nix

modified:   hosts/nix-minimal/configuration.nix
This commit is contained in:
2025-07-21 16:16:47 +10:00
parent 47927a91f1
commit dd32d23249
2 changed files with 41 additions and 19 deletions

View File

@@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ let
remote = "root@proxmox-ip:/var/lib/vz/template/iso";
localMount = "${config.home.homeDirectory}/proxmox-iso";
in {
imports = [ imports = [
./aliases.nix ./aliases.nix
@@ -26,13 +29,32 @@ programs.bash.enable = true;
vim vim
tmux tmux
nano nano
sshfs
]; ];
# Optional: set environment vars # Optional: set environment vars
home.sessionVariables = { home.sessionVariables = {
EDITOR = "nano"; 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...) # Optional: enable bash (or zsh, fish...)
# programs.bash.enable = true; # programs.bash.enable = true;

View File

@@ -23,25 +23,25 @@
''; '';
# Allow mounting with user permissions (optional, see note) # Allow mounting with user permissions (optional, see note)
security.wrappers.sshfs = { # security.wrappers.sshfs = {
source = "${pkgs.sshfs}/bin/sshfs"; # source = "${pkgs.sshfs}/bin/sshfs";
owner = "nixos"; # owner = "nixos";
group = "users"; # group = "users";
permissions = "4755"; # permissions = "4755";
fileSystems."/mnt/proxmox-iso" = { # fileSystems."/mnt/proxmox-iso" = {
device = "root@pve:/var/lib/vz/template/iso"; # device = "root@pve:/var/lib/vz/template/iso";
fsType = "fuse.sshfs"; # fsType = "fuse.sshfs";
options = [ # options = [
"IdentityFile=/home/nixos/.ssh/id_ed25519.pub" # or your SSH key path # "IdentityFile=/home/nixos/.ssh/id_ed25519.pub" # or your SSH key path
"allow_other" # "allow_other"
"reconnect" # "reconnect"
"ServerAliveInterval=15" # "ServerAliveInterval=15"
"ServerAliveCountMax=3" # "ServerAliveCountMax=3"
"StrictHostKeyChecking=no" # only if you're OK with this # "StrictHostKeyChecking=no" # only if you're OK with this
]; # ];
}; # };
}; # };
# Open ports in the firewall. # Open ports in the firewall.