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