Repository navigation
Conversation
lnk3
commented
Aug 24, 2026
Comment on lines
+53
to
+59
| fn find_nimble_file(src_dir: &Path) -> Option<String> { | ||
| std::fs::read_dir(src_dir) | ||
| .ok()? | ||
| .filter_map(Result::ok) | ||
| .find(|entry| entry.path().extension().is_some_and(|ext| ext == "nimble")) | ||
| .map(|entry| entry.file_name().to_string_lossy().into_owned()) | ||
| } |
Author
There was a problem hiding this comment.
This is to find detect the nimble file since it doesn't have a predefined name like config.nimble
There is a nimbleFile parameter for the nixpkgs builder function which is not mandatory but nice to have and trivial to precompute for the maintainer.
Comment on lines
+45
to
+51
| fn get_lock_path(out_dir: Option<&Path>) -> String { | ||
| out_dir | ||
| .map(|d| d.join("lock.json")) | ||
| .unwrap_or_else(|| PathBuf::from("lock.json")) | ||
| .display() | ||
| .to_string() | ||
| } |
Author
There was a problem hiding this comment.
If you use nix-init in a nixpkgs checkout it precomputed the out_dir to something like pkgs/by-name/xx/xxxxxxxx/, so I wanted to use it to help the maintainer generate the lockfile in the correct place.
The comment will result in a simple command the nix-init user can just copy and run
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I followed the direction of #809
I added a test using https://github.com/dom96/choosenim, which I now realize is not maintained.
It shouldn't really matter, please let me know if you want me to change it.
I wasn't sure if I did
explicit_strict_depsin the correct way, I looked in mod.rs and it seemed disabled by default:https://github.com/lnk3/nix-init/blob/885cf34a90121fa436d6791d6799a0b4f1135f02/src/codegen/mod.rs#L105-L107
But I read somewhere it is better to have it and the docs seem to suggest so.
Other than that implementation is simple I'll add a few notes so code review goes easier.