2024-09-05 08:28:29 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
rustPlatform,
|
|
|
|
fetchFromGitHub,
|
2024-11-03 14:34:20 +01:00
|
|
|
trunk,
|
2025-02-17 22:38:30 +01:00
|
|
|
tailwindcss_3,
|
2024-09-05 08:28:29 +02:00
|
|
|
fetchNpmDeps,
|
2024-10-06 21:57:32 +02:00
|
|
|
nix-update-script,
|
2024-09-05 08:28:29 +02:00
|
|
|
nodejs,
|
|
|
|
npmHooks,
|
|
|
|
llvmPackages,
|
buildWasmBindgenCli,wasm-bindgen-cli-*: init
Exposing an overridable cargoHash parameter is problematic because it
will produce silently broken FODs if we change the hashing scheme,
which we are currently doing across the tree because Cargo 1.84.0 has
changed the output of fetchCargoTarball, meaning all hashes have been
invalidated. To avoid this happening in future, we are changing to
the fetchCargoVendor mechanism, which does not depend on
implementation details of Cargo.
The future-proof way to override a package with Cargo dependencies is
to pass a cargoDeps object. This is more verbose, and requires the
caller to have access to the src object for the package. To
compensate for this, I've introduced a buildWasmBindgenCli function
that is nicer to use than wasm-bindgen-cli.overrideAttrs, and I've
also introduced versioned attributes for wasm-bindgen-cli versions
currently in use in Nixpkgs, so that each package that wants to use a
particular version doesn't have to duplicate the src and cargoDeps
definitions for that version.
The unversioned "wasm-bindgen-cli" attribute is demoted to an alias,
with a view to its eventual removal.
2025-01-28 11:24:22 +01:00
|
|
|
wasm-bindgen-cli_0_2_93,
|
2024-09-05 08:28:29 +02:00
|
|
|
binaryen,
|
|
|
|
zip,
|
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "webadmin";
|
2025-06-26 22:28:25 +00:00
|
|
|
version = "0.1.28";
|
2024-09-05 08:28:29 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stalwartlabs";
|
|
|
|
repo = "webadmin";
|
2024-12-18 23:04:53 +01:00
|
|
|
tag = "v${version}";
|
2025-06-26 22:28:25 +00:00
|
|
|
hash = "sha256-OgZ2qs84zVM2zNmBQSPnb9Uy4mahzNC81vbWM9wmrn4=";
|
2024-09-05 08:28:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
npmDeps = fetchNpmDeps {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-npm-deps";
|
|
|
|
hash = "sha256-na1HEueX8w7kuDp8LEtJ0nD1Yv39cyk6sEMpS1zix2s=";
|
|
|
|
};
|
|
|
|
|
2025-01-30 15:29:35 +01:00
|
|
|
useFetchCargoVendor = true;
|
2025-06-26 22:28:25 +00:00
|
|
|
cargoHash = "sha256-rcgeSdCGIRvpz2xZPw0I753+D3zm9AYbtuUdMSp2I94=";
|
2024-09-05 08:28:29 +02:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# Using local tailwindcss for compilation
|
|
|
|
substituteInPlace Trunk.toml --replace-fail "npx tailwindcss" "tailwindcss"
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
binaryen
|
|
|
|
llvmPackages.bintools-unwrapped
|
|
|
|
nodejs
|
|
|
|
npmHooks.npmConfigHook
|
2025-02-17 22:38:30 +01:00
|
|
|
tailwindcss_3
|
2024-11-03 14:34:20 +01:00
|
|
|
trunk
|
|
|
|
# needs to match with wasm-bindgen version in upstreams Cargo.lock
|
buildWasmBindgenCli,wasm-bindgen-cli-*: init
Exposing an overridable cargoHash parameter is problematic because it
will produce silently broken FODs if we change the hashing scheme,
which we are currently doing across the tree because Cargo 1.84.0 has
changed the output of fetchCargoTarball, meaning all hashes have been
invalidated. To avoid this happening in future, we are changing to
the fetchCargoVendor mechanism, which does not depend on
implementation details of Cargo.
The future-proof way to override a package with Cargo dependencies is
to pass a cargoDeps object. This is more verbose, and requires the
caller to have access to the src object for the package. To
compensate for this, I've introduced a buildWasmBindgenCli function
that is nicer to use than wasm-bindgen-cli.overrideAttrs, and I've
also introduced versioned attributes for wasm-bindgen-cli versions
currently in use in Nixpkgs, so that each package that wants to use a
particular version doesn't have to duplicate the src and cargoDeps
definitions for that version.
The unversioned "wasm-bindgen-cli" attribute is demoted to an alias,
with a view to its eventual removal.
2025-01-28 11:24:22 +01:00
|
|
|
wasm-bindgen-cli_0_2_93
|
|
|
|
|
2024-09-05 08:28:29 +02:00
|
|
|
zip
|
|
|
|
];
|
|
|
|
|
|
|
|
NODE_PATH = "$npmDeps";
|
|
|
|
|
|
|
|
buildPhase = ''
|
2024-11-03 14:34:20 +01:00
|
|
|
trunk build --offline --frozen --release
|
2024-09-05 08:28:29 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cd dist
|
|
|
|
mkdir -p $out
|
|
|
|
zip -r $out/webadmin.zip *
|
|
|
|
'';
|
|
|
|
|
2024-10-06 21:57:32 +02:00
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
};
|
|
|
|
|
2024-12-18 23:04:53 +01:00
|
|
|
meta = {
|
2024-09-05 08:28:29 +02:00
|
|
|
description = "Secure & modern all-in-one mail server Stalwart (webadmin module)";
|
|
|
|
homepage = "https://github.com/stalwartlabs/webadmin";
|
2024-12-18 23:04:53 +01:00
|
|
|
changelog = "https://github.com/stalwartlabs/webadmin/blob/${src.tag}/CHANGELOG.md";
|
|
|
|
license = lib.licenses.agpl3Only;
|
|
|
|
maintainers = with lib.maintainers; [ onny ];
|
2024-09-05 08:28:29 +02:00
|
|
|
};
|
|
|
|
}
|