add a script to mount servo root

This commit is contained in:
colin 2022-08-30 19:55:15 -07:00
parent df379a2a38
commit 85add7c531
2 changed files with 44 additions and 5 deletions

View File

@ -1,8 +1,8 @@
{ pkgs, ... }:
let sshOpts = {
let sshOpts = rec {
fsType = "fuse.sshfs";
options = [
optionsBase = [
"x-systemd.automount"
"_netdev"
"user"
@ -11,23 +11,44 @@ let sshOpts = {
"identityfile=/home/colin/.ssh/id_ed25519"
"allow_other"
"default_permissions"
];
optionsColin = optionsBase ++ [
"uid=1000"
"gid=100"
];
# optionsRoot = optionsBase ++ [
# "uid=0"
# "gid=0"
# ];
};
in
{
fileSystems."/mnt/servo-media-wan" = {
device = "colin@uninsane.org:/var/lib/uninsane/media";
inherit (sshOpts) fsType options;
inherit (sshOpts) fsType;
options = sshOpts.optionsColin;
};
fileSystems."/mnt/servo-media-lan" = {
device = "colin@servo:/var/lib/uninsane/media";
inherit (sshOpts) fsType options;
inherit (sshOpts) fsType;
options = sshOpts.optionsColin;
};
fileSystems."/mnt/servo-root-wan" = {
device = "colin@uninsane.org:/";
inherit (sshOpts) fsType;
# options = sshOpts.optionsRoot;
options = sshOpts.optionsColin;
};
fileSystems."/mnt/servo-root-lan" = {
device = "colin@servo:/";
inherit (sshOpts) fsType;
# options = sshOpts.optionsRoot;
options = sshOpts.optionsColin;
};
fileSystems."/mnt/desko-home" = {
device = "colin@desko:/home/colin";
inherit (sshOpts) fsType options;
inherit (sshOpts) fsType;
options = sshOpts.optionsColin;
};
environment.systemPackages = [

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -ex
mnt=/mnt/servo-root-wan
# if lan not mounted, then try to mount it
if ! (test -d /mnt/servo-root-lan/nix)
then
sudo mount /mnt/servo-root-lan && mnt=/mnt/servo-root-lan
fi
# if the needed mount isn't mounted, mount it
if ! (test -d $mnt/nix)
then
sudo mount $mnt
fi
# symlink the fastest mount point into place
sudo ln -sf $mnt /mnt/servo-root