dotfiles/modules/nixos/services/samba.nix

34 lines
887 B
Nix
Raw Normal View History

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."; };
config = {
2023-02-28 05:05:04 +00:00
services.samba = lib.mkIf (config.samba.enable) {
enable = true;
2023-03-05 19:59:58 +00:00
openFirewall = true;
shares.video = {
2023-03-05 20:44:55 +00:00
path = "/data";
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-02-28 05:05:04 +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
};
}