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
resholve: init at 0.4.0 #85827
resholve: init at 0.4.0 #85827
Conversation
e29da15
to
b6b79b1
Compare
55c6945
to
71d5ae4
Compare
I marked this as draft for a few days while I refactored how it packages and consumes its Oil-shell dependency. Not super relevant, but the main changes are:
|
83f77de
to
05cb20e
Compare
@grahamc I have finally released version |
resholve attempts to resolve executables in shell scripts. Includes Nix builder for resolving dependencies in Nix-built shell projects.
05cb20e
to
6937d9e
Compare
Edit: #84062 has been merged, so my maintainer entry is now in master. |
I rewrote the Nix API to support multiple resholve invocations with different settings.
I've pushed an update which reworks the Nix API so that it can specify more than one resholve invocation. resholve.resholvePackage rec {
# ...
scripts = [ "bin/hag.bash" "bin/hag_import_history.bash" ];
interpreter = "${bashInteractive_5}/bin/bash";
# ...
} Here's how it looks with the API update: resholve.resholvePackage rec {
# ...
solutions = {
profile = {
scripts = [ "bin/hag.bash" ];
interpreter = "none";
};
# profile/cmd are arbitrary names; could be a list
# but I gather set is preferred for overridability
cmd = {
scripts = [ "bin/hag_import_history.bash" ];
interpreter = "${bashInteractive_5}/bin/bash";
};
};
#...
} |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code wise LGTM, I can also build with with nixpkgs-review
but it conflicts with nixpkgs PATH so I can't post the result.
Anyway, approving, but I didn't test it very much (did run resholve --help
and it works). Probably someone with more context of how the package is supposed to work can check the functionality.
Don't forget to squash the commits before merging.
@SuperSandro2000 I haven't had any luck fishing for feedback on how to document this in the short run, so I pushed a commit updating the doc/comments where I previously had TODOs. That's the last thing I wanted to do here, so I think it is ready for a squash-and-merge (if you think they're okay?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Package should be fine after my suggestions. I am not to sure if the build support could be made easier or we have inbuild functions for some of the ones but it should be fine for now.
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
@SuperSandro2000 I've pushed commits that:
|
Didn't read the entire doc but if we find mistake/areas to improve we can always do that later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am exceedingly excited to use this!
It's a miracle ✨ @abathur I'm excited that you got this into nixpkgs ❤️ |
Motivation for this change
Give the Nix ecosystem a new superpower: resolving external dependencies in shell scripts.
Shell scripts/libraries with external dependencies are an odd duck in the Nix ecosystem. Packaging them with Nix doesn't ensure dependencies are available at runtime or address the possibility that the script could run executables provided by packages other than those specified as dependencies, for example.
More information
This PR packages a project of mine, https://github.com/abathur/resholve, and provides a Nix build function. resholve is built atop the parser from the Oil shell project. A fair portion of the Nix code in this PR is just packaging/building a development version of Oil.
The PR itself isn't terribly useful for seeing what it does; it'll help to look at some additional resources:
FWIW, I dogfood resholve in my own darwin-configuration, where it is responsible for building a chain of packages structured like:
A question came up during review about whether some of the packages in `deps.nix` should be split out into standalone packages. I've resolved the thread, but others may have the same question so I'm keeping the answer somewhere easier to find:
cc @grahamc @worldofpeace
Known issues
The current design of the Nix API assumes all of the shell files can be resolved with the same settings, and it won't be terribly obvious what to do (aside from break it up into multiple derivations, or override to manually invoke resholve) in these cases.I'm not sure what the best approach here is. For reference, here's one possible approach from @grahamc: https://gsc.io/content-addressed/92d2781347e6e0d9b761ff2d4512d6885f48d8fb6a97db15f0ba5f4863ec91bd.nixI have pushed a
tentativefix for this; see #85827 (comment) and d36bb7dThings done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)