clhodapp / nix-runner

Tidy shell shebangs with nix flakes
GNU Affero General Public License v3.0
45 stars 3 forks source link

Speed up initial run #7

Closed clhodapp closed 1 year ago

clhodapp commented 1 year ago

Running a nix-runner script on a given host for the first time is not as fast as it could be. Since there isn't a dedicated cache for nix-runner, this means we have to download everything needed to build it from scratch in this situation. That means that every build dependency counts and we should strive to make the footprint as small as possible.

Some ideas:

  1. Stop using resholve. It's a great tool but there probably isn't enough going on here to justify an extra 100mb of dependencies.
  2. Stop using autotools. Similar reason.
  3. Use the system nix instead of an internally-pinned one. This might make the behavior less deterministic but it would make the script WAY faster to run
clhodapp commented 1 year ago

Shrunk closure by:

  1. Dropping resholve
  2. Dropping autotools
  3. Switching from stdenv.mkDerivation to a raw derivation (so it doesn't put gnu make in the build closure)
  4. Using busybox instead of coreutils and gnused
  5. Switching to nixStatic
abathur commented 1 year ago

I don't know if it's intrinsic or fixable, but busybox is marked linux only and the build fails on macOS.