Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lldap: rust 1.80 compatibility #333125

Merged
merged 9 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions pkgs/servers/ldap/lldap/0001-parameterize-frontend-location.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
From a09babb0cd9dd532ad2de920a2a35aa03d740dc6 Mon Sep 17 00:00:00 2001
From: Herwig Hochleitner <[email protected]>
Date: Thu, 8 Aug 2024 00:29:14 +0200
Subject: [PATCH] parameterize frontend location

---
server/src/infra/tcp_server.rs | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/server/src/infra/tcp_server.rs b/server/src/infra/tcp_server.rs
index fa5f11f..16e64c5 100644
--- a/server/src/infra/tcp_server.rs
+++ b/server/src/infra/tcp_server.rs
@@ -25,7 +25,7 @@ use std::sync::RwLock;
use tracing::info;

async fn index<Backend>(data: web::Data<AppState<Backend>>) -> actix_web::Result<impl Responder> {
- let mut file = std::fs::read_to_string(r"./app/index.html")?;
+ let mut file = std::fs::read_to_string(r"@frontend@/index.html")?;

if data.server_url.path() != "/" {
file = file.replace(
@@ -80,7 +80,7 @@ pub(crate) fn error_to_http_response(error: TcpError) -> HttpResponse {
async fn main_js_handler<Backend>(
data: web::Data<AppState<Backend>>,
) -> actix_web::Result<impl Responder> {
- let mut file = std::fs::read_to_string(r"./app/static/main.js")?;
+ let mut file = std::fs::read_to_string(r"@frontend@/static/main.js")?;

if data.server_url.path() != "/" {
file = file.replace("/pkg/", format!("{}/pkg/", data.server_url.path()).as_str());
@@ -92,12 +92,12 @@ async fn main_js_handler<Backend>(
}

async fn wasm_handler() -> actix_web::Result<impl Responder> {
- Ok(actix_files::NamedFile::open_async("./app/pkg/lldap_app_bg.wasm").await?)
+ Ok(actix_files::NamedFile::open_async("@frontend@/pkg/lldap_app_bg.wasm").await?)
}

async fn wasm_handler_compressed() -> actix_web::Result<impl Responder> {
Ok(
- actix_files::NamedFile::open_async("./app/pkg/lldap_app_bg.wasm.gz")
+ actix_files::NamedFile::open_async("@frontend@/pkg/lldap_app_bg.wasm.gz")
.await?
.customize()
.insert_header(header::ContentEncoding::Gzip)
@@ -143,11 +143,11 @@ fn http_config<Backend>(
.service(web::resource("/pkg/lldap_app_bg.wasm").route(web::route().to(wasm_handler)))
.service(web::resource("/static/main.js").route(web::route().to(main_js_handler::<Backend>)))
// Serve the /pkg path with the compiled WASM app.
- .service(Files::new("/pkg", "./app/pkg"))
+ .service(Files::new("/pkg", "@frontend@/pkg"))
// Serve static files
- .service(Files::new("/static", "./app/static"))
+ .service(Files::new("/static", "@frontend@/static"))
// Serve static fonts
- .service(Files::new("/static/fonts", "./app/static/fonts"))
+ .service(Files::new("/static/fonts", "@frontend@/static/fonts"))
// Default to serve index.html for unknown routes, to support routing.
.default_service(web::route().guard(guard::Get()).to(index::<Backend>));
}
--
2.45.2

73 changes: 51 additions & 22 deletions pkgs/servers/ldap/lldap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pkgs/servers/ldap/lldap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ let
cargoHash = "sha256-vcpxcRlW1OKoD64owFF6mkxSqmNrvY+y3Ckn5UwEQ50=";
};

commonDerivationAttrs = rec {
commonDerivationAttrs = {
pname = "lldap";
version = "0.5.0";
version = "0.5.1-unstable-2024-08-09";

src = fetchFromGitHub {
owner = "lldap";
repo = "lldap";
rev = "v${version}";
hash = "sha256-2MEfwppkS9l3iHPNlkJB4tJnma0xMi0AckLv6wpzy1Y=";
rev = "4138963bee15f5423629c081ec88805d43b8235c";
hash = "sha256-g/Y+StSQQiA+1O0yh2xIhBHO9/MjM4QW1DNQIABTHdI=";
};

# `Cargo.lock` has git dependencies, meaning can't use `cargoHash`
Expand All @@ -38,6 +38,7 @@ let
"yew_form-0.1.8" = "sha256-1n9C7NiFfTjbmc9B5bDEnz7ZpYJo9ZT8/dioRXJ65hc=";
};
};

};

frontend = rustPlatform.buildRustPackage (commonDerivationAttrs // {
Expand All @@ -60,11 +61,10 @@ let
});

in rustPlatform.buildRustPackage (commonDerivationAttrs // {

cargoBuildFlags = [ "-p" "lldap" "-p" "lldap_migration_tool" "-p" "lldap_set_password" ];

patches = [
./static-frontend-path.patch
./0001-parameterize-frontend-location.patch
];

postPatch = ''
Expand Down
43 changes: 0 additions & 43 deletions pkgs/servers/ldap/lldap/static-frontend-path.patch

This file was deleted.