Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

80 Zeilen
2.3KB

  1. {
  2. description = "NixOS Nextcloud server";
  3. inputs = {
  4. nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
  5. };
  6. outputs = { self, nixpkgs, ... }: {
  7. nixosModules.nextcloud = { config, lib, pkgs, ... }:
  8. let
  9. cfg = config.nextcloud;
  10. in
  11. {
  12. options.nextcloud = {
  13. enable = lib.mkOption {type = lib.types.bool;};
  14. adminPasswordFile = lib.mkOption {
  15. type = lib.types.path;
  16. description = "Path to file containing the root password.";
  17. };
  18. dbPasswordFile = lib.mkOption {
  19. type = lib.types.path;
  20. description = "Path to file containing the DB password.";
  21. };
  22. domain = lib.mkOption {type = lib.types.str;};
  23. hostName = lib.mkOption {type = lib.types.str;};
  24. port = lib.mkOption {type = lib.types.ints.unsigned;};
  25. };
  26. config = lib.mkIf cfg.enable {
  27. services.nextcloud = {
  28. enable = true;
  29. package = pkgs.nextcloud32;
  30. hostName = cfg.hostName;
  31. database.createLocally = true;
  32. https = true;
  33. port = cfg.port;
  34. caching.redis = true;
  35. config = {
  36. adminuser = "admin";
  37. adminpassFile = cfg.adminPasswordFile;
  38. dbtype = "mysql";
  39. dbuser = "nextcloud";
  40. #dbhost = "localhost";
  41. #dbpassFile = cfg.dbPasswordFile;
  42. };
  43. settings = {
  44. trusted_domains = [cfg.domain];
  45. };
  46. extraApps = with config.services.nextcloud.package.packages.apps; {
  47. inherit calendar tasks contacts news;
  48. };
  49. extraAppsEnable = true;
  50. # redis caching
  51. extraOptions = {
  52. redis = {
  53. host = "127.0.0.1";
  54. port = 31638;
  55. dbindex = 0;
  56. timeout = 1.5;
  57. };
  58. };
  59. };
  60. # nginx virtual host
  61. services.nginx.virtualHosts.${cfg.hostName} = {
  62. enableACME = true;
  63. acmeRoot = null;
  64. addSSL = true;
  65. # directs traffic to the appropriate port
  66. locations."/" = {
  67. proxyPass = "http://localhost:${cfg.port}";
  68. proxyWebsockets = true;
  69. };
  70. };
  71. };
  72. };
  73. };
  74. }