{"id":22843345,"url":"https://github.com/milahu/nix-eval-js","last_synced_at":"2025-04-28T13:44:06.930Z","repository":{"id":59149626,"uuid":"535121450","full_name":"milahu/nix-eval-js","owner":"milahu","description":"nix interpreter in javascript","archived":false,"fork":false,"pushed_at":"2024-05-16T17:26:59.000Z","size":2570,"stargazers_count":8,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-30T10:11:18.298Z","etag":null,"topics":["dynamic-analysis","eval","evaluator","incremental-compilation","incremental-compiler","incremental-evaluation","intellisense","interpreter","javascript","lezer-parser","nix","nixos","nixpkgs","toy-interpreter"],"latest_commit_sha":null,"homepage":"https://milahu.github.io/nix-eval-js/demo/dist/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/milahu.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-10T21:17:50.000Z","updated_at":"2024-09-17T08:20:05.000Z","dependencies_parsed_at":"2023-01-22T17:31:25.302Z","dependency_job_id":null,"html_url":"https://github.com/milahu/nix-eval-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milahu%2Fnix-eval-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milahu%2Fnix-eval-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milahu%2Fnix-eval-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milahu%2Fnix-eval-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milahu","download_url":"https://codeload.github.com/milahu/nix-eval-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251321529,"owners_count":21570755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dynamic-analysis","eval","evaluator","incremental-compilation","incremental-compiler","incremental-evaluation","intellisense","interpreter","javascript","lezer-parser","nix","nixos","nixpkgs","toy-interpreter"],"created_at":"2024-12-13T02:14:25.118Z","updated_at":"2025-04-28T13:44:06.908Z","avatar_url":"https://github.com/milahu.png","language":"JavaScript","readme":"# nix-eval-js\n\n[nix](https://github.com/NixOS/nix) interpreter in javascript\n\n## status\n\nearly draft\n\nfor a list of implemented features, see [test/nix-eval.snapshots.txt](test/nix-eval.snapshots.txt)\n\n### autocompletion\n\na very simple version of autocompletion is working\n\nthis is based on the last valid eval state\n\nsee the demo\n\n## demo\n\n[nix-eval-js demo](https://milahu.github.io/nix-eval-js/demo/dist/)\n\n## documentation\n\nsee [docs/](docs/)\n\n## install\n\n```sh\ngit clone --recurse-submodules https://github.com/milahu/nix-eval-js\ncd nix-eval-js\npnpm install\n```\n\n### commands\n\n```sh\n./bin/nix-parse -e 1+1\n./bin/nix-eval -e 1+1\n\n./bin/nix-parse -f /etc/nixos/configuration.nix\n./bin/nix-eval -f /etc/nixos/configuration.nix\n\n./bin/nix-parse -f ~/src/nixpkgs/pkgs/top-level/all-packages.nix\n./bin/nix-eval -f ~/src/nixpkgs/pkgs/top-level/all-packages.nix\n```\n\n### offline demo\n\n```sh\ncd demo\npnpm install\nnpm run dev\n```\n\n## goals\n\n### incremental evaluator\n\ncreate a prototype for an **incremental** evaluator\n\n#### example\n\n```nix\n__head [ 1 ]\n```\n\nthis evaluates to the result `1`\n\nadding values to the list does not change the result\n\n```nix\n__head [ 1 2 ]\n```\n\nstill evaluates to the result `1`\n\nonly changing the first value changes the result\n\n```nix\n__head [ 3 ]\n```\n\nthis evaluates to the result `3`\n\n### intellisense\n\n#### autocompletion\n\n```nix\nlet\n  pkgs = {\n    hello = ''\n      #! /bin/sh\n      echo hello\n    '';\n  };\nin\npkgs.\n#    ^ cursor\n```\n\nat this cursor, i want the autocompletion `hello`\n\nthis should also work with `callPackage` and `makeScope`\n\n## Nix Interpreters\n\naka: Nix Evaluators\n\nstatus = how much of \"the perfect nix\" is implemented\n\n* [nix](https://github.com/NixOS/nix) - the original nix interpreter in C++. aka `nix.cc`. Status: 90%\n* [tour of nix](https://github.com/nixcloud/tour_of_nix) - nix interpreter in javascript. aka `nix.js`.  \nthe original nix interpreter, compiled to asm.js. Status: `nix-instantiate`\n  * https://nixcloud.io/tour/\n  * https://lastlog.de/blog/posts/tour_of_nix.html\n  * https://github.com/NixOS/nixpkgs/pull/16208 - emscripten based toolchain for nix\n* [hnix](https://github.com/haskell-nix/hnix) - nix interpreter in haskell. aka `nix.hs`. Status: 50%\n* [rnix-lsp](https://github.com/nix-community/rnix-lsp) - nix interpreter in rust. error-tolerant interpreter for intellisense. based on the [rnix-parser](https://github.com/nix-community/rnix-parser). aka `nix.rs`. Status: 20%\n* [Toros](https://github.com/kamadorueda/toros) - Nix implementation in Rust. Based on the [NixEL](https://github.com/kamadorueda/nixel) parser. aka `nix.rs`. Status: 10%\n* [nix-eval-js](https://github.com/milahu/nix-eval-js) - Nix interpreter in pure JavaScript. Proof of concept. Based on the [lezer-parser-nix](https://github.com/milahu/lezer-parser-nix) parser. aka `nix.js`. Status: 5%\n\nin a distant future, nickel can interpret nix https://github.com/tweag/nickel/issues/93\n\nsee also https://github.com/nix-community/awesome-nix/pull/133\n\n## related\n\n* [lezer-parser-nix](https://github.com/milahu/lezer-parser-nix) - nix parser in javascript\n* [nixos-config-webui](https://github.com/milahu/nixos-config-webui) - old project\n* [nijs](https://github.com/svanderburg/nijs) - Nix bindings for JavaScript\n\n## keywords\n\n* nix evaluator in javascript\n* eval nix code in javascript\n* evaluate nix code in javascript\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilahu%2Fnix-eval-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilahu%2Fnix-eval-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilahu%2Fnix-eval-js/lists"}