I wanted to play with flakes, and therefore kumped into them, roughly after summer holiday.
So I’m using flakes since ~3 months now.
I really like the evaluation cache, and its well defined interface about inputs and outputs. Though there are also some things, that are troubling me and I want to talk about them in a broader context than the chat, perhaps I’m still misunderstanding things about it, perhaps my view makes people think differently and causes a change? Or perhaps its just that someone finds my thoughts and considerations a nice read.
Despite my thoughts, I will continue to use flakes for my personal stuff, but in their current form probably not for work (see below)
The global flake registry
It is there, and I can not do anything against it.
flake:nixpkgs
points at github:nixos/nixpkgs
(master
branch), while flake:nixpkgs/release-19.09
points to a last years fork of github:nixos/nixpkgs/release-19.09
by edolstra
.
Also there are other entries in the global registry, that seem to be random personal projects of edolstra (which is fine, though why are those in, but not eg. github:numtide/flake-utils
).
Also flake:nixpkgs
pointing at master
makes it barely usable and running the same nix shell nixpkgs#hello -c hello
results in redownloading and re-evaluation of the attributes quite often, as the evaluation cache can’t be re-used with the new commit. I think individual branches wouldn’t advance that fast and therefore be able to re-use evaluation cache more often.
Overwriting flake:nixpkgs
with a local registry entry (eg. github:nixos/nixpkgs/nixos-20.09
) seems to cause much less downloads and re-evaluations. And after using nix flake pin
there haven’t been any downloads anymore, though then the local registry entry points to github:nixos/nixpkgs/$sha1
, the information to which branch it pointed is lost. To “advance” the registry entry I have to actually know where it pointed to before and overwrite, and then pin
again.
Also once I have a local entry and create a flake it will create a lock file according to my local entry, and when contributors with a different local entry (or no local entry at all) would update or recreate the lockfile, all of a sudden the lockfile would point not only to a different commit, but a different branch then before!
Forced VCS
I love git, I like to use flakes, especially as they make pinning easy.
I’d like to use flakes for defining my dev-env at work, though I can not commit any nix file to the repo, I have to sideload them.
So I do not have any choice than to not use flakes, but instead manually fiddle around with rev-shas in builtins.fetchGit
and builtins.fetchTarball
as well as the slowness of IFDs (which luckily aren’t that bad when it is just a nixpkgs commit within a shell.nix
).
I’m missing some “ad-hoc” mode, that enables me to use version controlled flakes at the root, of course it is impossible to use those as inputs in any other kind of flake (even other ad-hoc ones).
Manipulation of registry
For old NIX_PATH
/channel style nix files, I was able to pin channels prior to the nixos-rebuild
and home-manager
through nix-shell
magic in the NIX_PATH
and running the mentioned commands within the pinned environment. At the same time I used either model to set the NIX_ENV
environment variable for the system/user to roughly match the inputs by doing environment = { NIX_PATH = "nixpkgs=${<nixpkgs>}"; }
(pseudo code), I’m missing something equivalent for flakes to be able to alter system/user wide pins through my configuration.
Also I am missing a way to delete global entries, as I do not consider them important for me.
Local registry
I have not yet found any hint about whether “local” entries are per user or systemwide.