Skip to content

Commit

Permalink
rix now focuses only on nix language evaluation (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
urbas authored Mar 17, 2024
1 parent 386a12b commit 75513bd
Show file tree
Hide file tree
Showing 24 changed files with 26 additions and 2,472 deletions.
251 changes: 11 additions & 240 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rustnix"
description = "A reimplementation of nix in Rust."
description = "Nix language interpreter"
documentation = "https://github.com/urbas/rix/blob/master/README.md"
edition = "2021"
homepage = "https://github.com/urbas/rix"
Expand All @@ -23,13 +23,6 @@ predicates = "2.1.1"
[dependencies]
clap = "4.0.18"
colored = "2.0.0"
libc = "0"
nix = { version = "0.25.0", features = ["env"] }
nom = "7.1.1"
rowan = "0"
rnix = "0"
serde = { version = "1.0.147", features = ["derive"] }
serde_json = "1.0.87"
tempfile = "3.3.0"
uuid = { version = "1.2.1", features = ["v4"] }
v8 = "0.80.0"
246 changes: 13 additions & 233 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![builder](https://github.com/urbas/rix/actions/workflows/build.yml/badge.svg)](https://github.com/urbas/rix/actions/workflows/build.yml)

A reimplementation of `nix` in Rust.
Nix language interpreter.

# Trying it out

Expand All @@ -15,242 +15,22 @@ implemented.

# Notable design choices

1. Nix expressions are transpiled to JavaScript and evaluated with V8. The idea
is to leverage all the great work around the JS ecosystem (such as debuggers,
fast JIT compilers, profilers, libraries, compiled code caching, source
mapping, just to name a few).

2. Use plain-old files and directories to store metadata (instead of a central
SQLite database). The idea is to have trully immutable stores, composable
stores, avoid the central sqlite choke-point, and be more transparent (allow
users to browse the store's metadata without having to learn about SQLite).

3. Shard directories that contain huge amounts of hash-prefixed files (i.e., use
paths like `/nix/store/ca/fe/xxzzxjyhvbll1c7bkswwy36nlafx-foo-1.2.3`).
Rix transpiles Nix expressions to JavaScript and evaluates them with V8. The idea
is to leverage all the great work in the JS ecosystem (such as debuggers,
fast JIT compilers, profilers, libraries, compiled code caching, and source
mapping just to name a few).

# Progress

## New sub-commands

- πŸŒ— `build-derivation`: builds a derivation in a sandbox.

- πŸŒ• stage 0: creates a sandbox.
- πŸŒ• stage 1: builds derivations without dependencies.
- πŸŒ— stage 2: builds derivations with dependencies.
- TODO: prevent internet access.
- πŸŒ‘ stage 3: builds fixed derivations (with internet access).
- πŸŒ‘ stage 4: builds X% of derivations in `nixpkgs` (assuming all dependencies
are present).

- `transpile`: converts the given nix expression into JavaScript and prints it
to stdout.

## Nix sub-commands

- 🌘 `eval`

- πŸŒ• stage 0: evaluate basic expressions, rec attrsets, let bindings, `with`
statement, functions
- πŸŒ• stage 1: lazy evaluation
- 🌘 stage 2:
- 🌘 built-in functions (progress: 3 out of 111)
- πŸŒ‘ derivations (hello world derivation)
- πŸŒ‘ stage 3: full implementation (all derivations in nixpkgs, nice error
messages, etc.)

- 🌘 `show-derivation`

- πŸŒ• stage 1 (MVP): parse .drv files and dump JSON
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ• `hash to-base32`

- πŸŒ• stage 1 (MVP): conversions of non-SRI hashes
- πŸŒ• stage 2: most common use cases
- πŸŒ• stage 3: full implementation

- πŸŒ• `hash to-base64`

- πŸŒ• stage 1 (MVP): conversions of non-SRI hashes
- πŸŒ• stage 2: most common use cases
- πŸŒ• stage 3: full implementation

- πŸŒ• `hash to-base16`

- πŸŒ• stage 1 (MVP): conversions of non-SRI hashes
- πŸŒ• stage 2: most common use cases
- πŸŒ• stage 3: full implementation

- πŸŒ• `hash to-sri`

- πŸŒ• stage 1 (MVP)
- πŸŒ• stage 2: most common use cases
- πŸŒ• stage 3: full implementation

- πŸŒ‘ `hash file`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `hash path`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `build`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `develop`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `flake`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `help`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `profile`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `repl`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `run`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `search`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `shell`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `bundle`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `copy`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `edit`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `log`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `path-info`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `registry`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `why-depends`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `daemon`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `describe-stores`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `key`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `nar`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `print-dev-env`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `realisation`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `show-config`

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation

- πŸŒ‘ `store`
- πŸŒ• stage 0: evaluate basic expressions, rec attrsets, let bindings, `with`
statement, functions

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation
- πŸŒ• stage 1: lazy evaluation

- πŸŒ‘ `doctor`
- 🌘 stage 2:

- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation
- 🌘 built-in functions (progress: 7 out of 113)
- πŸŒ‘ derivations (hello world derivation)

- πŸŒ‘ `upgrade-nix`
- πŸŒ‘ stage 1 (MVP)
- πŸŒ‘ stage 2: most common use cases
- πŸŒ‘ stage 3: full implementation
- πŸŒ‘ stage 3: full implementation (all derivations in nixpkgs, nice error
messages, etc.)
Loading

0 comments on commit 75513bd

Please sign in to comment.