That seems like a good idea that I wanted several times in the past already.
You work on some project for a little bit and create a shell.nix, because you do that for every project anyway. But then it just sits there and rots away.
So having a super simple way of saying “upload this shell.nix (and maybe 1-2 other files) for others to find/use” would be awesome, and if i could automate that via something like direnv
where it recognizes the project and downloads suitable shell.nix
for me would be even cooler.
There are a few ways I can think of, like setting up a repo that contains those files, sharing them via IPFS, or setting up a simple API to communicate with (most likely a combination).
It’s important that we have a robust way of identifying projects, and most likely also to have multiple shell.nix
for different branches, personal forks, etc. But for the first version I wouldn’t bother with that too much, maybe give the option to add a comment for the intended purpose and allow everyone to publish their own version would be sufficient.
It’s also dangerous to have automatic uploads, as it might contain things like credentials (I’m guilty of having put them into .nix
files in the past for things like private FTP servers).
With that out of the way, I think we should see what kind of UX would be nice to have (I’m using ainix
for this hypothetical new tool, combination of the Japanese for Love and Nix):
DWIM usage on a new project
$ ainix .
Detecting project ...
Found `.git/config` with origin of `git@github.com:manveru/yuten.git`
Determining whether someone you subscribe to shared the love for `gitub.com/manveru/yuten`...
1) Found `github.com/zimbatm/ainix/love/github.com/manveru/yuten` with `shell.nix` and `gemset.nix`
2) Found `github.com/manveru/ainix/love/github.com/manveru/yuten` with a `shell.nix`
Which one would you like to use?
1
Downloading to `.cache/nix/ainix/github.com/manveru/yuten` ...
Linking `shell.nix` to ./shell.nix ...
Linking `gemset.nix` to ./gemset.nix ...
All ready, but please read the just downloaded files before use to make sure they don't contain malicious code.
Uploading your stuff
$ ainix push shell.nix gemset.nix
Detecting project ...
Found `.git/config` with origin of `git@github.com:manveru/yuten.git`
Uploading `shell.nix` and `gemset.nix` to `github.com/manveru/ainix/love/github.com/manveru/yuten` ...
Would you like to notify others about this addition? [Y|n]
y
Sending info to ainix.rocks
Discovering other options
$ ainix list .
Detecting project ...
Found `.git/config` with origin of `git@github.com:manveru/yuten.git`
Querying ainix.rocks for options for this project ...
| 2018.05.18 | zimbatm | shell.nix, gemset.nix |
| 2018.05.19 | manveru | shell.nix |
| 2018.05.19 | cleverca | shell.nix, default.nix, gemset.nix |
Immediately use a specific shell.nix
$ ainix use cleverca .
Detecting project ...
Found `.git/config` with origin of `git@github.com:manveru/yuten.git`
Downloading from `github.com/cleverca/ainix/love/github.com/manveru/yuten` to `.cache/nix/ainix/github.com/manveru/yuten` ...
Linking `shell.nix` to ./shell.nix ...
Linking `gemset.nix` to ./gemset.nix ...
Linking `default.nix` to ./default.nix ...
Maintaining your list of friends to share with.
$ ainix follow cleverca
Adding `cleverca` to your list of trusted users.
You're now subscribed to `zimbatm`, `manveru`, and `cleverca`.
I think I’ll write up a prototype tonight, because that seems like fun and i just registered the ainix.rocks domain anyway.