nix-community / terraform-nixos

A set of Terraform modules that are designed to deploy NixOS [maintainer=@adrian-gierakowski]
Apache License 2.0
333 stars 61 forks source link

deploy_nixos: parameterise concurrency controls of `nix-copy-closure` #83

Open denbeigh2000 opened 2 months ago

denbeigh2000 commented 2 months ago

I often use this module to provision cloud machines that are incompatible with the host machine I am deploying from. In these cases, I often find that the slowest part is transferring .drv files to the remote machine, where they are then evaluated and built.

This change exposes the --max-jobs parameter of nix-copy-closure to the terraform operator as a variable, so more than one derivation can be copied to the remote host at a time. This isn't officially documented in --help/the man page of nix-copy-closure, but appears to be supported.

$ nix-copy-closure --max-jobs invalid
error: configuration setting 'max-jobs' should be 'auto' or an integer
Try 'nix-copy-closure --help' for more information.

In practice, this significantly improved my runtimes when deploying from incompatible host systems.

denbeigh2000 commented 2 months ago

:wave: hello, this is my first pr in this project!

i'm happy to make any changes to fit in with preferred code styling/conventions/preferences here - if you have any requests, just let me know.