|
1 | 1 | { |
2 | | - pkgs ? import <nixpkgs> {}, |
| 2 | + pkgs ? import <nixpkgs> { }, |
3 | 3 | fenix, |
4 | | -}: let |
| 4 | +}: |
| 5 | +let |
5 | 6 | lib = pkgs.lib; |
6 | 7 | getLibFolder = pkg: "${pkg}/lib"; |
7 | 8 |
|
8 | 9 | toolchain = fenix.packages.${pkgs.system}.fromToolchainFile { |
9 | 10 | file = ./rust-toolchain.toml; |
10 | | - sha256 = "sha256-s1RPtyvDGJaX/BisLT+ifVfuhDT1nZkZ1NcK8sbwELM="; |
| 11 | + sha256 = "sha256-zC8E38iDVJ1oPIzCqTk/Ujo9+9kx9dXq7wAwPMpkpg0="; |
11 | 12 | }; |
12 | 13 |
|
13 | 14 | manifest = (pkgs.lib.importTOML ./Cargo.toml).package; |
14 | 15 | in |
15 | | - pkgs.rustPlatform.buildRustPackage { |
16 | | - pname = "rust-website"; |
17 | | - version = manifest.version; |
18 | | - cargoLock.lockFile = ./Cargo.lock; |
19 | | - src = pkgs.lib.cleanSource ./.; |
20 | | - |
21 | | - nativeBuildInputs = with pkgs; [ |
22 | | - # LLVM & GCC |
23 | | - gcc |
24 | | - cmake |
25 | | - gnumake |
26 | | - pkg-config |
27 | | - llvmPackages.llvm |
28 | | - llvmPackages.clang |
29 | | - llvmPackages.bintools |
30 | | - |
31 | | - # Tailwindcss |
32 | | - tailwindcss |
33 | | - |
34 | | - # Rust |
35 | | - rustc |
36 | | - cargo |
37 | | - trunk |
38 | | - clippy |
39 | | - libiconv |
40 | | - toolchain |
41 | | - wasm-pack |
42 | | - pkg-config |
43 | | - rust-analyzer |
44 | | - wasm-bindgen-cli |
45 | | - ]; |
46 | | - |
47 | | - buildInputs = with pkgs; [ |
48 | | - openssl |
49 | | - ]; |
50 | | - |
51 | | - buildPhase = '' |
52 | | - # Build the css |
53 | | - tailwindcss -i ./style/input.css -o ./style/output.css |
54 | | -
|
55 | | - # Wasm-bindgen nigga can't build without storing cache at HOME |
56 | | - export HOME="$(pwd)/home" |
57 | | - mkdir -p $HOME |
58 | | -
|
59 | | - # Test wasm |
60 | | - wasm-bindgen -V |
61 | | -
|
62 | | - # Build wasm webiste |
63 | | - trunk build --release --public-url=/ |
64 | | - ''; |
65 | | - |
66 | | - installPhase = '' |
67 | | - # Create out directory |
68 | | - mkdir -p $out/www |
69 | | -
|
70 | | - # Move all finished content |
71 | | - mv ./dist/* $out/www |
72 | | - ''; |
73 | | - |
74 | | - # If you wanna get thorny |
75 | | - # RUST_BACKTRACE = 1; |
76 | | - NIX_LDFLAGS = "-L${(getLibFolder pkgs.libiconv)}"; |
77 | | - LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ |
78 | | - pkgs.gcc |
79 | | - pkgs.libiconv |
80 | | - pkgs.llvmPackages.llvm |
81 | | - ]; |
82 | | - CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld"; |
83 | | - |
84 | | - meta = with lib; { |
85 | | - homepage = manifest.package.homepage; |
86 | | - description = "Website of Rust Uzbekistan community"; |
87 | | - license = with lib.licenses; [gpl3Only]; |
88 | | - |
89 | | - platforms = with platforms; linux ++ darwin; |
90 | | - |
91 | | - maintainers = [ |
92 | | - { |
93 | | - name = "Sokhibjon Orzikulov"; |
94 | | - email = "sakhib@orzklv.uz"; |
95 | | - handle = "orzklv"; |
96 | | - github = "orzklv"; |
97 | | - githubId = 54666588; |
98 | | - keys = [ |
99 | | - { |
100 | | - fingerprint = "00D2 7BC6 8707 0683 FBB9 137C 3C35 D3AF 0DA1 D6A8"; |
101 | | - } |
102 | | - ]; |
103 | | - } |
104 | | - ]; |
105 | | - }; |
106 | | - } |
| 16 | +pkgs.rustPlatform.buildRustPackage { |
| 17 | + pname = "rust-website"; |
| 18 | + version = manifest.version; |
| 19 | + cargoLock.lockFile = ./Cargo.lock; |
| 20 | + src = pkgs.lib.cleanSource ./.; |
| 21 | + |
| 22 | + nativeBuildInputs = with pkgs; [ |
| 23 | + # WASM Target specifics |
| 24 | + pkg-config |
| 25 | + llvmPackages.bintools |
| 26 | + wasm-pack |
| 27 | + wasm-bindgen-cli |
| 28 | + trunk |
| 29 | + |
| 30 | + # Rest |
| 31 | + tailwindcss |
| 32 | + toolchain |
| 33 | + ]; |
| 34 | + |
| 35 | + buildInputs = with pkgs; [ |
| 36 | + openssl |
| 37 | + ]; |
| 38 | + |
| 39 | + buildPhase = '' |
| 40 | + # Build the css |
| 41 | + tailwindcss -i ./style/input.css -o ./style/output.css |
| 42 | +
|
| 43 | + # Wasm-bindgen nigga can't build without storing cache at HOME |
| 44 | + export HOME="$(pwd)/home" |
| 45 | + mkdir -p $HOME |
| 46 | +
|
| 47 | + # Test wasm |
| 48 | + wasm-bindgen -V |
| 49 | +
|
| 50 | + # Build wasm webiste |
| 51 | + trunk build --release --public-url=/ |
| 52 | + ''; |
| 53 | + |
| 54 | + installPhase = '' |
| 55 | + # Create out directory |
| 56 | + mkdir -p $out/www |
| 57 | +
|
| 58 | + # Move all finished content |
| 59 | + mv ./dist/* $out/www |
| 60 | + ''; |
| 61 | + |
| 62 | + CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld"; |
| 63 | + |
| 64 | + meta = with lib; { |
| 65 | + homepage = manifest.package.homepage; |
| 66 | + description = "Website of Rust Uzbekistan community"; |
| 67 | + license = with lib.licenses; [ gpl3Only ]; |
| 68 | + platforms = with platforms; linux ++ darwin; |
| 69 | + maintainers = with lib.maintainers; [orzklv]; |
| 70 | + }; |
| 71 | +} |
0 commit comments