diff --git a/clients/quadraticserver/docs.nix b/clients/quadraticserver/docs.nix deleted file mode 100644 index 601458f..0000000 --- a/clients/quadraticserver/docs.nix +++ /dev/null @@ -1,122 +0,0 @@ -{ - inputs, - config, - pkgs, - ... -}: let - s3Domain = "http://127.0.0.1${config.services.minio.listenAddress}"; - cfg = config.services.lasuite-docs; -in { - imports = [inputs.lasuite-docs-proxy.nixosModules.default]; - - systemd.services = { - lasuite-docs-collaboration-server.serviceConfig = { - EnvironmentFile = cfg.environmentFile; - Restart = "always"; - }; - - lasuite-docs-celery.serviceConfig.Restart = "always"; - lasuite-docs.serviceConfig.Restart = "always"; - }; - - services = let - proxySocket = "/var/run/lasuite-docs-proxy/socket"; - authDomain = "auth.federated.nexus"; - domain = "docs.federated.nexus"; - s3Url = "${s3Domain}/lasuite-docs"; - socket = "/run/lasuite-docs/socket"; - in { - lasuite-docs-proxy = { - enable = true; - args = [ - "--socket" - proxySocket - "--authUri" - "https://docs.federated.nexus/api/v1.0/documents/media-auth/" - "--minioUri" - s3Url - ]; - group = "caddy"; - }; - lasuite-docs = { - enable = true; - enableNginx = false; - redis.createLocally = true; - postgresql.createLocally = true; - frontendPackage = pkgs.lasuite-docs-frontend.overrideAttrs { - NEXT_PUBLIC_PUBLISH_AS_MIT = "false"; - }; - bind = "unix:${socket}"; - inherit s3Url domain; - - settings = { - OIDC_OP_AUTHORIZATION_ENDPOINT = "https://federated.nexus/login"; - OIDC_OP_TOKEN_ENDPOINT = "https://${authDomain}/token"; - OIDC_OP_USER_ENDPOINT = "https://${authDomain}/userinfo"; - OIDC_RP_SIGN_ALGO = "HS256"; - - COLLABORATION_API_URL = "https://${domain}/collaboration/api/"; - LOGIN_REDIRECT_URL = "https://${domain}"; - - AWS_S3_ENDPOINT_URL = s3Domain; - AWS_S3_ACCESS_KEY_ID = "minioadmin"; - AWS_STORAGE_BUCKET_NAME = "lasuite-docs"; - MEDIA_BASE_URL = "https://${domain}"; - - DJANGO_ALLOWED_HOSTS = domain; - }; - - environmentFile = config.age.secrets."lasuiteSecrets.age".path; - }; - - minio = { - enable = true; - rootCredentialsFile = config.age.secrets."minioCredentials.age".path; - }; - - caddy.virtualHosts."${domain}".extraConfig = let - collabUrl = "http://localhost:${toString cfg.collaborationServer.port}"; - in '' - handle_errors { - rewrite * /{http.error.status_code} - file_server - } - - redir /api/v1.0/logout/None / - - root * ${cfg.frontendPackage} - file_server - - @uuidDocs path_regexp uuidDocs ^/docs/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/?$ - rewrite @uuidDocs /docs/[id]/index.html - - reverse_proxy /api/* unix/${socket} - reverse_proxy /admin/* unix/${socket} - - reverse_proxy /collaboration/ws/* ${collabUrl} - reverse_proxy /collaboration/api/* ${collabUrl} - - reverse_proxy /api/v1.0/documents/media-auth/ unix/${socket} - - reverse_proxy /media/* unix/${proxySocket} - ''; - }; - - systemd.services.minio-init = { - description = "Create MinIO bucket"; - after = ["minio.service"]; - requires = ["minio.service"]; - wantedBy = ["multi-user.target"]; - path = [pkgs.getent pkgs.minio-client]; - - serviceConfig = { - Type = "oneshot"; - EnvironmentFile = config.age.secrets."minioCredentials.age".path; - ExecStart = pkgs.writeShellScript "init-minio" '' - mc alias set minio ${s3Domain} "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD" --api s3v4 - mc mb --ignore-existing minio/lasuite-docs - mc anonymous get minio/lasuite-docs - ''; - }; - }; -} diff --git a/clients/quadraticserver/docs/default.nix b/clients/quadraticserver/docs/default.nix new file mode 100644 index 0000000..d0c53c5 --- /dev/null +++ b/clients/quadraticserver/docs/default.nix @@ -0,0 +1,138 @@ +{ + inputs, + config, + pkgs, + ... +}: +let + s3Domain = "http://127.0.0.1${config.services.minio.listenAddress}"; + cfg = config.services.lasuite-docs; +in +{ + imports = [ inputs.lasuite-docs-proxy.nixosModules.default ]; + + systemd.services = { + lasuite-docs-collaboration-server.serviceConfig = { + EnvironmentFile = cfg.environmentFile; + Restart = "always"; + }; + + lasuite-docs-celery.serviceConfig.Restart = "always"; + lasuite-docs.serviceConfig.Restart = "always"; + }; + + services = + let + proxySocket = "/var/run/lasuite-docs-proxy/socket"; + authDomain = "auth.federated.nexus"; + domain = "docs.federated.nexus"; + s3Url = "${s3Domain}/lasuite-docs"; + socket = "/run/lasuite-docs/socket"; + in + { + lasuite-docs-proxy = { + enable = true; + args = [ + "--socket" + proxySocket + "--authUri" + "https://docs.federated.nexus/api/v1.0/documents/media-auth/" + "--minioUri" + s3Url + ]; + group = "caddy"; + }; + lasuite-docs = { + enable = true; + enableNginx = false; + redis.createLocally = true; + postgresql.createLocally = true; + backendPackage = inputs.nixpkgs-lasuite.legacyPackages.${pkgs.system}.lasuite-docs.overrideAttrs { + patches = [ ./enable-languages.patch ]; + }; + collaborationServer.package = + inputs.nixpkgs-lasuite.legacyPackages.${pkgs.system}.lasuite-docs-collaboration-server; + frontendPackage = + inputs.nixpkgs-lasuite.legacyPackages.${pkgs.system}.lasuite-docs-frontend.overrideAttrs + { + NEXT_PUBLIC_PUBLISH_AS_MIT = "false"; + }; + bind = "unix:${socket}"; + inherit s3Url domain; + + settings = { + OIDC_OP_AUTHORIZATION_ENDPOINT = "https://federated.nexus/login"; + OIDC_OP_TOKEN_ENDPOINT = "https://${authDomain}/token"; + OIDC_OP_USER_ENDPOINT = "https://${authDomain}/userinfo"; + OIDC_RP_SIGN_ALGO = "HS256"; + + COLLABORATION_API_URL = "https://${domain}/collaboration/api/"; + LOGIN_REDIRECT_URL = "https://${domain}"; + + AWS_S3_ENDPOINT_URL = s3Domain; + AWS_S3_ACCESS_KEY_ID = "minioadmin"; + AWS_STORAGE_BUCKET_NAME = "lasuite-docs"; + MEDIA_BASE_URL = "https://${domain}"; + + DJANGO_ALLOWED_HOSTS = domain; + }; + + environmentFile = config.age.secrets."lasuiteSecrets.age".path; + }; + + minio = { + enable = true; + rootCredentialsFile = config.age.secrets."minioCredentials.age".path; + }; + + caddy.virtualHosts."${domain}".extraConfig = + let + collabUrl = "http://localhost:${toString cfg.collaborationServer.port}"; + in + '' + handle_errors { + rewrite * /{http.error.status_code} + file_server + } + + redir /api/v1.0/logout/None / + + root * ${cfg.frontendPackage} + file_server + + @uuidDocs path_regexp uuidDocs ^/docs/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/?$ + rewrite @uuidDocs /docs/[id]/index.html + + reverse_proxy /api/* unix/${socket} + reverse_proxy /admin/* unix/${socket} + + reverse_proxy /collaboration/ws/* ${collabUrl} + reverse_proxy /collaboration/api/* ${collabUrl} + + reverse_proxy /api/v1.0/documents/media-auth/ unix/${socket} + + reverse_proxy /media/* unix/${proxySocket} + ''; + }; + + systemd.services.minio-init = { + description = "Create MinIO bucket"; + after = [ "minio.service" ]; + requires = [ "minio.service" ]; + wantedBy = [ "multi-user.target" ]; + path = [ + pkgs.getent + pkgs.minio-client + ]; + + serviceConfig = { + Type = "oneshot"; + EnvironmentFile = config.age.secrets."minioCredentials.age".path; + ExecStart = pkgs.writeShellScript "init-minio" '' + mc alias set minio ${s3Domain} "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD" --api s3v4 + mc mb --ignore-existing minio/lasuite-docs + mc anonymous get minio/lasuite-docs + ''; + }; + }; +} diff --git a/clients/quadraticserver/docs/enable-languages.patch b/clients/quadraticserver/docs/enable-languages.patch new file mode 100644 index 0000000..f607294 --- /dev/null +++ b/clients/quadraticserver/docs/enable-languages.patch @@ -0,0 +1,13 @@ +diff --git a/src/backend/impress/settings.py b/src/backend/impress/settings.py +index 9059dd29..010cc524 100755 +--- a/impress/settings.py ++++ b/impress/settings.py +@@ -248,6 +248,9 @@ class Base(Configuration): + ("de-de", "Deutsch"), + ("nl-nl", "Nederlands"), + ("es-es", "Español"), ++ ("br-fr", "Brezhoneg"), ++ ("uk-ua", "Українська"), ++ ("ru-ru", "Русский"), + ) + ) \ No newline at end of file diff --git a/flake.lock b/flake.lock index b2fed37..5e8cb80 100644 --- a/flake.lock +++ b/flake.lock @@ -2225,6 +2225,22 @@ "type": "github" } }, + "nixpkgs-lasuite": { + "locked": { + "lastModified": 1757797355, + "narHash": "sha256-LXaQB8zGpk8navUjQkyJq6wg7PWy2Tbh2wIyq25f3aU=", + "owner": "Henry-Hiles", + "repo": "nixpkgs", + "rev": "c112711203311c8ca77ed6c31ea7f3fd57fcdd80", + "type": "github" + }, + "original": { + "owner": "Henry-Hiles", + "ref": "bump-lasuite", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-latest": { "locked": { "lastModified": 1752336159, @@ -2668,6 +2684,7 @@ "nix-maid": "nix-maid", "nix-matrix-appservices": "nix-matrix-appservices", "nixpkgs": "nixpkgs_2", + "nixpkgs-lasuite": "nixpkgs-lasuite", "nixpkgs-master": "nixpkgs-master", "ooye": "ooye", "run0-sudo-shim": "run0-sudo-shim", diff --git a/flake.nix b/flake.nix index 3eb57c4..f75d8c5 100755 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ gnome-mobile.url = "github:chuangzhu/nixpkgs-gnome-mobile"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-master.url = "github:nixos/nixpkgs"; + nixpkgs-lasuite.url = "github:Henry-Hiles/nixpkgs/bump-lasuite"; wrapper-manager.url = "github:viperML/wrapper-manager"; flake-parts.url = "github:hercules-ci/flake-parts"; nix-maid.url = "github:viperML/nix-maid";