summaryrefslogtreecommitdiff
path: root/packages/stalwart/webadmin.nix
diff options
context:
space:
mode:
Diffstat (limited to 'packages/stalwart/webadmin.nix')
-rw-r--r--packages/stalwart/webadmin.nix77
1 files changed, 77 insertions, 0 deletions
diff --git a/packages/stalwart/webadmin.nix b/packages/stalwart/webadmin.nix
new file mode 100644
index 0000000..0035bda
--- /dev/null
+++ b/packages/stalwart/webadmin.nix
@@ -0,0 +1,77 @@
+{
+ lib,
+ rustPlatform,
+ stalwart,
+ fetchFromGitHub,
+ trunk,
+ tailwindcss_3,
+ fetchNpmDeps,
+ nix-update-script,
+ nodejs,
+ npmHooks,
+ llvmPackages,
+ wasm-bindgen-cli_0_2_93,
+ binaryen,
+ zip,
+}:
+
+rustPlatform.buildRustPackage (finalAttrs: {
+ pname = "webadmin";
+ version = "0.1.37";
+
+ src = fetchFromGitHub {
+ owner = "stalwartlabs";
+ repo = "webadmin";
+ tag = "v${finalAttrs.version}";
+ hash = "";
+ };
+
+ npmDeps = fetchNpmDeps {
+ name = "${finalAttrs.pname}-npm-deps";
+ hash = "";
+ };
+
+ cargoHash = "";
+
+ postPatch = ''
+ # Using local tailwindcss for compilation
+ substituteInPlace Trunk.toml --replace-fail "npx tailwindcss" "tailwindcss"
+ '';
+
+ nativeBuildInputs = [
+ binaryen
+ llvmPackages.bintools-unwrapped
+ nodejs
+ npmHooks.npmConfigHook
+ tailwindcss_3
+ trunk
+ # needs to match with wasm-bindgen version in upstreams Cargo.lock
+ wasm-bindgen-cli_0_2_93
+
+ zip
+ ];
+
+ env.NODE_PATH = "$npmDeps";
+
+ buildPhase = ''
+ trunk build --offline --frozen --release
+ '';
+
+ installPhase = ''
+ cd dist
+ mkdir -p $out
+ zip -r $out/webadmin.zip *
+ '';
+
+ passthru = {
+ updateScript = nix-update-script { };
+ };
+
+ meta = {
+ description = "Web administration module for the Stalwart server";
+ homepage = "https://github.com/stalwartlabs/webadmin";
+ changelog = "https://github.com/stalwartlabs/webadmin/blob/${finalAttrs.src.tag}/CHANGELOG.md";
+ license = lib.licenses.agpl3Only;
+ # inherit (stalwart.meta) maintainers;
+ };
+})