1
1
mirror of https://github.com/tweag/nickel.git synced 2024-10-06 16:18:08 +03:00
Commit Graph

102 Commits

Author SHA1 Message Date
Viktor Kleen
3d47bac01e
Static linking with nickel format (#1455)
* Enable `format` feature in the nix build and fix static linking

* Document static building

* Update flake.nix

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

* Enable `format` by default

* Remove `nickel-static` output on darwin

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-07-17 14:06:29 +00:00
Viktor Kleen
997e344f4f
Topiary integration as nickel format (#1371)
* Implement `nickel format` PoC as a topiary wrapper

Improve error reporting for `nickel format`

nix build with topiary

Use upstream topiary query export

* Pin wasm-bindgen version

* Disable `format` feature in nickelStatic for now

* Remove thiserror dependency and make tempfile optional

* Update Cargo.lock

* Disable `nickel format` by default
2023-07-13 10:43:51 +00:00
Yann Hamdaoui
21c8b849c5
Format benches as well using Topiary (#1423) 2023-06-30 15:50:04 +00:00
Yann Hamdaoui
f5f0ed5255
Various fixes to VSCode extension (#1413)
* Various updates to VSCode extension

Last fixes before publishing the VSCode extension on the VSCode market
place:
 - rename the parent containing directory from client-extension to vscode-extension
 - add a display name and a description
 - update the README, add links to non-Nix installation method
 - small fixes to the textmate Nickel grammar

* Update flake.nix after rename client-extension -> vscode-extension

* Improve the TextMate grammar, fix interpolation handling

* Fix highlighting in VSCode extension
2023-06-29 11:40:35 +00:00
Simon Žlender
a4fad2b935
Full vscode extension (#1405)
* Full vscode extension

* Update lsp/client-extension/syntaxes/nickel.tmLanguage.json

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
2023-06-28 09:24:39 +00:00
Yuriy Taraday
37ab9424d5
Upload docker image to GHCR in release workflow (#1347)
* Fix typo in release-artifacts workflow

* Enable cachix substituter in release-artifacts workflow

So that we don't rebuild everything during release.

* Upload docker image to GHCR in release workflow

Also add labels recognised by GHCR to the image.
2023-06-27 16:03:01 +00:00
Viktor Kleen
78e7a8814b
Rename and move workspace crates (#1399)
* Rename and move workspace crates

nickel-lang -> nickel-lang-cli in cli/
nickel-lang-lib -> nickel-lang-core in core/
nickel-lang-utilities -> nickel-lang-utils in utils/
nickel-repl -> nickel-repl in wasm-repl/

* Finish renaming in rust sources

* Update RELEASING.md

* Move to workspace dependencies

* Rename nickel-repl -> nickel-wasm-repl

* Update RELEASING.md

Co-authored-by: Taeer Bar-Yam <Radvendii@users.noreply.github.com>

* Address suggestions from code review

* Update HACKING.md

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

* Elaborate on the versioning scheme in RELEASING.md

---------

Co-authored-by: Taeer Bar-Yam <Radvendii@users.noreply.github.com>
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-06-26 16:58:40 +00:00
Yann Hamdaoui
7938c0bb69
Add topiary to pre-commit-hooks (#1391)
* Add Nickel formatting to pre-commit-hooks/CI

* Run topiary on examples

* Topiary formatter on stdlib

* Add exclude list for Nickel formatting

* Reformat internals.ncl after rebase
2023-06-22 09:41:50 +00:00
Viktor Kleen
3e03cc7909
Move the CLI into its own crate (#1351)
* Fetch the wasm-bindgen-cli version from Cargo.lock instead of Cargo.toml

* Move the Nickel CLI to a separate crate

* Fix snapshot tests

* Rename the nickel flake output to nickel-lang-cli for consistency

* Move the nickel-lang crate into a subdirectory

* Update documentation for the new crate split

* Tweak snapshot test instructions

* Use project_root instead of ad-hoc environment variables

* Remove the library from nickel-lang-cli for now

* Rename nickel-lang to nickel-lang-lib and nickel-lang-cli to nickel-lang

* Apply suggestions from code review

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

* Tweak documentation for nickel_lang_utilities::project_root

* Use MacOS 13 github runner because of https://github.com/cachix/install-nix-action/issues/183

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-06-16 16:34:13 +00:00
jneem
dc6804acd1
Adds a configurable tracing output instead of hardcoding stderr (#1338)
* Make the trace destination configurable

* Add a callback-oriented trace collector to the wasm repl

* Only call back on flush

* Fix clippy

* Silence trace output in pyckel.

This probably isn't the best thing, but it's probably still better than
polluting stderr in a library. Possibly a better solution is to
imitate the api of `subprocess.run`, but that requires breaking API
to return something other than a plain string.
2023-06-07 14:17:13 +00:00
Yann Hamdaoui
89a1382cfd
flake.lock: Update (#1201)
* flake.lock: Update

Flake lock file updates:

• Updated input 'crane':
    'github:ipetkov/crane/5291dd0aa7a52d607fc952763ef60714e4c881d4' (2023-03-07)
  → 'github:ipetkov/crane/35110cccf28823320f4fd697fcafcb5038683982' (2023-05-25)
• Updated input 'crane/flake-utils':
    'github:numtide/flake-utils/3db36a8b464d0c4532ba1c7dda728f4576d6d073' (2023-02-13)
  → 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'crane/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'crane/rust-overlay':
    'github:oxalica/rust-overlay/e53e8853aa7b0688bc270e9e6a681d22e01cf299' (2023-03-03)
  → 'github:oxalica/rust-overlay/d59c3fa0cba8336e115b376c2d9e91053aa59e56' (2023-05-03)
• Updated input 'flake-utils':
    'github:numtide/flake-utils/93a2b84fc4b70d9e089d029deacc3583435c2ed6' (2023-03-15)
  → 'github:numtide/flake-utils/a1720a10a6cfe8234c0e93907ffe81be440f4cef' (2023-05-31)
• Added input 'flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/ac718d02867a84b42522a0ece52d841188208f2c' (2023-03-15)
  → 'github:NixOS/nixpkgs/e635192892f5abbc2289eaac3a73cdb249abaefd' (2023-06-01)
• Updated input 'pre-commit-hooks':
    'github:cachix/pre-commit-hooks.nix/32b1dbedfd77892a6e375737ef04d8efba634e9e' (2023-03-16)
  → 'github:cachix/pre-commit-hooks.nix/ca2fdbf3edda2a38140184da6381d49f8206eaf4' (2023-05-29)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/7313c06ac334d6262ddfe30a38b3abc3da6bd565' (2023-03-18)
  → 'github:oxalica/rust-overlay/c535b4f3327910c96dcf21851bbdd074d0760290' (2023-06-03)
• Updated input 'topiary':
    'github:tweag/topiary/773159aa4c819b46c6d51ca9275e7366087eb3a0' (2023-04-26)
  → 'github:tweag/topiary/b2399161f60c1eb3404e487b4471ff76455d7a94' (2023-05-31)
• Updated input 'topiary/advisory-db':
    'github:rustsec/advisory-db/0888b44843e3c86db9fd56334c7f5261ea00dc19' (2023-03-15)
  → 'github:rustsec/advisory-db/0e97e6e71f0dd52b4b4e0ab3fa6e5e5dd72f852a' (2023-05-17)
• Updated input 'topiary/crane':
    'github:ipetkov/crane/5291dd0aa7a52d607fc952763ef60714e4c881d4' (2023-03-07)
  → 'github:ipetkov/crane/99de890b6ef4b4aab031582125b6056b792a4a30' (2023-05-19)
• Updated input 'topiary/crane/flake-utils':
    'github:numtide/flake-utils/3db36a8b464d0c4532ba1c7dda728f4576d6d073' (2023-02-13)
  → 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'topiary/crane/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'topiary/crane/rust-overlay':
    'github:oxalica/rust-overlay/e53e8853aa7b0688bc270e9e6a681d22e01cf299' (2023-03-03)
  → 'github:oxalica/rust-overlay/d59c3fa0cba8336e115b376c2d9e91053aa59e56' (2023-05-03)
• Updated input 'topiary/flake-utils':
    'github:numtide/flake-utils/93a2b84fc4b70d9e089d029deacc3583435c2ed6' (2023-03-15)
  → 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'topiary/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'topiary/nix-filter':
    'github:numtide/nix-filter/aa9ff6ce4a7f19af6415fb3721eaa513ea6c763c' (2023-03-06)
  → 'github:numtide/nix-filter/f529f42792ade8e32c4be274af6b6d60857fbee7' (2023-04-10)
• Updated input 'topiary/rust-overlay':
    'github:oxalica/rust-overlay/7313c06ac334d6262ddfe30a38b3abc3da6bd565' (2023-03-18)
  → 'github:oxalica/rust-overlay/a227d4571dd1f948138a40ea8b0d0c413eefb44b' (2023-05-23)
• Updated input 'topiary/rust-overlay/flake-utils':
    'github:numtide/flake-utils/c0e246b9b83f637f4681389ecabcb2681b4f3af0' (2022-08-07)
  → 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'topiary/rust-overlay/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'topiary/rust-overlay/nixpkgs':
    'github:NixOS/nixpkgs/14ccaaedd95a488dd7ae142757884d8e125b3363' (2022-10-09)
  → 'github:NixOS/nixpkgs/96ba1c52e54e74c3197f4d43026b3f3d92e83ff9' (2023-04-13)

* flake: Explicitly set wasm-pack cache dir (#1343)

It tries to create it in home directory that doesn't exist in sandbox
and build fails with this:

```
nickel-lang> ++ command cargo --version
nickel-lang> cargo 1.70.0 (ec8a8a0ca 2023-04-25)
nickel-lang> Error: Permission denied (os error 13)
nickel-lang> Caused by: Permission denied (os error 13)
```

Fix failure in #1201.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Yuriy Taraday <yuriy.taraday@tweag.io>
2023-06-07 09:41:49 +00:00
Viktor Kleen
495af70d07
Add flake output for static binaries on linux (#1322)
* Add flake output for static binaries on linux

* Use static nickel binaries for the docker image

* Use Entrypoint instead of Cmd for the docker image
2023-06-02 07:39:21 +00:00
Yann Hamdaoui
5cfa4e1831
Add cargo doc to flake checks (#1291)
* Add a flake check that `cargo doc` succeeds

* Fix cargo doc warnings for NLS

* Update RELEASING.md, remove manual doc build check
2023-04-28 08:32:29 +00:00
Viktor Kleen
ad7a683a91
Add a JSON documentation export option (#1209)
* Add a JSON documentation export option

* Expose JSON documentation in flake.nix

* Apply suggestions from code review

* Refactor freestanding functions in program::doc

* flake.nix: stdlibDoc -> stdlibMarkdown

* Introduce `ExportError::NoDocumentation`

* Enable documentation export to stdout

* Exclude internals from stdlibDoc in flake.nix

* Apply suggestions from code review

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

* Factor out input path filtering in snapshot tests

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-03-30 15:14:09 +00:00
Viktor Kleen
80b4a730ef
Add topiary to the default dev shell (#1207) 2023-03-28 14:02:30 +00:00
Viktor Kleen
920ab4008c Make clippy run on the entire workspace in CI 2023-02-28 16:55:55 +00:00
Yann Hamdaoui
abb8136c6d
Update output hash after update (wasm-bindgen-cli) 2023-02-20 16:17:00 +01:00
Lorenzo Manacorda
bd88092b7e flake: remove doCheck in benchmarks package
The default check phase has no side effects, so no need to disable it.

Cf. https://crane.dev/API.html#optional-attributes-11
2023-02-15 18:38:53 +01:00
Lorenzo Manacorda
f55e6f4f47 flake: clean up benchmarks invocation
Instead of overriding the buildPhase, we use a function argument with optional string appending.
2023-02-15 18:36:31 +01:00
Lorenzo Manacorda
7c9cb3846b flake: separate benchmark compilation and running
This allows compiling them often in CI (since it's fast), and
benchmarking less often.
2023-02-13 10:51:44 +01:00
Lorenzo Manacorda
4cdc71c642 ci: compile benchmarks via nix 2023-02-13 10:48:18 +01:00
Viktor Kleen
72a2754cce Make the Nickel LSP available in packages 2023-01-30 13:54:17 +00:00
francois-caddet
c2fa55b124 add --all-features to clippy
to check every parts of the source
2023-01-24 15:25:51 +01:00
Yann Hamdaoui
96d6c40c92
Remove double build of nickel-repl 2023-01-17 15:34:02 +01:00
Guillaume Desforges
6220703738 Apply suggestions from code review
Co-authored-by: Julien Debon <julien.debon@protonmail.com>
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
2023-01-16 16:38:24 +01:00
Guillaume Desforges
2976aee8c4 wip nix build 2023-01-16 16:38:24 +01:00
Guillaume Desforges
6e122939ad init Python bindings 2023-01-16 16:38:24 +01:00
matthew healy
bff8451f7e
Add snapshot testing infrastructure (#1034)
* Update regex crate to 1.7

We want to use the regex filtering feature of the insta snapshot testing
library. That has a dependency on a newer version of the regex crate
than Nickel currently does, so this commit updates the Nickel version to
a more recent compatible version.

* Add insta dependency

* Add cargo-insta to dev shells

* Add snapshot testing infrastructure

This uses the insta crate to implement snapshot testing.

Each snapshot test invokes the debug nickel binary with some set of
arguments, then captures the output & compares it to a file in the
snapshots directory

* Add nixpkgs-fmt to dev shell

This makes it possible to easily reformat flake.nix from within a dev
shell.

* Update HACKING.md

* Add snapshot testing README
2023-01-09 11:32:40 +01:00
Yann Hamdaoui
9b1318a208
Merge pull request #1014 from tweag/devops/wasm-to-crane
Build the WASM crate using `crane` and get rid of import-from-cargo
2022-12-26 20:40:53 +01:00
Yann Hamdaoui
619fe9ae33
Apply suggestions from code review 2022-12-25 12:17:39 +01:00
Yann Hamdaoui
7283165af0
Get rid of import-cargo: use crane for WASM build 2022-12-24 13:17:24 +01:00
Solene Rapenne
f706fee8c7 make nix run to find nickel binary 2022-12-23 10:57:27 +01:00
matthew healy
dbf782d411
Re-enable rustfmt pre-commit check (#972) 2022-12-06 10:50:37 +01:00
Julien Debon
62128a642f
Migrate Nix build from import-cargo to Crane (#963)
* Refactor flake inputs because it's been annoying me for weeks now
* Fix a long-standing bug in mk_uniftype.rs
Can be reproduced by running `cargo test --workspace`.
This was never noticed before in CI because the `--workspace` flag is not passed.
This will be addressed in the Crane migration
* Remove utilities/Cargo.lock
This is probably a fragment of the past, back when Nickel did not use Cargo workspaces.
* Fix Clippy issues in tests
* Rustfmt and clippy are no longer in preview
* Update README with Nix flake shell command
* Migrate from import-cargo to crane for Nickel
Nickel WASM build is intentionally left intact and still uses the old
import-cargo.
This is because the change is already massive, and in practice the WASM build
relies more on `wasm-pack` than Cargo (even though under the hood, `wasm-pack`
uses Cargo).

If Crane looks good, both for DX and for CI, we will consider migrating Nickel
WASM to Crane too in a future PR.
* Remove support for Rust nightly channel
* Only Nix check for Rust `stable` channel
* Fix deprecated Nix build documentation commands
* Fix completion test
2022-12-05 17:28:45 +01:00
Julien Debon
2c9654b972 Add the VS Code extension to CI 2022-11-24 09:57:53 +01:00
Julien Debon
79521f5c6e Fix VS Code extension Nix build
* Fix VS Code extension Nix build
  * Regenerate the 3 `node2nix` files with a more recent `node2nix`
  * Add the missing `vsce` dependency
  * Pass the `--development` flag to `node2nix` to correctly include dev
    dependencies like `typescript` or `vsce`
* Use the verbose form of `tsc` parameters in `package.json`
* Add `node2nix`, `markdownlint` and `nodejs` to the dev shell
* Add a `README.md` to the VS Code extension directory

Close https://github.com/tweag/nickel/issues/893
2022-11-24 09:57:53 +01:00
Yann Hamdaoui
1ddf52bdeb
[CI] Add clippy check (#793)
* Print logs when running `nix flake check` in CI
* Add clippy to the flake checks and git hooks
* Clippy auto fix
  `cargo clippy --fix --workspace --no-deps --frozen --offline -- --deny warnings --allow "clippy::new-without-default" --allow "clippy::match_like_matches_macro"`
* Manually fix remaining Clippy warnings

Co-authored-by: Julien Debon <julien.debon@tweag.io>
2022-11-17 18:18:49 +01:00
Julien Debon
bb66cb0266 Update wasm-bindgen from 0.2.74 to 0.2.83
Version 0.2.74 no longer builds with recent `nixpkgs` because of openssl.

* Update wasm-bindgen from 0.2.74 to 0.2.83
* Refactor `wasm-bindgen-cli` overlay to override Nixpkgs' definition, rather
than build the package from Github
* Remove the no longer used `wasm-bindgen-api-Cargo.lock` file
* Add comments about the hidden coupling between `wasm-bindgen` in `Cargo.toml`
and `wasm-bindgen-cli` in `flake.nix`
2022-11-03 11:36:34 +01:00
Yann Hamdaoui
5934b325cd
Update flake.nix 2022-10-28 17:10:21 +02:00
Yann Hamdaoui
9552154268
Documenting cargoHome use in the flake definition 2022-10-28 17:08:45 +02:00
matthew healy
db55f960ee
Avoid double-negative
Co-authored-by: Julien Debon <julien.debon@tweag.io>
2022-10-28 15:19:45 +02:00
Matthew Healy
f5f66c6433 Add rust-analyzer to devShells 2022-10-28 14:11:19 +02:00
Yann Hamdaoui
66d60a7e61 Enable markdown linting
Add configuration for markdown linting (disabling some rules) and enable
markdown linting in the pre-commit hooks and the checks of the flake.
2022-08-05 11:55:21 +02:00
Yann Hamdaoui
e0767e44a1 Remove deprecated devShell and defaultPackage 2022-08-04 18:35:18 +02:00
Yann Hamdaoui
952a10169d Update to the new cachix instance 2022-08-01 15:51:45 +02:00
Yann Hamdaoui
9de227b5aa
Merge pull request #744 from tweag/task/build-stdlib-doc-2
Add flake output to build stdlib documentation
2022-06-29 12:15:27 +02:00
Yann Hamdaoui
c65f101fe5
Remove Makam specification 2022-06-24 16:46:36 +02:00
Yann Hamdaoui
edc532b420
Add flake output to build stdlib doc 2022-06-22 11:13:47 +02:00
Yann Hamdaoui
841cfb7db1
Separate the WASM repl in wrapper crate 2022-06-15 16:53:38 +02:00
Yann Hamdaoui
0b1ed40e40 Rename crates nickel* to nickel-lang* 2022-03-06 22:27:57 +01:00