This repository has been archived by the owner on Aug 6, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the result of a Hackathon experiment with https://nixos.org.
Note: these are the impressions after a few hours being introduced and fiddling with
nix
, take it with a pinch of salt.Feel free to checkout the branch for testing, should work straight away in a development environment.
What is Nix?
Nix is a package manager for Unix systems (sort of
apt
,rpm
) that aims to create deterministic environments.To sum it up, it tries to solve a situation in which your Dockerfile that starts with:
will create a completely different image (or even fail) when you build it 6 months from now.
How is it different from
apt
?We found the manual a bit hard to understand, but that's likely caused by the fact that you need to change your mindset. While
apt
orrpm
kind of work the same way,nix
does things in a different way.I'd say the main difference is that packages are scoped. What that mean is:
nix-env -i
the same way you do withapt install
. But if you install 2 packages, there's no guarantee they can speak to each other.python
is required duringnpm install
) we need to define them in the sameshell.nix
file, which will create an isolated shell where only the dependencies defined asbuildInputs
are available.The Good
It actually works. Once the initial perplexity passes you get to understand why it works this way.
The bad
shell.nix
file, we're not specifying versions, which makes it not deterministic (which would be the main selling point!!). You can actually solve this problem, but in a far than elegant way (long github thread here).Should we migrate at some point?
Probably not, but if we're struggling with reproducibility, might be worth checking again.