marleyos/modules/nixos/mounts/babeshare/default.nix

58 lines
1.2 KiB
Nix

{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.mounts.babeshare;
user = config.users.users."${config.marleyos.my.name}";
uid =
if user.uid != null
then user.uid
else 1000;
options = lib.concatStringsSep "," [
"username=marley"
"password=granola chaos lend splendid"
"uid=${toString uid}"
"gid=${toString config.users.groups."wheel".gid}"
"nofail"
];
in {
options.marleyos.mounts.babeshare.enable = mkEnableOption "babeshare";
config = mkIf cfg.enable {
boot.supportedFilesystems = {
cifs = true;
};
systemd = {
mounts = [
{
what = "//truenas.blackcat.vip/babez";
where = "/mnt/babeshare/babez";
type = "cifs";
inherit options;
}
{
what = "//truenas.blackcat.vip/marley";
where = "/mnt/babeshare/marley";
type = "cifs";
inherit options;
}
];
automounts = [
{
where = "/mnt/babeshare/babez";
wantedBy = ["multi-user.target"];
}
{
where = "/mnt/babeshare/marley";
wantedBy = ["multi-user.target"];
}
];
};
};
}