2023-03-05 19:59:58 +00:00
|
|
|
{ config, pkgs, lib, ... }: {
|
2023-02-28 05:05:04 +00:00
|
|
|
|
|
|
|
options = { samba.enable = lib.mkEnableOption "Enable Samba sharing."; };
|
|
|
|
|
2023-03-02 19:49:20 +00:00
|
|
|
config = {
|
2023-02-28 05:05:04 +00:00
|
|
|
|
2023-03-02 19:49:20 +00:00
|
|
|
services.samba = lib.mkIf (config.samba.enable) {
|
|
|
|
enable = true;
|
2023-03-05 19:59:58 +00:00
|
|
|
openFirewall = true;
|
2023-03-02 19:49:20 +00:00
|
|
|
shares.video = {
|
2023-03-05 20:44:55 +00:00
|
|
|
path = "/data";
|
2023-03-02 19:49:20 +00:00
|
|
|
browseable = "yes";
|
|
|
|
"read only" = "no";
|
|
|
|
"guest ok" = "no";
|
|
|
|
"force user" = config.user;
|
|
|
|
"force group" = config.user;
|
2023-03-05 20:44:55 +00:00
|
|
|
comment = "NAS";
|
2023-03-02 19:49:20 +00:00
|
|
|
};
|
2023-02-28 05:05:04 +00:00
|
|
|
};
|
|
|
|
|
2023-03-02 19:49:20 +00:00
|
|
|
# Allow browsing Samba shares
|
|
|
|
services.gvfs =
|
|
|
|
lib.mkIf (config.gui.enable && config.nautilus.enable) { enable = true; };
|
|
|
|
|
2023-03-05 19:59:58 +00:00
|
|
|
# Permissions required to mount Samba with GVFS, if not using desktop environment
|
|
|
|
environment.systemPackages = lib.mkIf (config.gui.enable
|
|
|
|
&& config.nautilus.enable
|
|
|
|
&& config.services.xserver.windowManager.i3.enable)
|
|
|
|
[ pkgs.lxqt.pxqt-policykit ];
|
|
|
|
|
2023-02-28 05:05:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|