Automount samba shares
This commit is contained in:
@@ -17,6 +17,7 @@ in {
|
||||
./discord.nix
|
||||
./steam.nix
|
||||
./touchpad.nix
|
||||
./mount-samba.nix
|
||||
];
|
||||
|
||||
options.de = {
|
||||
|
||||
36
common/pc/mount-samba.nix
Normal file
36
common/pc/mount-samba.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
# mounts the samba share on s0 over zeroteir
|
||||
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.mount-samba;
|
||||
|
||||
# prevents hanging on network split
|
||||
network_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
|
||||
|
||||
user_opts = "uid=${toString config.users.users.googlebot.uid},file_mode=0660,dir_mode=0770,user";
|
||||
auth_opts = "credentials=/run/agenix/smb-secrets";
|
||||
version_opts = "vers=2.1";
|
||||
|
||||
opts = "${network_opts},${user_opts},${version_opts}";
|
||||
in {
|
||||
options.services.mount-samba = {
|
||||
enable = lib.mkEnableOption "enable mounting samba shares";
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg.enable && config.services.zerotierone.enable) {
|
||||
fileSystems."/mnt/public" = {
|
||||
device = "//s0.zt.neet.dev/public";
|
||||
fsType = "cifs";
|
||||
options = ["guest,${opts}"];
|
||||
};
|
||||
|
||||
fileSystems."/mnt/private" = {
|
||||
device = "//s0.zt.neet.dev/googlebot";
|
||||
fsType = "cifs";
|
||||
options = ["${auth_opts},${opts}"];
|
||||
};
|
||||
|
||||
age.secrets.smb-secrets.file = ../../secrets/smb-secrets.age;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user