Hi folks,
I am using Nix on Ubuntu 24.04 and the binaries I’m installing via Nix (they happen to be installed via a flake) are all very slow the first time they are invoked (5+ seconds). It is not any particular binary, or at least it happens when any binary from my Nix-installed packages is run for the first time. The second and subsequent times any of them are run, they start quickly.
ubuntu@ip-172-31-9-246:~$ which terraform
/nix/var/nix/profiles/fxdevenv-systemwide/bin/terraform
ubuntu@ip-172-31-9-246:~$ time terraform --version
Terraform v1.10.5
on linux_amd64
Your version of Terraform is out of date! The latest version
is 1.11.3. You can update by downloading from https://www.terraform.io/downloads.html
real 0m14.864s
user 0m0.145s
sys 0m0.200s
ubuntu@ip-172-31-9-246:~$ time terraform --version
Terraform v1.10.5
on linux_amd64
Your version of Terraform is out of date! The latest version
is 1.11.3. You can update by downloading from https://www.terraform.io/downloads.html
real 0m0.066s
user 0m0.049s
sys 0m0.027s
ubuntu@ip-172-31-9-246:~$ which terramate
/nix/var/nix/profiles/fxdevenv-systemwide/bin/terramate
ubuntu@ip-172-31-9-246:~$ time terramate --version
0.11.9
real 0m7.079s
user 0m0.102s
sys 0m0.105s
ubuntu@ip-172-31-9-246:~$ time terramate --version
0.11.9
real 0m0.151s
user 0m0.082s
sys 0m0.053s
ubuntu@ip-172-31-9-246:~$
I’ve tried running strace against these executions but I see nothing in particular interesting, although that may be because I’m not sure what I’m looking for.
This is on an AWS-hosted Ubuntu VM.