Skip to content
Open
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake .
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,7 @@ packages/react-devtools-extensions/.tempUserDataDir
out

# Cursor files
.cursorrules
.cursorrules

# direnv local cache (committed: .envrc)
.direnv
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,36 @@ An Electron application with React and TypeScript

## Project Setup

### Install
### Using Nix (Recommended for NixOS users)

With [direnv](https://direnv.net/) and [nix-direnv](https://github.com/nix-community/nix-direnv):

```bash
direnv allow # one-time, auto-loads the flake on every cd
npm install
npm run dev
```

Without direnv:

```bash
nix develop
npm install
npm run dev
```

The flake provides a NixOS-patched Electron binary via `ELECTRON_EXEC_PATH`,
so no `LD_LIBRARY_PATH` exports are needed.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

### Manual Setup

#### Install

```bash
$ npm install
```

### Development
#### Development

```bash
$ npm run dev
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs =
{ nixpkgs, ... }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = [ pkgs.nodejs pkgs.electron ];
# Use the NixOS-patched Electron instead of the pre-built npm binary.
# pkgs.electron has correct RPATHs baked in, supports native Wayland
# (ozone/Chromium), and needs no LD_LIBRARY_PATH workarounds.
# electron-vite reads ELECTRON_EXEC_PATH before falling back to
# node_modules/electron/dist/electron.
ELECTRON_EXEC_PATH = "${pkgs.electron}/bin/electron";
};
});
};
}