Nix in GitHub Actions

I just created an issue (https://github.com/actions/virtual-environments/issues/1579) to request Nix support from within GitHub Actions VMs. Please go show it some love if you have GitHub :+1:s to spare!

This is something I personally need but I also suspect that this is a promising approach for expanding Nix’s impact and reaching more users. If Nix can become the “go to” method for installing X package in someone’s CI workflow they’ll come to discover Nix automatically. People are also going to be far more willing to try out some new package manager in CI before they install it on their personal machines.

2 Likes

I wonder how much disk space curl -L https://nixos.org/nix/install | sh takes up

Good question, I just ran a test: https://github.com/samuela/nixpkgs-upkeep/runs/1109229837?check_suite_focus=true

Looks like the answer is a little under 300Mb. That’s actually quite a bit higher than I was expecting for an empty install…

we could probably inspect the runtime closure to slim that down future. IIRC, parts of it still rely on perl and a few other utilities.

Yeah, I’m all for going on a campaign to rid Nix of perl haha

I looked into this further, apparently the biggest culprit is that you get a top-level checkout of the nixpkgs repo. And that’s 190MB out of the 270MB for a base install.

glibc is 32MB
nixexprs is 15MB

everything else is under 10MB and seems necessary for nix to work correctly.

If we wanted to improve this, we would have to “trim some fat” from the repo.

1 Like

If the Nix commands could be taught to read .nix.gz files then the repo shinks to about 105 MiB (33 MiB apparent size)…

1 Like

Would it be possible to just do a shallow checkout instead?

that’s what it’s doing, even the tarball version of the repo is still massive. After all, it has some 50-60k+ packages on it

Yeah I just tried git clone --depth 1 git@github.com:NixOS/nixpkgs.git -b master and it’s 169Mb. Damn…

1 Like