refactor: break out a helper in fs.nix for mounting remote home dirs
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
# docs
|
# docs
|
||||||
# - x-systemd options: <https://www.freedesktop.org/software/systemd/man/systemd.mount.html>
|
# - x-systemd options: <https://www.freedesktop.org/software/systemd/man/systemd.mount.html>
|
||||||
|
|
||||||
{ pkgs, sane-lib, ... }:
|
{ lib, pkgs, sane-lib, ... }:
|
||||||
|
|
||||||
let fsOpts = rec {
|
let
|
||||||
|
fsOpts = rec {
|
||||||
common = [
|
common = [
|
||||||
"_netdev"
|
"_netdev"
|
||||||
"noatime"
|
"noatime"
|
||||||
@@ -55,7 +56,17 @@ let fsOpts = rec {
|
|||||||
"nofail" # don't fail remote-fs.target when this mount fails (not an option for sshfs else would be common)
|
"nofail" # don't fail remote-fs.target when this mount fails (not an option for sshfs else would be common)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
remoteHome = host: {
|
||||||
|
fileSystems."/mnt/${host}-home" = {
|
||||||
|
device = "colin@${host}:/home/colin";
|
||||||
|
fsType = "fuse.sshfs";
|
||||||
|
options = fsOpts.sshColin ++ fsOpts.noauto;
|
||||||
|
noCheck = true;
|
||||||
|
};
|
||||||
|
sane.fs."/mnt/${host}-home" = sane-lib.fs.wantedDir;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
# some services which use private directories error if the parent (/var/lib/private) isn't 700.
|
# some services which use private directories error if the parent (/var/lib/private) isn't 700.
|
||||||
sane.fs."/var/lib/private".dir.acl.mode = "0700";
|
sane.fs."/var/lib/private".dir.acl.mode = "0700";
|
||||||
@@ -108,22 +119,6 @@ in
|
|||||||
# };
|
# };
|
||||||
sane.fs."/mnt/servo-media" = sane-lib.fs.wantedSymlinkTo "/mnt/servo-nfs/media";
|
sane.fs."/mnt/servo-media" = sane-lib.fs.wantedSymlinkTo "/mnt/servo-nfs/media";
|
||||||
|
|
||||||
fileSystems."/mnt/desko-home" = {
|
|
||||||
device = "colin@desko:/home/colin";
|
|
||||||
fsType = "fuse.sshfs";
|
|
||||||
options = fsOpts.sshColin ++ fsOpts.noauto;
|
|
||||||
noCheck = true;
|
|
||||||
};
|
|
||||||
sane.fs."/mnt/desko-home" = sane-lib.fs.wantedDir;
|
|
||||||
|
|
||||||
fileSystems."/mnt/moby-home" = {
|
|
||||||
device = "colin@moby-hn:/home/colin";
|
|
||||||
fsType = "fuse.sshfs";
|
|
||||||
options = fsOpts.sshColin ++ fsOpts.noauto;
|
|
||||||
noCheck = true;
|
|
||||||
};
|
|
||||||
sane.fs."/mnt/moby-home" = sane-lib.fs.wantedDir;
|
|
||||||
|
|
||||||
environment.pathsToLink = [
|
environment.pathsToLink = [
|
||||||
# needed to achieve superuser access for user-mounted filesystems (see optionsRoot above)
|
# needed to achieve superuser access for user-mounted filesystems (see optionsRoot above)
|
||||||
# we can only link whole directories here, even though we're only interested in pkgs.openssh
|
# we can only link whole directories here, even though we're only interested in pkgs.openssh
|
||||||
@@ -135,3 +130,7 @@ in
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(remoteHome "desko")
|
||||||
|
(remoteHome "moby")
|
||||||
|
]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user