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

Possible use case? Running pre-commit #3

Open
yajo opened this issue Jan 31, 2023 · 1 comment
Open

Possible use case? Running pre-commit #3

yajo opened this issue Jan 31, 2023 · 1 comment

Comments

@yajo
Copy link

yajo commented Jan 31, 2023

I've recently moved a project I maintain to Nix. It's a Python project. Not so long after the movement, the first contributors complains started. See copier-org/copier#931 (comment) for example. IMHO it's a valid complain!

Of course, the point here is to run a command from the devshell. I guess that's a package too. Would I be able to tell users to run a runix command to run the linters? Some clue on where to start?

@timbertson
Copy link
Owner

timbertson commented Feb 1, 2023

If you want to run some predefined and occasionally-changing files, then runix sounds like a good solution. e.g. in this example, if poe is an external tool then you could tell people to run ./script/poe lint, and script/poe would be generated by you running on your machine (that has nix):

$ runix --entrypoint xxxxxxxxxxxxxxxxxxx-poe-1.2.3 bin/poe --save script/poe --with-cache https://yourcache.cachix.org --auto-bootstrap

Given the derivation for poe which you have pushed to your cache. If you want it to be multiplatform (i.e. darwin + linux), you can do that too with a little more work.

The script would be totally self-contained - you commit it to your repo, then anyone who runs it will cache runix and poe once, and then reuse both from the cache. If you update the derivation and commit a new version of this wrapper, anyone running the new version will download any derivations they don't already have cached.

If poe were a fast-moving part of your own project that changed every day, then it could be inconvenient and confusing to keep those derivations up to date. But if it's something you have to redo every 6 months and commit a new version of that generated script, it's definitely doable 👍

Let me know if you hit any troubles, I'd love to encourage real world use cases.


If you prefer, it's possible to make a "dev env" like runix wrapper, where it can wrap more than one tool, and you use it to drop into a shell with a bunch of tools available. That's a bit more complex, so it's probably best to start with the single-purpose wrappers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants