-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lab: move sshfs config into it's own nix file
Related to #142
- Loading branch information
Showing
2 changed files
with
87 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
inputs.nixos-hardware.nixosModules.common-cpu-intel-sandy-bridge | ||
./hardware.nix | ||
./periodic.nix | ||
./sshfs.nix | ||
]; | ||
|
||
# System76 Pangolin Performance uses BIOS so we need to disable systemd-boot and use grub | ||
|
@@ -77,86 +78,6 @@ | |
# Enable thermal control as this is an intel laptop | ||
services.thermald.enable = true; | ||
|
||
# Use SSHFS to mount folders from NAS for data and restic backups | ||
system.fsPackages = [ pkgs.sshfs ]; | ||
fileSystems = lib.mkIf (!config.ahayzen.testing) { | ||
mntbackuprestic = { | ||
# TODO: can we use name? | ||
# https://github.com/ahayzen/nix-config/issues/141 | ||
device = "[email protected]:/restic/repository"; | ||
mountPoint = "/mnt/backup-restic"; | ||
fsType = "sshfs"; | ||
options = | ||
[ | ||
"_netdev" | ||
|
||
"allow_other" | ||
|
||
"IdentityFile=/etc/ssh/ssh_host_ed25519_key" | ||
"Port=8022" | ||
|
||
"reconnect" | ||
"ServerAliveInterval=10" | ||
"ServerAliveCountMax=3" | ||
|
||
"follow_symlinks" | ||
|
||
"idmap=user" | ||
"uid=2000" | ||
"gid=2000" | ||
]; | ||
}; | ||
mntdata = { | ||
# TODO: can we use name? | ||
# https://github.com/ahayzen/nix-config/issues/141 | ||
device = "[email protected]:/restic/data"; | ||
mountPoint = "/mnt/data"; | ||
fsType = "sshfs"; | ||
options = | ||
[ | ||
"_netdev" | ||
|
||
# might need user_allow_other in fuse cofig? | ||
"allow_other" | ||
|
||
"IdentityFile=/etc/ssh/ssh_host_ed25519_key" | ||
"Port=8022" | ||
|
||
"reconnect" | ||
"ServerAliveInterval=10" | ||
"ServerAliveCountMax=3" | ||
|
||
"follow_symlinks" | ||
|
||
"idmap=user" | ||
"uid=2000" | ||
"gid=2000" | ||
]; | ||
}; | ||
}; | ||
|
||
# Emulate sshfs mount folders for testing | ||
systemd.tmpfiles.settings = lib.mkIf (config.ahayzen.testing) { | ||
"99-sshfs-mount" = { | ||
"/mnt/backup-restic" = { | ||
d = { | ||
age = "-"; | ||
group = "unpriv"; | ||
mode = "0750"; | ||
user = "unpriv"; | ||
}; | ||
}; | ||
"/mnt/data" = { | ||
d = { | ||
age = "-"; | ||
group = "unpriv"; | ||
mode = "0750"; | ||
user = "unpriv"; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
# Increase disk size for build VM | ||
virtualisation.vmVariant.virtualisation.diskSize = 2 * 1024; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# SPDX-FileCopyrightText: Andrew Hayzen <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
{ config, lib, pkgs, ... }: | ||
{ | ||
# Use SSHFS to mount folders from NAS for data and restic backups | ||
system.fsPackages = [ pkgs.sshfs ]; | ||
fileSystems = lib.mkIf (!config.ahayzen.testing) { | ||
mntbackuprestic = { | ||
# TODO: can we use name? | ||
# https://github.com/ahayzen/nix-config/issues/141 | ||
device = "[email protected]:/restic/repository"; | ||
mountPoint = "/mnt/backup-restic"; | ||
fsType = "sshfs"; | ||
options = | ||
[ | ||
"_netdev" | ||
|
||
"allow_other" | ||
|
||
"IdentityFile=/etc/ssh/ssh_host_ed25519_key" | ||
"Port=8022" | ||
|
||
"reconnect" | ||
"ServerAliveInterval=10" | ||
"ServerAliveCountMax=3" | ||
|
||
"follow_symlinks" | ||
|
||
"idmap=user" | ||
"uid=2000" | ||
"gid=2000" | ||
]; | ||
}; | ||
mntdata = { | ||
# TODO: can we use name? | ||
# https://github.com/ahayzen/nix-config/issues/141 | ||
device = "[email protected]:/restic/data"; | ||
mountPoint = "/mnt/data"; | ||
fsType = "sshfs"; | ||
options = | ||
[ | ||
"_netdev" | ||
|
||
# might need user_allow_other in fuse cofig? | ||
"allow_other" | ||
|
||
"IdentityFile=/etc/ssh/ssh_host_ed25519_key" | ||
"Port=8022" | ||
|
||
"reconnect" | ||
"ServerAliveInterval=10" | ||
"ServerAliveCountMax=3" | ||
|
||
"follow_symlinks" | ||
|
||
"idmap=user" | ||
"uid=2000" | ||
"gid=2000" | ||
]; | ||
}; | ||
}; | ||
|
||
# Emulate sshfs mount folders for testing | ||
systemd.tmpfiles.settings = lib.mkIf (config.ahayzen.testing) { | ||
"99-sshfs-mount" = { | ||
"/mnt/backup-restic" = { | ||
d = { | ||
age = "-"; | ||
group = "unpriv"; | ||
mode = "0750"; | ||
user = "unpriv"; | ||
}; | ||
}; | ||
"/mnt/data" = { | ||
d = { | ||
age = "-"; | ||
group = "unpriv"; | ||
mode = "0750"; | ||
user = "unpriv"; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |