Skip to content

Commit

Permalink
fixup! fixup! wip
Browse files Browse the repository at this point in the history
  • Loading branch information
urbas committed Mar 22, 2024
1 parent 6c74895 commit b4f6bed
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
use flake
ls -t .direnv | grep -P '^flake-profile-.*-link$' | tail --lines=+5 | xargs --no-run-if-empty -I{} rm "$(direnv_layout_dir)/{}"
nix profile wipe-history --profile "$(direnv_layout_dir)/flake-profile" --older-than 14d
47 changes: 40 additions & 7 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,49 @@ Your editor should pick up the Rust toolchain as specified in

Install the [direnv vscode extension](https://github.com/direnv/direnv-vscode).

# Building & Testing
# Build, Test, and Iterate

The typical Rust way:
In the first shell you can continuously build `nixjs-rt` (the Nix JavaScript run-time library):

```bash
cargo build
cargo test
cd nixjs-rt
npm ci
npm run build-watch
```

In the second shell continuously test `nixjs-rt`:

```bash
cd nixjs-rt
npm run test-watch
```

In the third shell continuously check and test `rix`:

```bash
cargo-watch -x clippy -x test
```

# Run `rix`

# Examples of how to run rix in debug mode
First build nixjs-rt:

```bash
cd nixjs-rt
npm ci
npm run build-watch
```

Now run `rix` in debug mode:

```bash
cargo run -- --help
cargo run -- eval --expr '1 + 1'
```

## Updating dependencies

Update the `nix` tool, the `nixrt` library, `rustup`, and dependencies used in
integration tests:
Update tools like `rustup`, `npm`, and other dependencies:

```bash
nix flake update
Expand All @@ -65,6 +91,13 @@ Update Rust dependencies:
cargo update
```

Update JavaScript dependencies:

```bash
cd nixjs-rt
npm update
```

# Troubleshooting

## Getting a cargo error after an update
Expand Down
2 changes: 1 addition & 1 deletion flake.lock

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

13 changes: 10 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,30 @@
in
forSupportedSystems ({ pkgs, system, ... }:
let
buildInputs = with pkgs; [
rix-deps = with pkgs; [
busybox-sandbox-shell
coreutils
cargo-watch
nix
nixjs-rt.packages.${system}.default
nixpkgs-fmt
rustup
];

nixjs-rt-deps = with pkgs; [
nodejs
parallel
prefetch-npm-deps
];

in
{
packages.${system} = { inherit nixjs-rt pkgs; };
devShells.${system}.default = pkgs.stdenv.mkDerivation {
name = "rix";
inherit buildInputs;
buildInputs = rix-deps ++ nixjs-rt-deps;
shellHook = ''
export RIX_NIXRT_JS_MODULE=nixjs-rt/dist/lib/node_modules/nixjs-rt/dist/lib.mjs
export RIX_NIXRT_JS_MODULE=nixjs-rt/dist/lib.mjs
export RUSTFLAGS=-Dwarnings
'';
};
Expand Down
3 changes: 0 additions & 3 deletions nixjs-rt/.envrc

This file was deleted.

26 changes: 0 additions & 26 deletions nixjs-rt/CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
# First-time dev env set up

## Shell

1. Install the nix package manager:
https://nixos.org/manual/nix/stable/installation/installation.html

2. Install direnv: https://direnv.net/

Once you enter this directory in your shell, the NodeJS tooling should be
automatically set up. You can verify this with:

```bash
# This should match the version specified in `rust-toolchain.toml`
npm --version
```

## Editor

You must follow the "Shell" instructions above to make sure the `.direnv`
folder is populated. After that all the needed tooling will be in the `PATH`.

### VSCode

Install the [direnv vscode extension](https://github.com/direnv/direnv-vscode).

# Building & Testing

```bash
Expand Down
26 changes: 0 additions & 26 deletions nixjs-rt/flake.lock

This file was deleted.

34 changes: 0 additions & 34 deletions nixjs-rt/flake.nix

This file was deleted.

4 changes: 2 additions & 2 deletions nixjs-rt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "dist/lib.mjs",
"scripts": {
"build": "tsup ./src/lib.ts --format esm --sourcemap",
"build-watch": "npm run build --watch",
"build-watch": "tsup ./src/lib.ts --format esm --sourcemap --watch",
"fmt": "prettier --write .",
"fmt-check": "prettier --check .",
"test": "jest --color",
Expand All @@ -32,4 +32,4 @@
"files": [
"dist/**"
]
}
}

0 comments on commit b4f6bed

Please sign in to comment.