I just created this pod.nix
file based on available resouces in the Internet.
No guarantee that it's working!
NixOS is built on pure functions. Pure functions are functions that only one output is possible for a certain input. This is the secret to reproducibility, and scalability. But the world is big and our software wants to communicate with that, so it cannot stay pure, therefore, effects exist.
The goal of this implementation is to modularize the effects, so keep us in-control.
Effects, such as storage, network, user, should be separated for different software.
So this is my argument to prefer podman
over NixOS containers, because I am a chaotic effect,
so I cannot declare the definition of containers upfront.
Did you have problem like the followings:
- a software dump its caches in the user home, for instance
cargo
creates~/.cargo
directory, gradle creates~/.gradle
direcoty, where by design they don't keep the caches of different projects separated, so it's hard to clean up their mess after finish working on a project for just 2 hours. - Another class of problem is that you download a software and it'll reside in
/nix/store
for months, where you just needed that software for an hour to be there. For instance, I want to work with my project in Latex, and now it stays there when I don't need that. - Or worse, a project that has CUDA dependencies so you have to add CUDA cache substituter to the dependencies of the entire NixOS.
- You can solve above problems by using containers, of course, but you cannot wire up home-manager's configurations into the containers easily.
You can isolate their effect by creating containers and removing them after finishing your work. Additionally, you can wire home-manager's configurations into the containers. This project can help you with such a task.
Checkout development pod, and firefox pod.
Also, I am using it as my configuration, so there would be some examples and usages.
There are some FIXME in the code that I have no clue how to solve them!
Also the nix-daemond
is not getting run in the endpoint.sh
. So it may need more investigation.
I wish the code was more concrete, but I admit it's a bit hacky! If you know how to fix them, feel free to create issues, and pull requests.