3 ms·
So I so far use it for dev environment and also for CI pipeline (the benefit is that Nix allows caching between runs, it helps with things like: - getting dev
by takeda 3y ago
So I so far use it for dev environment and also for CI pipeline (the benefit is that Nix allows caching between runs, it helps with things like:
- getting dev environment on CI to be identical to user dev
- with minor changes the project is not rebuilt or or rebuilt minimally
- the caching works across branches, so for example merging a feature branch to master, if nothing changes the build on master will be very quick
I created something similar to nix-cache for gitlab, but I had to create a dedicated runner running NixOS.
If I could use NixOS for deployment, at that point I would just point the same binary cache to the machine and use the same derivation to build the app. Because the app was already build by CI, it would just download the compiled version. No need for artifactory or similar. In that scenario (you using poetry) you probably would just use poetry2nix to generate the application.
If the OS is not NixOS, but you still want to deploy via nix, then IMO this[2] looks interesting, basically it packages everything in self extracting archive. That you can extract and then run the app.
Other alternatives are these bundlers[3], which includes building toArx (works in a way similar to the previous one but pretends everything is in a single file), RPM, DEB, docker (you would have more control over it if you would use the code directly instead of a bundler though)
And the last option (probably the most obvious one) is that you can simply just use the tool to build the package. Since you're using poetry, then you can generate a wheel from it.
[1] https://github.com/takeda/nix-cde/blob/master/contrib/gitlab-runner/nix-builder.yaml https://github.com/takeda/nix-cde/blob/master/contrib/gitlab...
[2] https://github.com/Ninlives/relocatable.nix https://github.com/Ninlives/relocatable.nix
[3] https://github.com/NixOS/bundlers/blob/master/flake.nix https://github.com/NixOS/bundlers/blob/master/flake.nix