-
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.
- Loading branch information
Showing
8 changed files
with
353 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
# Output website | ||
/dist/ | ||
/target/ | ||
|
||
# Rust build directory | ||
/target | ||
|
||
# Tailwindcss output | ||
/style/output.css | ||
|
||
# Nodejs | ||
node_modules | ||
pnpm-lock.yaml | ||
pnpm-lock.yaml | ||
|
||
# Nix | ||
/result |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ 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 | ||
]; | ||
|
||
|
||
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 | ||
libressl | ||
]; | ||
|
||
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 | ||
# Create the dist folder | ||
cargo build --release | ||
# Build wasm webiste | ||
trunk build --release | ||
''; | ||
|
||
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"; | ||
} | ||
]; | ||
} | ||
]; | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,46 @@ | ||
{ | ||
description = "Website for Rust Uzbekistan community"; | ||
|
||
inputs = { | ||
# Too old to work with most libraries | ||
# nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; | ||
|
||
# Perfect! | ||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||
|
||
# The flake-utils library | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
# Additional helper Rust toolchain management | ||
fenix = { | ||
url = "github:nix-community/fenix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = { | ||
nixpkgs, | ||
fenix, | ||
flake-utils, | ||
... | ||
}: | ||
flake-utils.lib.eachDefaultSystem | ||
( | ||
system: let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
in { | ||
# Nix script formatter | ||
formatter = pkgs.alejandra; | ||
|
||
# Development environment | ||
devShells.default = import ./shell.nix {inherit pkgs fenix;}; | ||
|
||
# Output package | ||
packages.default = pkgs.callPackage ./. {inherit pkgs fenix;}; | ||
} | ||
) | ||
// { | ||
# Overlay module | ||
# nixosModules.xinux.bot = import ./module.nix self; | ||
}; | ||
} |
Oops, something went wrong.