Skip to content

Commit

Permalink
chore: remove last traces of nix (#4679)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

We have a lot of tech debt from a partial removal of nix. As it's no
longer in CI we cannot guarantee that the nix installation method works
so we should just remove it so we can clean up the code.

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [x] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
TomAFrench committed Apr 1, 2024
1 parent 301d4be commit 656665e
Show file tree
Hide file tree
Showing 31 changed files with 61 additions and 750 deletions.
20 changes: 0 additions & 20 deletions .envrc

This file was deleted.

1 change: 1 addition & 0 deletions .github/scripts/acvm_js-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
set -eu

.github/scripts/wasm-bindgen-install.sh
.github/scripts/wasm-opt-install.sh
yarn workspace @noir-lang/acvm_js build
1 change: 1 addition & 0 deletions .github/scripts/noir-wasm-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
set -eu

.github/scripts/wasm-pack-install.sh
.github/scripts/wasm-opt-install.sh
yarn workspace @noir-lang/types build
yarn workspace @noir-lang/noir_wasm build
1 change: 1 addition & 0 deletions .github/scripts/noirc-abi-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
set -eu

.github/scripts/wasm-bindgen-install.sh
.github/scripts/wasm-opt-install.sh
yarn workspace @noir-lang/noirc_abi build
2 changes: 1 addition & 1 deletion .github/scripts/wasm-opt-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ cd $(dirname "$0")

./cargo-binstall-install.sh

cargo-binstall wasm-opt --version 0.116.0 -y
cargo-binstall wasm-opt --version 0.116.0 -y --force
17 changes: 6 additions & 11 deletions .github/workflows/test-js-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ jobs:
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Install wasm-opt
run: ./.github/scripts/wasm-opt-install.sh

- name: Build noirc_abi
run: ./.github/scripts/noirc-abi-build.sh

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm/outputs/out/noirc_abi_wasm
path: |
./tooling/noirc_abi_wasm/nodejs
./tooling/noirc_abi_wasm/web
retention-days: 10


Expand All @@ -100,9 +99,6 @@ jobs:
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Install wasm-opt
run: ./.github/scripts/wasm-opt-install.sh

- name: Build noir_js_types
run: yarn workspace @noir-lang/types build

Expand Down Expand Up @@ -138,17 +134,16 @@ jobs:
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Install wasm-opt
run: ./.github/scripts/wasm-opt-install.sh

- name: Build acvm_js
run: ./.github/scripts/acvm_js-build.sh

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: acvm-js
path: ./acvm-repo/acvm_js/outputs/out/acvm_js
path: |
./acvm-repo/acvm_js/nodejs
./acvm-repo/acvm_js/web
retention-days: 3

test-acvm_js-node:
Expand Down
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ pkg/
# Noir.js
tooling/noir_js/lib

# Nix stuff
**/outputs
result
.envrc.local
.direnv/

# Nargo output
*.proof
*.acir
Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"mkhl.direnv",
"jnoortheen.nix-ide",
"rust-lang.rust-analyzer",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
Expand Down
11 changes: 0 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
"direnv.restart.automatic": true,
"redhat.telemetry.enabled": false,
"yaml.recommendations.show": false,
"nix.serverPath": "nil",
"nix.enableLanguageServer": true,
"nix.serverSettings": {
"nil": {
"formatting": {
"command": [
"nixpkgs-fmt"
]
}
}
},
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "${workspaceRoot}/.github/workflows/*.yml"
},
Expand Down
20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,6 @@ Concretely the following items are on the road map:

This crate's minimum supported rustc version is 1.73.0.

## Working on this project

