nix-fast-build icon indicating copy to clipboard operation
nix-fast-build copied to clipboard

Ram usage building .#nixosConfigurations

Open covert8 opened this issue 6 months ago • 1 comments

Hi love the project, thinking of doing some work on it and I would like some feedback before starting.

By default the .#checks get build and I added my .#nixosConfigurations like so:

checks.x86_64-linux = lib.mapAttrs' (name: config: lib.nameValuePair "${name}" config.config.system.build.toplevel) self.nixosConfigurations;

However, this resulted in additional downloads when doing a plain nix flake check and prolonging the check duration; so I found this sub optimal as I like to check on a tmpfs.

To avoid the default .#checks I passed -f .#nixosConfigurations but that results in an OOM on the evaluator (>64GB;no tmpfs ; 5 hosts) and not completing any derivation in a timely fashion. I ended with this:

hosts=$(nix flake show --json | jq -r '.nixosConfigurations | keys | .[] | select(. != "C60006") |  ".#nixosConfigurations." + . + ".config.system.build.toplevel"')
while read -r host; do
    nix-fast-build -f "$host" --no-nom -j 1 --eval-workers 1 --skip-cached
done <<<$hosts

My questions:

  • Is there a way to simplify the while loop?
  • Do you think it is feasible to remove already uploaded derivations (when using the cachix daemon) to make more ram available during a build?
  • Would you accept a pr supporting the attic client?

covert8 avatar Aug 13 '24 09:08 covert8