BuilderIO / ai-shell

A CLI that converts natural language to shell commands.
MIT License
4.08k stars 261 forks source link

Feature/nix - Add NixOS support #119

Open use-the-fork opened 1 month ago

use-the-fork commented 1 month ago

I love this project but needed it to run on my NixOS systems. So, I made it NixOS-compatible!

I also added setup instructions to the readme and contributing guides.

steve8708 commented 1 month ago

thanks @use-the-fork ! my only concern here is this is a lot of new code to maintain that i won't know how to maintain

just so i undertand - why is a dedicated nix package needed (aka why can you not use nodejs with NixOS)?

right now we only publish to npm which keeps things releatively simple and consistent, so need to make sure if we're going to add more targets and maintain those that it makes sense to do so

use-the-fork commented 1 month ago

@steve8708 So there is nothing "new" for you to maintain. NixOS is 100% declarative, meaning everything is compartmentalized, and there isn't a "global" Node.js package. Nix will build everything individually and in its own container. What I added will read the package-lock.json file and convert that into NixOS inputs (i.e., the NixOS equivalent). It will then use the exact inputs required to build the package and install it in its own space on my system.

That way, there are never any conflicts between packages, and if I ever want to remove something, it's 100% cleaned up with no remnants.

So this PR doesn't actually change anything for you. You can keep publishing to npm. All my addition does is allow someone using NixOS to add the package to their system.

steve8708 commented 1 month ago

totally hear you on that, but every line of code added to this repo is new code that maintainers of this repo need to be able to maintain (answer issues about, debug, fix, etc)

for instance, that lock.json, does it need to stay in sync with our package-lock.json? or the other files, is there 0 chance they will ever need to change or ever have a bug? if I or any other maintainer aren't familiar with nix, I can't confidently say we can support this code in the repo

is there any way to make a nix package that does not require source changes to this repo?

use-the-fork commented 1 month ago

totally hear you on that, but every line of code added to this repo is new code that maintainers of this repo need to be able to maintain (answer issues about, debug, fix, etc)

for instance, that lock.json, does it need to stay in sync with our package-lock.json? or the other files, is there 0 chance they will ever need to change or ever have a bug? if I or any other maintainer aren't familiar with nix, I can't confidently say we can support this code in the repo

is there any way to make a nix package that does not require source changes to this repo?

So there is a GitHub action that would do that. But you have a good point. I'll just keep my branch up-to-date.

Would you be okay with me removing that part but keeping just the parts that set up the dev environment? That wouldn't change at all unless you upgrade Node.js, and then it's just a number change.

I like this package and would like to contribute.

steve8708 commented 1 month ago

Would you be okay with me removing that part but keeping just the parts that set up the dev environment?

what parts would that be?