nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 binaryen,
3 cargo-leptos,
4 fetchFromGitHub,
5 lib,
6 rustc,
7 makeWrapper,
8 nix-update-script,
9 nodePackages,
10 rustPlatform,
11 tailwindcss_3,
12 wasm-bindgen-cli_0_2_100,
13}:
14let
15 tailwindcss = tailwindcss_3.overrideAttrs (_prev: {
16 plugins = [
17 nodePackages."@tailwindcss/aspect-ratio"
18 nodePackages."@tailwindcss/forms"
19 nodePackages."@tailwindcss/line-clamp"
20 nodePackages."@tailwindcss/typography"
21 ];
22 });
23in
24rustPlatform.buildRustPackage rec {
25 pname = "idmail";
26 version = "1.0.1";
27
28 src = fetchFromGitHub {
29 owner = "oddlama";
30 repo = "idmail";
31 tag = "v${version}";
32 hash = "sha256-9rl2UG8DeWd8hVh3N+dqyV5gO0LErok+kZ1vQZnVAe8=";
33 };
34
35 cargoHash = "sha256-UcS2gAoa2fzPu6hh8I5sXSHHbAmzsecT44Ju2CVsK0Q=";
36
37 env = {
38 RUSTC_BOOTSTRAP = 1;
39 RUSTFLAGS = "--cfg=web_sys_unstable_apis";
40 };
41
42 nativeBuildInputs = [
43 wasm-bindgen-cli_0_2_100
44 binaryen
45 cargo-leptos
46 rustc.llvmPackages.lld
47 tailwindcss
48 makeWrapper
49 ];
50 buildPhase = ''
51 runHook preBuild
52
53 cargo leptos build --release
54
55 runHook postBuild
56 '';
57
58 installPhase = ''
59 runHook preInstall
60
61 mkdir -p $out/bin $out/share
62 cp target/release/idmail $out/bin
63 cp -r target/site $out/share
64 wrapProgram $out/bin/idmail --set LEPTOS_SITE_ROOT $out/share/site
65
66 runHook postInstall
67 '';
68
69 passthru.updateScript = nix-update-script { };
70
71 meta = {
72 description = "Email alias and account management interface for self-hosted mailservers";
73 homepage = "https://github.com/oddlama/idmail";
74 changelog = "https://github.com/oddlama/idmail/releases/tag/v${version}";
75 license = lib.licenses.mit;
76 maintainers = with lib.maintainers; [
77 oddlama
78 patrickdag
79 ];
80 mainProgram = "idmail";
81 };
82}