This project uses [Nix](https://nixos.org/) and [direnv](https://direnv.net/) to streamline the development experience. Please follow [our guidelines](https://noir-lang.org/docs/getting_started/installation/other_install_methods#option-3-compile-from-source) to setup your environment for working on the project.

### Building against a different local/remote version of Barretenberg

If you are working on this project and want a different version of Barretenberg (instead of the version this project is pinned against), you'll want to replace the lockfile version with your version. This can be done by running:

```sh
nix flake lock --override-input barretenberg /absolute/path/to/your/barretenberg
```

You can also point at a fork and/or branch on GitHub using:

```sh
nix flake lock --override-input barretenberg github:username/barretenberg/branch_name
```

__Note:__ You don't want to commit the updated lockfile, as it will fail in CI!

## License

Noir is free and open source. It is distributed under a dual license. (MIT/APACHE)
Expand Down
39 changes: 19 additions & 20 deletions acvm-repo/acvm_js/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ function require_command {
exit 1
fi
}
function check_installed {
if ! command -v "$1" >/dev/null 2>&1; then
echo "$1 is not installed. Please install it." >&2
return 1
fi
return 0
}
function run_or_fail {
"$@"
local status=$?
Expand All @@ -25,23 +18,29 @@ function run_or_fail {
require_command jq
require_command cargo
require_command wasm-bindgen
check_installed wasm-opt
require_command wasm-opt

self_path=$(dirname "$(readlink -f "$0")")
export pname=$(cargo read-manifest | jq -r '.name')
export CARGO_TARGET_DIR=$self_path/target
pname=$(cargo read-manifest | jq -r '.name')

rm -rf $self_path/outputs >/dev/null 2>&1
rm -rf $self_path/result >/dev/null 2>&1
NODE_DIR=$self_path/nodejs
BROWSER_DIR=$self_path/web

if [ -n "$out" ]; then
echo "Will install package to $out (defined outside installPhase.sh script)"
else
export out="$self_path/outputs/out"
echo "Will install package to $out"
# Clear out the existing build artifacts as these aren't automatically removed by wasm-bindgen.
if [ -d ./pkg/ ]; then
rm -r $NODE_DIR
rm -r $BROWSER_DIR
fi

run_or_fail $self_path/buildPhaseCargoCommand.sh
run_or_fail $self_path/installPhase.sh
TARGET=wasm32-unknown-unknown
WASM_BINARY=${self_path}/../../target/$TARGET/release/${pname}.wasm

NODE_WASM=${NODE_DIR}/${pname}_bg.wasm
BROWSER_WASM=${BROWSER_DIR}/${pname}_bg.wasm

ln -s $out $self_path/result
# Build the new wasm package
run_or_fail cargo build --lib --release --target $TARGET --package ${pname}
run_or_fail wasm-bindgen $WASM_BINARY --out-dir $NODE_DIR --typescript --target nodejs
run_or_fail wasm-bindgen $WASM_BINARY --out-dir $BROWSER_DIR --typescript --target web
run_or_fail wasm-opt $NODE_WASM -o $NODE_WASM -O
run_or_fail wasm-opt $BROWSER_WASM -o $BROWSER_WASM -O
42 changes: 0 additions & 42 deletions acvm-repo/acvm_js/buildPhaseCargoCommand.sh

This file was deleted.

10 changes: 0 additions & 10 deletions acvm-repo/acvm_js/installPhase.sh

This file was deleted.

4 changes: 1 addition & 3 deletions acvm-repo/acvm_js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
"nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
"clean": "chmod u+w web nodejs || true && rm -rf web nodejs",
"build:nix": "nix build -L .#acvm_js",
"install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/acvm_js/nodejs ./ && cp -rL ./result/acvm_js/web ./"
"clean": "chmod u+w web nodejs || true && rm -rf web nodejs"
},
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
Expand Down
3 changes: 1 addition & 2 deletions compiler/noirc_driver/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ const GIT_COMMIT: &&str = &"GIT_COMMIT";
use std::path::Path;

fn main() {
// Only use build_data if the environment variable isn't set
// The environment variable is always set when working via Nix
// Only use build_data if the environment variable isn't set.
if std::env::var(GIT_COMMIT).is_err() {
build_data::set_GIT_COMMIT();
build_data::set_GIT_DIRTY();
Expand Down
14 changes: 0 additions & 14 deletions compiler/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,3 @@ for (const path of files) {
}
const myCompiledCode = await compile(fm);
```

## Building from source

Outside of the [noir repo](https://github.com/noir-lang/noir), this package can be built using the command below:

```bash
nix build -L github:noir-lang/noir/master#noir_wasm
```

If you are within the noir repo and would like to build local changes, you can use:

```bash
nix build -L #noir_wasm
```
13 changes: 0 additions & 13 deletions default.nix

This file was deleted.

Loading

0 comments on commit 656665e

Please sign in to comment.