cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
3.56k stars 259 forks source link

Installation takes a long time #536

Closed khaled closed 1 month ago

khaled commented 1 year ago

Describe the bug

Installation of devenv is slow, AFAICT because aws-sdk-cpp and nix-2.12.0pre are built from source rather than pulled from cache.

To Reproduce

The steps below are run in the official nix docker container, though I've observed the same behavior on aarch64-darwin (locally), and on aarch64-linux (a VM):

❯ docker run --rm -it nixos/nix

bash-5.1# nix --version
nix (Nix) 2.15.0
bash-5.1# nix-env -iA cachix -f https://cachix.org/api/v1/install
installing 'cachix-1.3.3'
copying path '/nix/store/9q7vpjglay90dbmck8aari340vhiw3yg-busybox-static-aarch64-unknown-linux-musl-1.36.0' from 'https://cache.nixos.org'...
...

bash-5.1# cachix use devenv
Configured https://devenv.cachix.org binary cache in /etc/nix/nix.conf

bash-5.1# nix-env -if https://github.com/cachix/devenv/tarball/latest
installing 'devenv'
these 10 derivations will be built:
  /nix/store/9qcrqk3v6d94xwwxbxpxfxbs07nmryz1-libzip-1.9.2.drv
  /nix/store/w9g502p59yp1fn2dljmvnnhans3rq9b4-aws-sdk-cpp-1.9.294.drv
...

building '/nix/store/w9g502p59yp1fn2dljmvnnhans3rq9b4-aws-sdk-cpp-1.9.294.drv'...
unpacking sources
unpacking source archive /nix/store/26lg59zjav1irl0znfx5rx3liv47n1r7-source
source root is source
patching sources
applying patch /nix/store/frvfi397b88f6c91p371z5r2940x005p-cmake-dirs.patch
patching file cmake/AWSSDKConfig.cmake
...

building '/nix/store/00dk0qx5vjl9bywy5db593a2dfdzd66f-nix-2.12.0pre20230216_7c91803.drv'...
unpacking sources
unpacking source archive /nix/store/isia7synl0mdbcvfwav5ywnrwmwbwvxv-source
source root is source
...

Version devenv: 0.6.2

domenkozar commented 1 year ago

That's why there's a step (2) in the installation to configure devenv cachix.

khaled commented 1 year ago

@domenkozar I did perform that step, as illustrated in the log I shared :). The source builds of aws-sdk-cpp and nix happen regardless.

darkone23 commented 1 year ago

Also saw this behavior installing last night. Setup cache using cachix use devenv - basic flake sample:


{
  description = "build flake";

  inputs = {

    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";

    devenv.url = "github:cachix/devenv/latest";
    devenv.inputs.nixpkgs.follows = "nixpkgs";

  };

  outputs = { self, nixpkgs, home-manager, devenv, ... }:
    nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [ 
        ./configuration.nix
        {
          environment.systemPackages = [
            devenv.packages.x86_64-linux.devenv
          ];
        }
        home-manager.nixosModules.home-manager
          {
            home-manager.useGlobalPkgs = true;
            home-manager.useUserPackages = true;
            home-manager.users.myuser = import ./home.nix;
          }
      ];
    };

}

built just fine, just had to build from source like described

domenkozar commented 1 year ago

Most likely due to CI failing fast, I've pushed https://github.com/cachix/devenv/commit/47eb4d1f12a9209913a485f9df945c2a404a918a that should address it.

sandydoo commented 1 year ago

@domenkozar, devenv doesn't have builds for aarch64-linux, right? That would explain the build from source. aarch64-darwin should've been cached though, unless this builder isn't aarch64?

@darkone23, what system are you using?

mausch commented 1 year ago

Related: https://github.com/cachix/devenv/issues/575

Nick1296 commented 1 year ago

I can confirm that this happens on aarch64-linux (my raspberrypi) after following both the instruction of #575 and the instructions after cachix use devenv. How do I check if there are cached builds?

domenkozar commented 1 year ago

We'll setup an aarch64-linux builder

domenkozar commented 11 months ago

I've added aarch64-linux builder in https://github.com/cachix/devenv/pull/652

AnhQuanTrl commented 6 months ago

Happens for me as well. I am on x86_64-linux and it try to rebuild everything from source even though cachix is already installed :(

domenkozar commented 6 months ago

Can you paste the output by passing -vvv to nix?

sandydoo commented 5 months ago

@domenkozar, could some of the releases have been GC'd from the cache? We should pin them!

shyim commented 1 month ago

I think this can be closed as we moved to nixpkgs right? @domenkozar