nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

nixos/prosody: remove obsoloted http_upload and replace it with http_file_share

+58 -89
+57 -87
nixos/modules/services/networking/prosody.nix
··· 418 418 }; 419 419 }; 420 420 421 - uploadHttpOpts = _: { 422 - options = { 423 - domain = mkOption { 424 - type = types.nullOr types.str; 425 - description = "Domain name for the http-upload service"; 426 - }; 427 - uploadFileSizeLimit = mkOption { 428 - type = types.str; 429 - default = "50 * 1024 * 1024"; 430 - description = "Maximum file size, in bytes. Defaults to 50MB."; 431 - }; 432 - uploadExpireAfter = mkOption { 433 - type = types.str; 434 - default = "60 * 60 * 24 * 7"; 435 - description = "Max age of a file before it gets deleted, in seconds."; 436 - }; 437 - userQuota = mkOption { 438 - type = types.nullOr types.int; 439 - default = null; 440 - example = 1234; 441 - description = '' 442 - Maximum size of all uploaded files per user, in bytes. There 443 - will be no quota if this option is set to null. 444 - ''; 445 - }; 446 - httpUploadPath = mkOption { 447 - type = types.str; 448 - description = '' 449 - Directory where the uploaded files will be stored when the http_upload module is used. 450 - By default, uploaded files are put in a sub-directory of the default Prosody storage path (usually /var/lib/prosody). 451 - ''; 452 - default = "/var/lib/prosody"; 421 + httpFileShareOpts = 422 + { config, options, ... }: 423 + { 424 + freeformType = 425 + with types; 426 + let 427 + atom = oneOf [ 428 + int 429 + bool 430 + str 431 + (listOf atom) 432 + ]; 433 + in 434 + attrsOf (nullOr atom) 435 + // { 436 + description = "int, bool, string or list of them"; 437 + }; 438 + options = { 439 + domain = mkOption { 440 + type = with types; nullOr str; 441 + description = "Domain name for a http_file_share service."; 442 + }; 443 + size_limit = mkOption { 444 + type = types.int; 445 + default = 10 * 1024 * 1024; 446 + defaultText = "10 * 1024 * 1024"; 447 + description = "Maximum file size, in bytes."; 448 + }; 449 + expires_after = mkOption { 450 + type = types.str; 451 + default = "1 week"; 452 + description = "Max age of a file before it gets deleted."; 453 + }; 454 + daily_quota = mkOption { 455 + type = types.nullOr types.int; 456 + default = 10 * config.size_limit; 457 + defaultText = lib.literalExpression "10 * ${options.size_limit}"; 458 + example = "100*1024*1024"; 459 + description = '' 460 + Maximum size of daily uploaded files per user, in bytes. 461 + ''; 462 + }; 453 463 }; 454 464 }; 455 - }; 456 - 457 - httpFileShareOpts = _: { 458 - freeformType = 459 - with types; 460 - let 461 - atom = oneOf [ 462 - int 463 - bool 464 - str 465 - (listOf atom) 466 - ]; 467 - in 468 - attrsOf (nullOr atom) 469 - // { 470 - description = "int, bool, string or list of them"; 471 - }; 472 - options.domain = mkOption { 473 - type = with types; nullOr str; 474 - description = "Domain name for a http_file_share service."; 475 - }; 476 - }; 477 465 478 466 vHostOpts = _: { 479 467 options = { ··· 493 505 494 506 configFile = 495 507 let 496 - httpDiscoItems = 497 - optional (cfg.uploadHttp != null) { 498 - url = cfg.uploadHttp.domain; 499 - description = "HTTP upload endpoint"; 500 - } 501 - ++ optional (cfg.httpFileShare != null) { 502 - url = cfg.httpFileShare.domain; 503 - description = "HTTP file share endpoint"; 504 - }; 508 + httpDiscoItems = optional (cfg.httpFileShare != null) { 509 + url = cfg.httpFileShare.domain; 510 + description = "HTTP file share endpoint"; 511 + }; 505 512 mucDiscoItems = builtins.foldl' ( 506 513 acc: muc: 507 514 [ ··· 575 592 ${muc.extraConfig} 576 593 '') cfg.muc} 577 594 578 - ${lib.optionalString (cfg.uploadHttp != null) '' 579 - Component ${toLua cfg.uploadHttp.domain} "http_upload" 580 - http_upload_file_size_limit = ${cfg.uploadHttp.uploadFileSizeLimit} 581 - http_upload_expire_after = ${cfg.uploadHttp.uploadExpireAfter} 582 - ${lib.optionalString ( 583 - cfg.uploadHttp.userQuota != null 584 - ) "http_upload_quota = ${toLua cfg.uploadHttp.userQuota}"} 585 - http_upload_path = ${toLua cfg.uploadHttp.httpUploadPath} 586 - ''} 587 - 588 595 ${lib.optionalString (cfg.httpFileShare != null) '' 589 596 Component ${toLua cfg.httpFileShare.domain} "http_file_share" 597 + modules_disabled = { "s2s" } 590 598 ${settingsToLua " http_file_share_" (cfg.httpFileShare // { domain = null; })} 591 599 ''} 592 600 ··· 786 812 description = "Additional path in which to look find plugins/modules"; 787 813 }; 788 814 789 - uploadHttp = mkOption { 790 - description = '' 791 - Configures the old Prosody builtin HTTP server to handle user uploads. 792 - ''; 793 - type = types.nullOr (types.submodule uploadHttpOpts); 794 - default = null; 795 - example = { 796 - domain = "uploads.my-xmpp-example-host.org"; 797 - }; 798 - }; 799 - 800 815 httpFileShare = mkOption { 801 816 description = '' 802 817 Configures the http_file_share module to handle user uploads. 818 + 819 + See <https://prosody.im/doc/modules/mod_http_file_share> for a full list of options. 803 820 ''; 804 821 type = types.nullOr (types.submodule httpFileShareOpts); 805 822 default = null; ··· 879 914 }; 880 915 }; 881 916 917 + imports = [ 918 + (lib.mkRemovedOptionModule [ "services" "prosody" "uploadHttp" ] 919 + "mod_http_upload has been obsoloted and been replaced by mod_http_file_share which can be configured with httpFileShare options." 920 + ) 921 + ]; 922 + 882 923 config = mkIf cfg.enable { 883 924 assertions = 884 925 let ··· 907 936 + genericErrMsg; 908 937 } 909 938 { 910 - assertion = cfg.uploadHttp != null || cfg.httpFileShare != null || !cfg.xmppComplianceSuite; 939 + assertion = cfg.httpFileShare != null || !cfg.xmppComplianceSuite; 911 940 message = '' 912 - You need to setup the http_upload or http_file_share modules through config.services.prosody.uploadHttp 913 - or config.services.prosody.httpFileShare to comply with XEP-0423. 941 + You need to setup http_file_share modules through config.services.prosody.httpFileShare to comply with XEP-0423. 914 942 '' 915 943 + genericErrMsg; 916 944 }
+1 -1
nixos/tests/xmpp/prosody.nix
··· 89 89 domain = "conference.example.com"; 90 90 } 91 91 ]; 92 - uploadHttp = { 92 + httpFileShare = { 93 93 domain = "uploads.example.com"; 94 94 }; 95 95 };
-1
pkgs/servers/xmpp/prosody/default.nix
··· 49 49 # default setup. 50 50 nixosModuleDeps = [ 51 51 "cloud_notify" 52 - "http_upload" 53 52 ]; 54 53 55 54 # A note to all those merging automated updates: Please also update this