Skip to content

Commit

Permalink
chore(nix): Build all derivations by default
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Sep 12, 2023
1 parent a71d19b commit 2f74e13
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
nix build -L .#wasm
mkdir -p ./.packages/noir_wasm
cp -r ./result/* ./.packages/noir_wasm/
cp -r ./result/noir_wasm/ ./.packages/noir_wasm/
echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: Upload `noir_wasm` artifact
Expand All @@ -67,7 +67,7 @@ jobs:
run: |
nix build -L .#noirc_abi_wasm
mkdir -p ./.packages/noirc_abi_wasm
cp -r ./result/* ./.packages/noirc_abi_wasm/
cp -r ./result/noirc_abi_wasm/ ./.packages/noirc_abi_wasm/
echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: Upload `noirc_abi_wasm` artifact
Expand Down
12 changes: 7 additions & 5 deletions compiler/wasm/installPhase.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/usr/bin/env bash
export self_path=$(dirname "$(readlink -f "$0")")

mkdir -p $out
export out_path=$out/noir_wasm

mkdir -p $out_path

cp ${self_path}/README.md ${self_path}/pkg/
cp ${self_path}/package.json ${self_path}/pkg/
cp -r ${self_path}/pkg/* $out/
cp -r ${self_path}/pkg/* $out_path/

echo "" >> $out/README.md
echo "## Tracking" >> $out/README.md
echo "Built from [noir-lang/noir@$GIT_COMMIT](https://github.com/noir-lang/noir/tree/$GIT_COMMIT)" >> $out/README.md
echo "" >> $out_path/README.md
echo "## Tracking" >> $out_path/README.md
echo "Built from [noir-lang/noir@$GIT_COMMIT](https://github.com/noir-lang/noir/tree/$GIT_COMMIT)" >> $out_path/README.md

# Cleanup temporary pkg directory
rm -r $self_path/pkg
2 changes: 1 addition & 1 deletion compiler/wasm/test/shared.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { initialiseResolver } from "@noir-lang/noir-source-resolver";
import { compile } from "../result/";
import { compile } from "../result/noir_wasm";

export const noirSourcePath = "../../noir-script/src/main.nr";
export const nargoArtifactPath =
Expand Down
6 changes: 4 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,15 @@
inherit GIT_COMMIT GIT_DIRTY;

cargoArtifacts = native-cargo-artifacts;
doCheck = true;
});
};

packages = {
default = nargo;
# Nix flakes cannot build more than one derivation in one command (see https://github.com/NixOS/nix/issues/5591)
# so we use `symlinkJoin` to build everything as our default package.
default = pkgs.symlinkJoin { name = "noir"; paths = [ nargo noir_wasm noirc_abi_wasm ]; };

# We also export individual packages to enable `nix build .#nargo -L`, etc.
inherit nargo;
inherit noir_wasm;
inherit noirc_abi_wasm;
Expand Down
12 changes: 7 additions & 5 deletions tooling/noirc_abi_wasm/installPhase.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/usr/bin/env bash
export self_path=$(dirname "$(readlink -f "$0")")

mkdir -p $out
export out_path=$out/noirc_abi_wasm

mkdir -p $out_path

cp ${self_path}/README.md ${self_path}/pkg/
cp ${self_path}/package.json ${self_path}/pkg/
cp -r ${self_path}/pkg/* $out/
cp -r ${self_path}/pkg/* $out_path

echo "" >> $out/README.md
echo "## Tracking" >> $out/README.md
echo "Built from [noir-lang/noir@$GIT_COMMIT](https://github.com/noir-lang/noir/tree/$GIT_COMMIT)" >> $out/README.md
echo "" >> $out_path/README.md
echo "## Tracking" >> $out_path/README.md
echo "Built from [noir-lang/noir@$GIT_COMMIT](https://github.com/noir-lang/noir/tree/$GIT_COMMIT)" >> $out_path/README.md

# Cleanup temporary pkg directory
rm -r $self_path/pkg
4 changes: 2 additions & 2 deletions tooling/noirc_abi_wasm/test/node/abi_encode.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from "chai";
import { abiEncode, abiDecode, WitnessMap } from "../../../../result/";
import { abiEncode, abiDecode, WitnessMap } from "../../../../result/noirc_abi_wasm";
import { DecodedInputs } from "../types";

it("recovers original inputs when abi encoding and decoding", async () => {
Expand All @@ -16,4 +16,4 @@ it("recovers original inputs when abi encoding and decoding", async () => {
BigInt(inputs.bar[1])
);
expect(decoded_inputs.return_value).to.be.null;
});
});

0 comments on commit 2f74e13

Please sign in to comment.