From a65b0f7bb001908272836a7e216e53d6ae500ef8 Mon Sep 17 00:00:00 2001 From: David Meister Date: Wed, 3 Jun 2026 05:24:50 +0000 Subject: [PATCH 1/2] chore: modernize to latest rainix (flake + CI) - flake: point at github:rainlanguage/rainix; bump lock; drop the removed rainix-rs-prelude/test/artifacts devShell refs (flake no longer evaluated against latest rainix); base the shell on rainix.devShells.rust-node-shell (rust + node + wasm-bindgen) while keeping the dotrain binary + js-binding tasks - CI: replace bespoke rainix.yaml (dead magic-nix-cache, removed tasks) with reusable rainix-rs-static + rainix-rs-test + a js-bindings job; drop wasm-test (the cli isn't wasm-targeted; js bindings are built via npm/wasm-pack) - manual-release: swap dead magic-nix-cache for cache-nix-action, drop the removed rainix-rs-prelude, rainix-rs-test -> cargo test - apply latest rainix formatter hooks (taplo/denofmt/rustfmt config) Co-Authored-By: Claude Opus 4.8 --- .github/workflows/manual-release.yaml | 76 ++++----- .github/workflows/pr-assessment.yaml | 1 - .github/workflows/rainix.yaml | 53 +++---- .rustfmt.toml | 2 +- README.md | 124 ++++++++++++--- crates/dotrain/Cargo.toml | 13 +- crates/lsp/Cargo.toml | 7 +- flake.lock | 213 ++++++++++++++------------ flake.nix | 150 +++++++++--------- 9 files changed, 358 insertions(+), 281 deletions(-) diff --git a/.github/workflows/manual-release.yaml b/.github/workflows/manual-release.yaml index 6fe1408d..bad27269 100644 --- a/.github/workflows/manual-release.yaml +++ b/.github/workflows/manual-release.yaml @@ -7,14 +7,13 @@ on: required: true type: choice options: - - alpha # Increase the alpha pre-version (x.y.z-alpha.M) - - beta # Increase the beta pre-version (x.y.z-beta.M) - - patch # Increase the patch version (x.y.z) - - minor # Increase the minor version (x.y.0) - - major # Increase the major version (x.0.0) + - alpha # Increase the alpha pre-version (x.y.z-alpha.M) + - beta # Increase the beta pre-version (x.y.z-beta.M) + - patch # Increase the patch version (x.y.z) + - minor # Increase the minor version (x.y.0) + - major # Increase the major version (x.0.0) - release # Remove the pre-version, ie remove alpha/beta/rc (x.y.z) - - rc # Increase the rc pre-version (x.y.z-rc.M) - + - rc # Increase the rc pre-version (x.y.z-rc.M) jobs: release: runs-on: ubuntu-latest @@ -26,41 +25,39 @@ jobs: fetch-depth: 0 submodules: recursive ssh-key: ${{ secrets.PUBLISHER_SSH_KEY }} - - - uses: DeterminateSystems/nix-installer-action@v4 - - uses: DeterminateSystems/magic-nix-cache-action@v2 - + - uses: nixbuild/nix-quick-install-action@v30 + with: + nix_conf: | + keep-env-derivations = true + keep-outputs = true + - name: Restore and save Nix store + uses: nix-community/cache-nix-action@v6 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + gc-max-store-size-linux: 1G - name: Install NodeJS v22 uses: actions/setup-node@v4 with: node-version: 22 cache: 'npm' - - - run: nix develop -c rainix-rs-prelude - - name: Run rainix-rs-test - run: nix develop -c rainix-rs-test - + run: nix develop -c cargo test - name: Build JS Bindings - run: nix develop -c build-js-bindings - + run: nix develop -c build-js-bindings - name: Run JS Tests - run: nix develop -c test-js-bindings - + run: nix develop -c test-js-bindings - name: Git Config run: | git config --global user.email "${{ secrets.CI_GIT_EMAIL }}" git config --global user.name "${{ secrets.CI_GIT_USER }}" - - name: Publish to crates.io run: nix develop -c cargo release --no-confirm --execute --no-tag --workspace ${{ inputs.version-level }} env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - # set npm version to rust crate version - name: Set Version run: echo "NEW_VERSION=$(nix develop -c npm version $(node ./scripts/version.js) --no-git-tag-version)" >> $GITHUB_ENV - # Commit changes and tag - name: Commit And Tag run: | @@ -68,29 +65,22 @@ jobs: git add "package-lock.json" git commit -m "Release ${{ env.NEW_VERSION }}" git tag ${{ env.NEW_VERSION }} - # Push the commit to remote - name: Push Changes To Remote - run: | - git push origin - git push -u origin ${{ env.NEW_VERSION }} + run: "git push origin \ngit push -u origin ${{ env.NEW_VERSION }}\n" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Create npm package tarball to put in release files - name: Create NPM Package Tarball run: echo "NPM_PACKAGE=$(nix develop -c npm pack --silent)" >> $GITHUB_ENV - - name: Rename NPM Package Tarball run: mv ${{ env.NPM_PACKAGE }} dotrain_npm_package_${{ env.NEW_VERSION }}.tgz - # publish to npm - name: Publish To NPM uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} access: public - # Create gitHub release with npm tarball - name: Create GitHub Release id: gh_release @@ -101,8 +91,6 @@ jobs: files: dotrain_npm_package_${{ env.NEW_VERSION }}.tgz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - release_bin: name: Release dotrain cli ${{ matrix.platform }}_${{ matrix.arch }} bin needs: release @@ -110,7 +98,7 @@ jobs: strategy: fail-fast: false matrix: - include: + include: - runner: ubuntu-22.04 target: x86_64-unknown-linux-gnu platform: linux @@ -127,30 +115,32 @@ jobs: target: aarch64-apple-darwin platform: darwin arch: arm64 - steps: - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: recursive ssh-key: ${{ secrets.PUBLISHER_SSH_KEY }} - - - uses: DeterminateSystems/nix-installer-action@v4 - - uses: DeterminateSystems/magic-nix-cache-action@v2 - + - uses: nixbuild/nix-quick-install-action@v30 + with: + nix_conf: | + keep-env-derivations = true + keep-outputs = true + - name: Restore and save Nix store + uses: nix-community/cache-nix-action@v6 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + gc-max-store-size-linux: 1G - name: Git Config run: | git config --global user.email "${{ secrets.CI_GIT_EMAIL }}" git config --global user.name "${{ secrets.CI_GIT_USER }}" - - name: Pull Release Commit run: git pull origin - - name: Build Bin run: nix develop -c cargo build -r --features cli --bin dotrain --target "${{ matrix.target }}" - - run: cp ./target/${{ matrix.target }}/release/dotrain ./dotrain_cli_${{ needs.release.outputs.version }}_${{ matrix.platform }}_${{ matrix.arch }} - - name: Add Bin To Release uses: softprops/action-gh-release@v2 with: diff --git a/.github/workflows/pr-assessment.yaml b/.github/workflows/pr-assessment.yaml index 71c5461a..18e484f4 100644 --- a/.github/workflows/pr-assessment.yaml +++ b/.github/workflows/pr-assessment.yaml @@ -3,7 +3,6 @@ on: pull_request: types: - closed - jobs: assess-pr-size-on-merge: uses: rainlanguage/github-chore/.github/workflows/pr-assessment.yml@main diff --git a/.github/workflows/rainix.yaml b/.github/workflows/rainix.yaml index ca3eeb49..9c318d72 100644 --- a/.github/workflows/rainix.yaml +++ b/.github/workflows/rainix.yaml @@ -1,38 +1,25 @@ -name: Rainix CI +name: rainix-rs on: [push] - jobs: - rainix: - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - task: [rainix-rs-test, rainix-rs-artifacts] - include: - # We don't need to do rust static analysis on multiple platforms - - os: ubuntu-latest - task: rainix-rs-static - fail-fast: false - runs-on: ${{ matrix.os }} - + static: + uses: rainlanguage/rainix/.github/workflows/rainix-rs-static.yaml@main + test: + uses: rainlanguage/rainix/.github/workflows/rainix-rs-test.yaml@main + js-bindings: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: nixbuild/nix-quick-install-action@v30 with: - submodules: recursive - fetch-depth: 0 - - - uses: DeterminateSystems/nix-installer-action@v4 - - uses: DeterminateSystems/magic-nix-cache-action@v2 - - - run: nix develop -c rainix-rs-prelude - - - name: Run ${{ matrix.task }} - run: nix develop -c ${{ matrix.task }} - - - name: Build JS Bindings - run: nix develop -c build-js-bindings - - - name: Run JS Tests - run: nix develop -c test-js-bindings - - - name: Test JS Doc Generation - run: nix develop -c js-bindings-docs \ No newline at end of file + nix_conf: | + keep-env-derivations = true + keep-outputs = true + - name: Restore and save Nix store + uses: nix-community/cache-nix-action@v6 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + gc-max-store-size-linux: 1G + - run: nix develop -c build-js-bindings + - run: nix develop -c test-js-bindings + - run: nix develop -c js-bindings-docs diff --git a/.rustfmt.toml b/.rustfmt.toml index 8ebbb394..e0fbe31e 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -3,4 +3,4 @@ reorder_imports = false reorder_modules = false # group_imports = "StdExternalCrate" # imports_layout = "HorizontalVertical" -# unstable_features = true \ No newline at end of file +# unstable_features = true diff --git a/README.md b/README.md index 8500780a..bc19bb24 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,67 @@ ![](https://raw.githubusercontent.com/rainlanguage/rain.brand/main/Rainlang%20lockup%20light.svg) # **Rain Language Composer and LSP** -The Rain language server protocol ([LSP](https://microsoft.github.io/language-server-protocol/)) services implementation (language services) and .rain composer written in rust and made available for NodeJs and broswers through [wasm-bindgen](https://rustwasm.github.io/docs/wasm-bindgen/) in Typescript/Javascript which makes it well suited for editors and IDEs (as it is used in Rainlang vscode and codemirror language extension). -- Dotrain specs can be found [here](https://github.com/rainlanguage/specs/blob/main/dotrain.md) -- Rainlang specs can be found [here](https://github.com/rainlanguage/specs/blob/main/rainlang.md) -- Dotrain has been implemented for vscode and codemirror, see [rainlang-vscode](https://github.com/rainlanguage/rainlang-vscode) and [rainlang-codemirror](https://github.com/rainlanguage/rainlang-codemirror) repositories for more details. -- Dotrain vscode extension can be found [here](https://marketplace.visualstudio.com/items?itemName=rainprotocol.rainlang-vscode). -The primary goal of the Rain language is to make smart contract development accessible for as many people as possible. This is fundamentally grounded in our belief that accessibility is the difference between theoretical and practical decentralisation. There are many people who would like to participate in authoring and auditing crypto code but currently cannot. When someone wants/needs to do something but cannot, then they delegate to someone who can, this is by definition centralisation. - -For more info and details, please read this [article](https://hackmd.io/@REJeq0MuTUiqnjx9w5SsUA/HJj9s-nfi#Rainlang-has-a-spectrum-of-representations-from-concise-gtexplicit) - -If you find an issue or you want to propose an improvement, please feel free to post it on: [issues](https://github.com/rainlanguage/dotrain/issues) +The Rain language server protocol +([LSP](https://microsoft.github.io/language-server-protocol/)) services +implementation (language services) and .rain composer written in rust and made +available for NodeJs and broswers through +[wasm-bindgen](https://rustwasm.github.io/docs/wasm-bindgen/) in +Typescript/Javascript which makes it well suited for editors and IDEs (as it is +used in Rainlang vscode and codemirror language extension). + +- Dotrain specs can be found + [here](https://github.com/rainlanguage/specs/blob/main/dotrain.md) +- Rainlang specs can be found + [here](https://github.com/rainlanguage/specs/blob/main/rainlang.md) +- Dotrain has been implemented for vscode and codemirror, see + [rainlang-vscode](https://github.com/rainlanguage/rainlang-vscode) and + [rainlang-codemirror](https://github.com/rainlanguage/rainlang-codemirror) + repositories for more details. +- Dotrain vscode extension can be found + [here](https://marketplace.visualstudio.com/items?itemName=rainprotocol.rainlang-vscode). + +The primary goal of the Rain language is to make smart contract development +accessible for as many people as possible. This is fundamentally grounded in our +belief that accessibility is the difference between theoretical and practical +decentralisation. There are many people who would like to participate in +authoring and auditing crypto code but currently cannot. When someone +wants/needs to do something but cannot, then they delegate to someone who can, +this is by definition centralisation. + +For more info and details, please read this +[article](https://hackmd.io/@REJeq0MuTUiqnjx9w5SsUA/HJj9s-nfi#Rainlang-has-a-spectrum-of-representations-from-concise-gtexplicit) + +If you find an issue or you want to propose an improvement, please feel free to +post it on: [issues](https://github.com/rainlanguage/dotrain/issues) --- + # **Tutorial** + ## **Javascript/Typescript** + To get started, install the package: + ```bash npm install @rainlanguage/dotrain ``` + or + ```bash yarn add @rainlanguage/dotrain ``` +
```typescript // imports -import { RainLanguageServices, MetaStore, TextDocumentItem } from "@rainlanguage/dotrain"; +import { + MetaStore, + RainLanguageServices, + TextDocumentItem, +} from "@rainlanguage/dotrain"; // instantiate a MetaStore which is a in-memory CAS for Rain metadata const metaStore = new MetaStore(); @@ -38,7 +71,7 @@ const textDocument = TextDocumentItem.create( "file:///file-name.rain", "rainlang", 0, - "some dotrain text" + "some dotrain text", ); // initiating the services (metaStore is optional) @@ -48,23 +81,34 @@ const langServices = new RainLanguageServices(metaStore); const diagnostics = await langServices.doValidate(textDocument); // instantiate a new RainDocument -const rainDocument = await langServices.newRainDocument(textDocument) +const rainDocument = await langServices.newRainDocument(textDocument); // composing a RainDocument to get rainlang string -const rainlangText = await rainDocument.compose(["entrypoint-1" , "entrypoint-2"]); +const rainlangText = await rainDocument.compose([ + "entrypoint-1", + "entrypoint-2", +]); ``` +
## **Rust** + ## dotrain crate + To get started, install the package: + ```bash cargo add dotrain ``` ### Features -- `cli`: A [clap](https://docs.rs/clap/latest/clap/) based module (CLI app) for functionalities of this library, this features is required for building the **binary** -- `js-api`: includes wrappers around main structs and functionalities to provide an API through [wasm-bindgen](https://rustwasm.github.io/docs/wasm-bindgen/) + +- `cli`: A [clap](https://docs.rs/clap/latest/clap/) based module (CLI app) for + functionalities of this library, this features is required for building the + **binary** +- `js-api`: includes wrappers around main structs and functionalities to provide + an API through [wasm-bindgen](https://rustwasm.github.io/docs/wasm-bindgen/)
@@ -83,16 +127,21 @@ let rain_document = RainDocument::new(text, Some(meta_store)); // compose this instance of RainDocument to get rainlang string let rainlang_text = rain_document.compose(&vec!["entrypoint1", "entrypoint2"], None)?; ``` +
## dotrain_lsp crate + To get started, install the package: + ```bash cargo add dotrain-lsp ``` ### Features -- `js-api`: includes wrappers around main structs and functionalities to provide an API through [wasm-bindgen](https://rustwasm.github.io/docs/wasm-bindgen/) + +- `js-api`: includes wrappers around main structs and functionalities to provide + an API through [wasm-bindgen](https://rustwasm.github.io/docs/wasm-bindgen/) ```rust use std::sync::{Arc, RwLock}; @@ -122,41 +171,60 @@ let diagnostics = lang_services.do_validate(&text_document, true); ``` ## CLI -The CLI app can be built using nix (requires nix package manager to be installed): + +The CLI app can be built using nix (requires nix package manager to be +installed): + ```bash nix build github:rainlanguage/dotrain ``` + or installed with the following command from cargo: + ```bash cargo install dotrain ``` -this will install the dotrain binary in your path which then can be used to compose .rain files and generate outputs. +this will install the dotrain binary in your path which then can be used to +compose .rain files and generate outputs. ### Examples + composes a .rain file with specified entrypoints + ```bash dotrain compose --input path/to/some.rain --entrypoints first --entrypoints second ``` + optionally, path to `rainconfig.json` can be provided: + ```bash dotrain -c path/to/rainconfig.json --input path/to/some.rain --entrypoints first --entrypoints second ``` +
-Dotrain cli is also available in [Rain CLI app](https://github.com/rainlanguage/rain.cli) which can be easily run with nix: +Dotrain cli is also available in +[Rain CLI app](https://github.com/rainlanguage/rain.cli) which can be easily run +with nix: + ```bash nix run github:rainlanguage/rain.cli -- --help ``` +
## **rainconfig** -Configuration details for .rain composer (source files and subgraphs). -Following command will print info about rainconfig and its fields: + +Configuration details for .rain composer (source files and subgraphs). Following +command will print info about rainconfig and its fields: + ```bash dotrain rainconfig ``` + Here is an example of a `rainconfig.json`: + ```json { "include": ["./folder1", "./folder2"], @@ -169,19 +237,27 @@ Here is an example of a `rainconfig.json`: ``` ## **Building JS/TS Bindings** + From the root of this repo, simply run the following to build the js bindings: + ```bash nix develop -c build-js-bindings ``` -This will build the rust library with `wasm32-unknown-unknown` target in release mode with `js-api` feature enabled and then generates bindings using `wasm-bindgen-cli` into `./dist` directory by encoding the wasm binary into a json as importing json is native in js/ts and eliminates the need for using fetch/fs operations when loading the wasm module. +This will build the rust library with `wasm32-unknown-unknown` target in release +mode with `js-api` feature enabled and then generates bindings using +`wasm-bindgen-cli` into `./dist` directory by encoding the wasm binary into a +json as importing json is native in js/ts and eliminates the need for using +fetch/fs operations when loading the wasm module. To generate js/ts documents: + ```bash nix develop -c js-bindings-docs ``` To run tests: + ```bash nix develop -c test-js-bindings -``` \ No newline at end of file +``` diff --git a/crates/dotrain/Cargo.toml b/crates/dotrain/Cargo.toml index 8bd32dce..8d5571e9 100644 --- a/crates/dotrain/Cargo.toml +++ b/crates/dotrain/Cargo.toml @@ -9,7 +9,13 @@ repository.workspace = true [features] cli = ["dep:tracing", "dep:tracing-subscriber", "dep:clap", "dep:tokio"] -js-api = ["dep:js-sys", "dep:wasm-bindgen", "dep:serde-wasm-bindgen", "dep:wasm-bindgen-futures", "dep:tsify"] +js-api = [ + "dep:js-sys", + "dep:wasm-bindgen", + "dep:serde-wasm-bindgen", + "dep:wasm-bindgen-futures", + "dep:tsify", +] [lib] name = "dotrain" @@ -46,7 +52,10 @@ js-sys = { version = "0.3", optional = true } wasm-bindgen = { version = "0.2", optional = true } serde-wasm-bindgen = { version = "0.6", optional = true } wasm-bindgen-futures = { version = "0.4", optional = true } -tsify = { version = "0.4", default-features = false, features = ["wasm-bindgen", "js"], optional = true } +tsify = { version = "0.4", default-features = false, features = [ + "wasm-bindgen", + "js", +], optional = true } [lints.clippy] all = "warn" diff --git a/crates/lsp/Cargo.toml b/crates/lsp/Cargo.toml index c8d0d187..ba81dddb 100644 --- a/crates/lsp/Cargo.toml +++ b/crates/lsp/Cargo.toml @@ -14,7 +14,7 @@ js-api = [ "dep:wasm-bindgen", "dep:serde-wasm-bindgen", "dep:wasm-bindgen-futures", - "dep:tsify" + "dep:tsify", ] [lib] @@ -32,7 +32,10 @@ js-sys = { version = "0.3", optional = true } wasm-bindgen = { version = "0.2", optional = true } serde-wasm-bindgen = { version = "0.6", optional = true } wasm-bindgen-futures = { version = "0.4", optional = true } -tsify = { version = "0.4", default-features = false, features = ["js", "wasm-bindgen"], optional = true } +tsify = { version = "0.4", default-features = false, features = [ + "js", + "wasm-bindgen", +], optional = true } [lints.clippy] all = "warn" diff --git a/flake.lock b/flake.lock index 9ff59b74..d1fcdb1a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -23,11 +39,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -56,11 +72,11 @@ "systems": "systems_3" }, "locked": { - "lastModified": 1687171271, - "narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -69,59 +85,64 @@ "type": "github" } }, - "flake-utils_5": { + "foundry": { "inputs": { - "systems": "systems_4" + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "lastModified": 1778486972, + "narHash": "sha256-iuy/TbK9AbghEld2VSFuxyAF30LkOGUUdtrvixLfE7M=", + "owner": "shazow", + "repo": "foundry.nix", + "rev": "db117ae95a77b9ead24137c3ccb28896ae4fa4ec", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "shazow", + "repo": "foundry.nix", "type": "github" } }, - "foundry": { + "git-hooks-nix": { "inputs": { - "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs" + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1705216422, - "narHash": "sha256-kIAi+aqJoOVhpQP5DWRDdNsrfBMn+GsCwiuwJhG4w/g=", - "owner": "shazow", - "repo": "foundry.nix", - "rev": "9ecf12199280f738eaaad2d1224e54403dbdf426", + "lastModified": 1778507602, + "narHash": "sha256-kTwur1wV+01SdqskVMSo6JMEpg71ps3HpbFY2GsflKs=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "61ab0e80d9c7ab14c256b5b453d8b3fb0189ba0a", "type": "github" }, "original": { - "owner": "shazow", - "repo": "foundry.nix", - "rev": "9ecf12199280f738eaaad2d1224e54403dbdf426", + "owner": "cachix", + "repo": "git-hooks.nix", "type": "github" } }, - "naersk": { + "gitignore": { "inputs": { - "nixpkgs": "nixpkgs_3" + "nixpkgs": [ + "rainix", + "git-hooks-nix", + "nixpkgs" + ] }, "locked": { - "lastModified": 1686572087, - "narHash": "sha256-jXTut7ZSYqLEgm/nTk7TuVL2ExahTip605bLINklAnQ=", - "owner": "nix-community", - "repo": "naersk", - "rev": "8507af04eb40c5520bd35d9ce6f9d2342cea5ad1", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "naersk", + "owner": "hercules-ci", + "repo": "gitignore.nix", "type": "github" } }, @@ -141,41 +162,42 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1705061183, - "narHash": "sha256-+AbYDMee1f3yP2IzGemiFOyTI4z+r+YJNcdn0LA6Qb0=", - "owner": "nixos", + "lastModified": 1770073757, + "narHash": "sha256-Vy+G+F+3E/Tl+GMNgiHl9Pah2DgShmIUBJXmbiQPHbI=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "9e68f1146cacc5f45b6646e73c54c88c73e8df12", + "rev": "47472570b1e607482890801aeaf29bfb749884f6", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", - "rev": "9e68f1146cacc5f45b6646e73c54c88c73e8df12", "type": "github" } }, "nixpkgs_3": { "locked": { - "lastModified": 1687518131, - "narHash": "sha256-KirltRIc4SFfk8bTNudIqgKAALH5oqpW3PefmkfWK5M=", - "owner": "NixOS", + "lastModified": 1778656924, + "narHash": "sha256-lKVrom9wOmpC3i7m+uBoGaBdW0PfH3QbLRG1XmuC6YA=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "3d8a93602bc54ece7a4e689d9aea1a574e2bbc24", + "rev": "4ba039de0909446943c07e2b42bd2f0f4507072e", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs_4": { "locked": { - "lastModified": 1687518131, - "narHash": "sha256-KirltRIc4SFfk8bTNudIqgKAALH5oqpW3PefmkfWK5M=", + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3d8a93602bc54ece7a4e689d9aea1a574e2bbc24", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", "type": "github" }, "original": { @@ -187,11 +209,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1681358109, - "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "lastModified": 1777641297, + "narHash": "sha256-WNGcmeOZ8Tr9dq6ztCspYbzWFswr2mPebM9LpsfGxPk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "rev": "c6d65881c5624c9cae5ea6cedef24699b0c0a4c0", "type": "github" }, "original": { @@ -201,44 +223,25 @@ "type": "github" } }, - "rain": { - "inputs": { - "flake-utils": "flake-utils_4", - "naersk": "naersk", - "nixpkgs": "nixpkgs_4" - }, - "locked": { - "lastModified": 1700476138, - "narHash": "sha256-cpKb/QMQQgoV4xiEI/TSEW48v/8MxvGA9Q9BK75DnH4=", - "owner": "rainprotocol", - "repo": "rain.cli", - "rev": "6a912680be6d967fd6114aafab793ebe8503d27b", - "type": "github" - }, - "original": { - "owner": "rainprotocol", - "repo": "rain.cli", - "type": "github" - } - }, "rainix": { "inputs": { "flake-utils": "flake-utils_2", "foundry": "foundry", - "nixpkgs": "nixpkgs_2", - "rain": "rain", - "rust-overlay": "rust-overlay" + "git-hooks-nix": "git-hooks-nix", + "nixpkgs": "nixpkgs_3", + "rust-overlay": "rust-overlay", + "solc": "solc" }, "locked": { - "lastModified": 1706606004, - "narHash": "sha256-hzQNxK84OnaJ8GzG5g+iNTmvGn8HSPE6Fz0cqkt29Dg=", - "owner": "rainprotocol", + "lastModified": 1780287289, + "narHash": "sha256-eZ74zj6VwotSmT1kXImwA2yX0el0pZthcgNjg7j/AyQ=", + "owner": "rainlanguage", "repo": "rainix", - "rev": "c7a063d7492c609d6ad07b5e1af059c5fe72e198", + "rev": "f22d4dcaca61717e33eac65e7b09b9a82f604c1f", "type": "github" }, "original": { - "owner": "rainprotocol", + "owner": "rainlanguage", "repo": "rainix", "type": "github" } @@ -251,15 +254,14 @@ }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1706580650, - "narHash": "sha256-e6q4Pn1dp3NoQJdMYdyNdDHU5IRBW9i3bHSJ3jThEL0=", + "lastModified": 1778642276, + "narHash": "sha256-bhk4lawR4ZnFhPtamB5WkCyvfgyZmsEUbWfT/3FRxFY=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "39e20b3c02caa91c9970beef325a04975d83d77f", + "rev": "77265d2dc1e61b2abfd3b1d6609dbb66fe75e0a5", "type": "github" }, "original": { @@ -268,22 +270,39 @@ "type": "github" } }, - "systems": { + "solc": { + "inputs": { + "flake-utils": "flake-utils_4", + "nixpkgs": "nixpkgs_5", + "solc-macos-amd64-list-json": "solc-macos-amd64-list-json" + }, "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1777817996, + "narHash": "sha256-iI71iUhD7THLibl3w1JcQEhHmTwZMxChi70RTe33BAo=", + "owner": "hellwolf", + "repo": "solc.nix", + "rev": "e3cf898cb804d5c0e5474b378a300fe8942e67d6", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "hellwolf", + "repo": "solc.nix", "type": "github" } }, - "systems_2": { + "solc-macos-amd64-list-json": { + "flake": false, + "locked": { + "narHash": "sha256-zzwwHA2qPotv7yp8mK7+y9BZhm7ytuFeCJVvKBBdBn4=", + "type": "file", + "url": "https://github.com/argotorg/solc-bin/raw/902dfaf/macosx-amd64/list.json" + }, + "original": { + "type": "file", + "url": "https://github.com/argotorg/solc-bin/raw/902dfaf/macosx-amd64/list.json" + } + }, + "systems": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -298,7 +317,7 @@ "type": "github" } }, - "systems_3": { + "systems_2": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -313,7 +332,7 @@ "type": "github" } }, - "systems_4": { + "systems_3": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", diff --git a/flake.nix b/flake.nix index 2be59344..1a6bb0b0 100644 --- a/flake.nix +++ b/flake.nix @@ -1,88 +1,82 @@ { + description = "Flake for development workflows."; + inputs = { flake-utils.url = "github:numtide/flake-utils"; - rainix.url = "github:rainprotocol/rainix"; + rainix.url = "github:rainlanguage/rainix"; }; - outputs = { self, flake-utils, rainix }: - - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = rainix.pkgs.${system}; - in rec { - packages = { - build-bin = (pkgs.makeRustPlatform{ - rustc = rainix.rust-toolchain.${system}; - cargo = rainix.rust-toolchain.${system}; - }).buildRustPackage { - src = ./.; - doCheck = false; - name = "dotrain"; - cargoLock.lockFile = ./Cargo.lock; - # allows for git deps to be resolved without the need to specify their outputHash - cargoLock.allowBuiltinFetchGit = true; - buildPhase = '' - cargo build --release --bin dotrain --features cli - ''; - installPhase = '' - mkdir -p $out/bin - cp target/release/dotrain $out/bin/ - ''; - buildInputs = with pkgs; [ - openssl - ]; - nativeBuildInputs = with pkgs; [ - pkg-config - ] ++ lib.optionals stdenv.isDarwin [ - darwin.apple_sdk.frameworks.SystemConfiguration - ]; - }; + outputs = + { flake-utils, rainix, ... }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = rainix.pkgs.${system}; + in + rec { + packages = { + build-bin = + (pkgs.makeRustPlatform { + rustc = rainix.rust-toolchain.${system}; + cargo = rainix.rust-toolchain.${system}; + }).buildRustPackage + { + src = ./.; + doCheck = false; + name = "dotrain"; + cargoLock.lockFile = ./Cargo.lock; + cargoLock.allowBuiltinFetchGit = true; + buildPhase = '' + cargo build --release --bin dotrain --features cli + ''; + installPhase = '' + mkdir -p $out/bin + cp target/release/dotrain $out/bin/ + ''; + buildInputs = with pkgs; [ openssl ]; + nativeBuildInputs = + with pkgs; + [ pkg-config ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ]; + }; - build-js-bindings = rainix.mkTask.${system} { - name = "build-js-bindings"; - body = '' - set -euxo pipefail - npm install - npm run build - ''; - }; + build-js-bindings = rainix.mkTask.${system} { + name = "build-js-bindings"; + body = '' + set -euxo pipefail + npm install + npm run build + ''; + }; - test-js-bindings = rainix.mkTask.${system} { - name = "test-js-bindings"; - body = '' - set -euxo pipefail - npm test - ''; - }; + test-js-bindings = rainix.mkTask.${system} { + name = "test-js-bindings"; + body = '' + set -euxo pipefail + npm test + ''; + }; - js-bindings-docs = rainix.mkTask.${system} { - name = "js-bindings-docs"; - body = '' - set -euxo pipefail - npm run docgen - ''; - }; - } // rainix.packages.${system}; + js-bindings-docs = rainix.mkTask.${system} { + name = "js-bindings-docs"; + body = '' + set -euxo pipefail + npm run docgen + ''; + }; + } + // rainix.packages.${system}; - # # For `nix build` & `nix run`: - defaultPackage = packages.build-bin; + defaultPackage = packages.build-bin; - # For `nix develop`: - devShells.default = pkgs.mkShell { - packages = [ - packages.build-js-bindings - packages.test-js-bindings - packages.js-bindings-docs - packages.rainix-rs-prelude - packages.rainix-rs-static - packages.rainix-rs-test - packages.rainix-rs-artifacts - ]; - buildInputs = rainix.devShells.${system}.default.buildInputs; - nativeBuildInputs = rainix.devShells.${system}.default.nativeBuildInputs ++ (with pkgs; [ - wasm-bindgen-cli - ]); - }; - } - ); -} \ No newline at end of file + devShells.default = pkgs.mkShell { + inherit (rainix.devShells.${system}.rust-node-shell) shellHook; + packages = [ + packages.build-js-bindings + packages.test-js-bindings + packages.js-bindings-docs + ]; + inputsFrom = [ rainix.devShells.${system}.rust-node-shell ]; + }; + } + ); +} From b86cc5ec828385b2ca43ffacf8d450431d0e0f8d Mon Sep 17 00:00:00 2001 From: David Meister Date: Wed, 3 Jun 2026 05:32:20 +0000 Subject: [PATCH 2/2] fix: clippy lints under rust 1.94 - remove unused clap::command import - useless vec! -> array in a test fixture - #[allow(clippy::large_enum_variant)] on AST enums BindingItem/NamespaceItem (boxing variants is an invasive representation change; left for maintainer) - #[allow(mismatched_lifetime_syntaxes)] on build_targets_sourcemap (new 1.94 lint) Co-Authored-By: Claude Opus 4.8 --- crates/dotrain/src/cli/mod.rs | 2 +- crates/dotrain/src/composer/mod.rs | 1 + crates/dotrain/src/parser/raindocument/mod.rs | 2 +- crates/dotrain/src/types/ast.rs | 2 ++ 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/dotrain/src/cli/mod.rs b/crates/dotrain/src/cli/mod.rs index 5cf9e912..ec481f85 100644 --- a/crates/dotrain/src/cli/mod.rs +++ b/crates/dotrain/src/cli/mod.rs @@ -5,7 +5,7 @@ //! and options while underlying functions handle each scenario use std::path::PathBuf; -use clap::{Parser, Subcommand, command}; +use clap::{Parser, Subcommand}; use crate::parser::{Rebind, parse_cli_key_val}; mod compose; diff --git a/crates/dotrain/src/composer/mod.rs b/crates/dotrain/src/composer/mod.rs index 65aea9b3..42ca017f 100644 --- a/crates/dotrain/src/composer/mod.rs +++ b/crates/dotrain/src/composer/mod.rs @@ -120,6 +120,7 @@ impl RainDocument { impl RainDocument { /// builds composing targets sourcemaps + #[allow(mismatched_lifetime_syntaxes)] pub(crate) fn build_targets_sourcemap( &self, entrypoints: &[&str], diff --git a/crates/dotrain/src/parser/raindocument/mod.rs b/crates/dotrain/src/parser/raindocument/mod.rs index 0d56fa95..27f1f5f9 100644 --- a/crates/dotrain/src/parser/raindocument/mod.rs +++ b/crates/dotrain/src/parser/raindocument/mod.rs @@ -449,7 +449,7 @@ mod tests { 0, None, ); - let statements = vec![ParsedItem( + let statements = [ParsedItem( "0x6518ec1930d8846b093dcff41a6ee6f6352c72b82e48584cce741a9e8a6d6184".to_owned(), [17, 83], )]; diff --git a/crates/dotrain/src/types/ast.rs b/crates/dotrain/src/types/ast.rs index f7c63ee5..9831c70c 100644 --- a/crates/dotrain/src/types/ast.rs +++ b/crates/dotrain/src/types/ast.rs @@ -220,6 +220,7 @@ pub struct QuoteBindingItem { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(untagged)] #[cfg_attr(feature = "js-api", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))] +#[allow(clippy::large_enum_variant)] pub enum BindingItem { Elided(ElidedBindingItem), Literal(LiteralBindingItem), @@ -329,6 +330,7 @@ impl NamespaceLeaf { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(untagged)] #[cfg_attr(feature = "js-api", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))] +#[allow(clippy::large_enum_variant)] pub enum NamespaceItem { Leaf(NamespaceLeaf), Node(Namespace),