So apparently you can move packages around from one machine to another very easily.

Neat? I guess?

Chapter 13. Sharing Packages Between Machines

I can see this being useful in a situation where you have a lot of machines, and want to deploy some package you developed to those machines. You can apparently set up a custom version of a Nix binary cache with your own server? That’s neat. It looks easy. Good to know, if I ever need to Nix on more than two computers. But I’m not going to test it – I will try to come back to this later, when I try making my own package, and have multiple computers with Nix.

From this I learned another config value to add to my repertoire:

binary-caches = http://localghost:8080/

Which sort of surprised me – I remember from the glossary or introduction or something that such sources were supposed to live in the elusive Nix database.

But upon reading man 5 nix.conf to find out more, I find a surprising reveal: this config value is deprecated! The new key is substituters. binary-caches is an alias for that. Still no Nix database, then.

Next up we learn how to push packages to other machines. This is… I have trouble seeing why I would do this. I don’t know. I’m having trouble thinking of a use case. But I get to see another member of the nix menagerie: nix-copy-closure. Although I think the hip new way to do this is with nix copy. Again, I am not going to try it, but I will believe that this is a thing.

Next up we see nix store --export and nix store --import. This evokes, in my mind, the git format-patch and git am commands. They exist, and I know that they’re very important to someone, but I have never used them and have trouble imagining why I ever would.

It teaches me that nix-copy-closure is more efficient than --export + --import, as it does some diffing and only copies paths that aren’t present. Makes sense.

Interestingly, the next section – how to temporarily override the binary-caches/substituters option – does use the --substituters flag. Documentation: it’s a living document. It’s a beautiful thing.

I’m sort of zoning out on this chapter. How to set up ssh configs that will allow people to pull from my machine over ssh without doing anything else. Cool, okay. How to use S3. Maybe one day? Probably not. It’s S3. I don’t wanna do that.

Okay! The chapter is over. Phew.

I didn’t test any of this; I didn’t really learn anything. That’s okay. I’ll come back to it, maybe.

  • Do “substitutes” live in the Nix database or not?