nix/module/Ftpd.nix

37 lines
713 B
Nix
Raw Normal View History

{
2024-11-04 04:37:29 +03:00
config,
lib,
pkgs,
util,
...
}: let
cfg = config.module.ftpd;
in
2024-11-04 04:37:29 +03:00
{
options.module.ftpd = {
enable = lib.mkEnableOption "the FTP server";
storage = lib.mkOption {
default = null;
type = lib.types.str;
};
};
2024-06-25 04:04:39 +03:00
2024-11-04 04:37:29 +03:00
config = lib.mkIf cfg.enable {
services.vsftpd = {
enable = true;
allowWriteableChroot = true;
anonymousMkdirEnable = true;
anonymousUmask = "000";
anonymousUploadEnable = true;
anonymousUser = true;
anonymousUserHome = cfg.storage;
anonymousUserNoPassword = true;
localUsers = false;
writeEnable = true;
extraConfig = util.trimTabs ''
anon_other_write_enable=YES
'';
};
};
}