nixos-config/modules/samba/default.nix

56 lines
1 KiB
Nix
Raw Permalink Normal View History

2025-01-14 19:45:47 +01:00
{
pkgs,
config,
lib,
...
}:
with lib;
let
cfg = config.eboskma.samba;
sharedFolder = types.submodule {
options = {
path = mkOption {
description = "Path";
type = types.path;
example = literalExpression "/srv/files";
};
name = mkOption {
description = "Name of the share. Defaults to folder name of {option}`eboskma.samba.shares.*.path`";
type = types.nullOr types.str;
};
};
};
in
{
options.eboskma.samba = {
enable = mkEnableOption "Shared folders over CIFS";
shares = mkOption {
description = "Folders to share";
type = types.listOf sharedFolder;
default = [ ];
};
};
config = mkIf cfg.enable {
services = {
samba = {
enable = true;
package = pkgs.samba4Full;
nmbd.enable = true;
openFirewall = true;
usershares = {
enable = true;
group = "users";
};
};
samba-wsdd = {
enable = true;
openFirewall = true;
};
};
};
}