Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
nixpkgs.url = "nixpkgs/nixos-unstable";
};

outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ rust-overlay.overlays.default ];
pkgs = import nixpkgs { inherit system overlays; };
outputs = {
self,
nixpkgs,
flake-utils,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [rust-overlay.overlays.default];
pkgs = import nixpkgs {inherit system overlays;};
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
inputs = [
rust
Expand All @@ -29,10 +34,8 @@
pkgs.clang
pkgs.corepack_20
pkgs.nodejs_20
pkgs.just
];
in
{
in {
packages.default = pkgs.rustPlatform.buildRustPackage {
name = "bhwi";
src = ./.;
Expand All @@ -44,7 +47,6 @@
nativeBuildInputs = inputs;
};


devShells.default = pkgs.mkShell {
packages = inputs;
shellHook = ''
Expand All @@ -54,6 +56,18 @@
export CFLAGS_wasm32_unknown_unknown="-I ${pkgs.llvmPackages.libclang.lib}/lib/clang/21.1.8/include/"
'';
};

apps.website = {
type = "app";
program = toString (pkgs.writeShellScript "run-website" ''
export PATH="${pkgs.lib.makeBinPath inputs}:$PATH"
export LIBCLANG_PATH=${pkgs.libclang.lib}/lib/
export CC_wasm32_unknown_unknown=${pkgs.llvmPackages.clang-unwrapped}/bin/clang
export CFLAGS_wasm32_unknown_unknown="-I ${pkgs.llvmPackages.libclang.lib}/lib/clang/21.1.8/include/"
wasm-pack build bhwi-wasm --out-dir ../website/pkg --target web
cd website && npm install && npm run dev
'');
};
}
);
}
8 changes: 0 additions & 8 deletions justfile

This file was deleted.

49 changes: 7 additions & 42 deletions website/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,15 @@
# React + TypeScript + Vite
# BHWI Website

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Demo web application for [BHWI](../README.md) using WebAssembly.

Currently, two official plugins are available:
Supports connecting to Coldcard, Jade, and Ledger devices via WebHID/WebSerial.

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
Requires a Chromium-based browser (Chrome, Edge, etc.).

## Expanding the ESLint configuration
## Running

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
From the root of the repository:

- Configure the top-level `parserOptions` property like this:

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
nix run .#website
```
3 changes: 1 addition & 2 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>BHWI</title>
</head>
<body>
<div id="root"></div>
Expand Down
Loading
Loading