-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: workflows to macos, rust-toolchain file
- Loading branch information
Showing
5 changed files
with
110 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ env: | |
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +1,106 @@ | ||
{ pkgs ? import <nixpkgs> { } | ||
, fenix, | ||
}: | ||
let | ||
{ | ||
pkgs ? import <nixpkgs> {}, | ||
fenix, | ||
}: let | ||
lib = pkgs.lib; | ||
getLibFolder = pkg: "${pkg}/lib"; | ||
|
||
toolchain = with fenix.packages.${pkgs.system}; | ||
combine [ | ||
stable.toolchain | ||
targets.wasm32-unknown-unknown.stable.rust-std | ||
]; | ||
|
||
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"; | ||
} | ||
]; | ||
} | ||
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"; | ||
} | ||
]; | ||
} | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[toolchain] | ||
channel = "stable" | ||
components = ["rust-src", "rustfmt", "rust-analyzer", "rust-std", "clippy"] | ||
targets = ["wasm32-unknown-unknown"] | ||
profile = "complete" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters