56 lines
1 KiB
Nix
56 lines
1 KiB
Nix
|
{
|
||
|
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;
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|