reduce repetition in smb automounts
This commit is contained in:
parent
e2946e4a1f
commit
7f28811aea
1 changed files with 25 additions and 62 deletions
|
@ -1,72 +1,35 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
environment.systemPackages = [pkgs.cifs-utils];
|
environment.systemPackages = [pkgs.cifs-utils];
|
||||||
systemd.mounts = [
|
|
||||||
{
|
|
||||||
description = "smb hopper transmission download directory";
|
|
||||||
what = "//192.168.50.97/transmission"; # hopper local ip
|
|
||||||
where = "/server/transmission";
|
|
||||||
type = "cifs";
|
|
||||||
options = "uid=xun,gid=users,credentials=${config.sops.secrets.samba.path}";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
description = "smb hopper vault";
|
|
||||||
what = "//192.168.50.97/vault"; # hopper local ip
|
|
||||||
where = "/server/vault";
|
|
||||||
type = "cifs";
|
|
||||||
options = "uid=xun,gid=users,credentials=${config.sops.secrets.samba.path}";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
description = "smb hopper library";
|
|
||||||
what = "//192.168.50.97/library"; # hopper local ip
|
|
||||||
where = "/server/library";
|
|
||||||
type = "cifs";
|
|
||||||
options = "uid=xun,gid=users,credentials=${config.sops.secrets.samba.path},vers=3.0";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
description = "smb hopper slskd files";
|
|
||||||
what = "//192.168.50.97/slskd"; # hopper local ip
|
|
||||||
where = "/server/slskd";
|
|
||||||
type = "cifs";
|
|
||||||
options = "uid=xun,gid=users,credentials=${config.sops.secrets.samba.path}";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.automounts = [
|
imports = let
|
||||||
{
|
shares = [
|
||||||
requires = ["network-online.target"];
|
"transmission"
|
||||||
where = "/server/transmission";
|
"vault"
|
||||||
wantedBy = ["multi-user.target"];
|
"library"
|
||||||
automountConfig = {
|
"slskd"
|
||||||
TimeoutIdleSec = "10min";
|
];
|
||||||
|
in
|
||||||
|
map (share: {
|
||||||
|
systemd.mounts = lib.singleton {
|
||||||
|
description = "smb hopper ${share}";
|
||||||
|
what = "//192.168.50.97/${share}";
|
||||||
|
where = "/server/${share}";
|
||||||
|
type = "cifs";
|
||||||
|
options = "uid=xun,gid=users,credentials=${config.sops.secrets.samba.path}";
|
||||||
};
|
};
|
||||||
}
|
systemd.automounts = lib.singleton {
|
||||||
{
|
requires = ["network-online.target"];
|
||||||
requires = ["network-online.target"];
|
where = "/server/${share}";
|
||||||
where = "/server/vault";
|
wantedBy = ["multi-user.target"];
|
||||||
wantedBy = ["multi-user.target"];
|
automountConfig = {
|
||||||
automountConfig = {
|
TimeoutIdleSec = "10min";
|
||||||
TimeoutIdleSec = "10min";
|
};
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
{
|
shares;
|
||||||
requires = ["network-online.target"];
|
|
||||||
where = "/server/library";
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
automountConfig = {
|
|
||||||
TimeoutIdleSec = "10min";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
requires = ["network-online.target"];
|
|
||||||
where = "/server/slskd";
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
automountConfig = {
|
|
||||||
TimeoutIdleSec = "10min";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue