Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/node insertion #17

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ rowan = "0.12.6"
parse-display = "0.4.1"
anyhow = "1.0"
rust-nix-templater = { git = "https://github.com/yusdacra/rust-nix-templater.git", branch = "master" }
either = "1.6.1"
nixpkgs-fmt = "1.1.0"
regex = "1"

[package.metadata.nix]
app = true
Expand Down
23 changes: 6 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,12 @@ their package and set of dependencies.

The idea is to have the user specify the type of dependencies,
flake inputs and outputs, and type of the package with `skim`,
then to output a flake. This flake is then validated with `rnix`.
then to output a flake. This flake is then validated with `rnix`
formatted with `nixpkgs-fmt`, then written to a file.

If the user wants to modify an existing flake to add or remove
dependencies, this will also be possible. The flake shall be
parsed in with `rnix`, and the user will be able to modify it.

As of now, basically none of the features exist. I've only
got the proof of concept working: skim can be used for a cli
and rnix can be used to modify the AST.

Further down the line, I'd like to make this even more interactive.
This will involve querying github, crates.io, pypy, nixpkgs and more for packages,
then piping them into skim for selection based on language.

The hope is to also provide automatic support for pre-existing
nix expression generators such as node2nix, poetry2nix, cabal2nix,
and naersk.
parsed with `rnix`, and the user will be able to modify it.

# Dependencies #

Expand All @@ -60,11 +49,11 @@ and the `skim` fuzzy finder for the cli.
# Roadmap #

- [x] Proof of concept
- [ ] Flake Input management
- [ ] Add inputs
- [x] Flake Input management
- [x] Add inputs
- [ ] Remove inputs
- [ ] Change inputs
- [ ] Query github
- [ ] Query github into skim (this is hard...may not be feasible..)
- [ ] BuildInput management
- [ ] Query nixpkgs
- [ ] Modify buildInputs
Expand Down
21 changes: 21 additions & 0 deletions src/ir/hlir_types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use crate::SmlStr;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use crate::SmlStr;
use smol_str::SmolStr;


enum NixPrimitive {
Bool(bool),
Int(i64),
Str(SmlStr),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Str(SmlStr),
Str(SmolStr),

}

trait NixValue {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not model all possible values here (including rather opaque stuff like function calls)? Maybe it would be a good idea to put this into a separate crate.


enum NixType {
Integer,
String,
Function,
List(Box<NixType>),
AttrSet(Vec<Box<NixType>>),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this AttrSet type decl supposed to work?

}

//enum NixStructure {
//List(Vec<Box<dyn >>),
//}
1 change: 1 addition & 0 deletions src/ir/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod hlir_types;
Loading