cachix / devenv

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

build failure on `boehm-gc` dependency #1200

Closed becknik closed 2 weeks ago

becknik commented 2 weeks ago

Describe the bug After updating to nixpkgs-unstable rev 2057814051972fa1453ddfb0d98badbea9b83c06 and devenv to 725c90407ef53cc2a1b53701c6d2d0745cf2484f, I'm getting the following error on the boehm-gc dependency of devenv:

@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/1knirm8jgazkcgnrv72bajb3vlg039wd-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
applying patch /nix/store/bj54wqjwik55hpiq7kgdi4j6wcw07hza-boehmgc-traceable_allocator-public.diff
patching file include/gc_allocator.h
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file include/gc_allocator.h.rej

The build graph looks as follows:

┃          │     ┌─ ⏵ aws-sdk-cpp-1.11.318 (buildPhase) ⏱ 3m23s
┃          │     ├─ ⚠ boehm-gc-8.2.6 failed with exit code 1 after ⏱ 0s in patchPhase
┃          │  ┌─ ⏸ nix-devenv-2.21.0pre20240412_b24a931
┃          ├─ ⏸ devenv-1.0.5
┃       ┌─ ⏸ home-manager-path
┃    ┌─ ⏸ user-environment
┃ ┌─ ⏸ etc
┃ ⏸ nixos-system-dnix-23.11.20240512.44072e2
plain build stdout log ``` boehm-gc> Running phase: unpackPhase boehm-gc> unpacking source archive /nix/store/1knirm8jgazkcgnrv72bajb3vlg039wd-source boehm-gc> source root is source boehm-gc> Running phase: patchPhase boehm-gc> applying patch /nix/store/bj54wqjwik55hpiq7kgdi4j6wcw07hza-boehmgc-traceable_allocator-public.diff boehm-gc> patching file include/gc_allocator.h boehm-gc> Reversed (or previously applied) patch detected! Assume -R? [n] boehm-gc> Apply anyway? [n] boehm-gc> Skipping patch. boehm-gc> 1 out of 1 hunk ignored -- saving rejects to file include/gc_allocator.h.rej error: builder for '/nix/store/mfww4xn2z7xxbzq65fyh746lp0ygr1if-boehm-gc-8.2.6.drv' failed with exit code 1; last 10 log lines: > Running phase: unpackPhase > unpacking source archive /nix/store/1knirm8jgazkcgnrv72bajb3vlg039wd-source > source root is source > Running phase: patchPhase > applying patch /nix/store/bj54wqjwik55hpiq7kgdi4j6wcw07hza-boehmgc-traceable_allocator-public.diff > patching file include/gc_allocator.h > Reversed (or previously applied) patch detected! Assume -R? [n] > Apply anyway? [n] > Skipping patch. > 1 out of 1 hunk ignored -- saving rejects to file include/gc_allocator.h.rej For full logs, run 'nix log /nix/store/mfww4xn2z7xxbzq65fyh746lp0ygr1if-boehm-gc-8.2.6.drv'. error: 1 dependencies of derivation '/nix/store/wbdz3sd0d1nna5qfzjfqyspx4f443i6g-nix-devenv-2.21.0pre20240412_b24a931.drv' failed to build copying path '/nix/store/zd4r977fl0rvqk8v60dxxarrc4i6k274-pulseaudio-16.1' from 'https://cache.nixos.org' boost-build> building '/nix/store/pkia93aggaapyhza67rs0gwi30g9hbzc-boost-build-boost-1.81.0.drv' boost-build> building '/nix/store/vzqgc8mj950c6mkvbr6k7scl4acyfa0b-boost-build-boost-1.82.0.drv' error: 1 dependencies of derivation '/nix/store/bydfkfka1qd037gnwk8hpq8vf4ly11s8-devenv-1.0.5.drv' failed to build copying path '/nix/store/gzglwcl6msj1zdm322x7qp4lvg9hili3-python3.11-dbus-python-1.2.18' from 'https://cache.nixos.org' copying path '/nix/store/ykmfm7frgil5ag1p1l3p70xl19k7jww8-python3.11-pyqt5-sip-12.11.0' from 'https://cache.nixos.org' copying path '/nix/store/zisi0aqbrc63wwqmf25qmhzd6q1x5k0x-samba-4.19.2' from 'https://cache.nixos.org' copying path '/nix/store/0d8804xpq8hjd1i0i1mw3m37jwvm9n8k-python3.11-dbus-python-1.2.18' from 'https://cache.nixos.org' copying path '/nix/store/h8jsqbn5bpci7v8gaxy7hrp2xc0s804v-qtbase-5.15.12' from 'https://cache.nixos.org' copying path '/nix/store/nzvanqgxa0hlspakkjgzh2p0xi0w9z4g-qtbase-5.15.12' from 'https://cache.nixos.org' copying path '/nix/store/6l4g8wj0fyd0hxjpdwnbk76yl4ibb60q-sox-unstable-2021-05-09-lib' from 'https://cache.nixos.org' copying path '/nix/store/g28hpdvbf38wvf1znnf7bcwp864vv54n-stdenv-linux' from 'https://cache.nixos.org' copying path '/nix/store/wqxwlrph8w9qx6qdj91q3s46b5i2vx2g-stoken-0.93' from 'https://cache.nixos.org' error: 1 dependencies of derivation '/nix/store/rag8l24wwfkj2f9rplbcsblwkz4izwva-home-manager-path.drv' failed to build builder.pl> building '/nix/store/6m2bh2f866z1m3yvalv3x7zvp5r3j57y-builder.pl.drv' error: 1 dependencies of derivation '/nix/store/rqhhjrd920vb9m9vg1rbjwfbi0aigzn8-home-manager-generation.drv' failed to build error: 1 dependencies of derivation '/nix/store/nh3xk80pq5bx5rvy2yxk5x51am40gp9k-user-environment.drv' failed to build error: 1 dependencies of derivation '/nix/store/qjm8wda0q52qsz74pxmzchsn7y7djl4q-etc.drv' failed to build error: 1 dependencies of derivation '/nix/store/rbyhimkjjn8sxpzsa21a5i2smmxwwxk5-nixos-system-dnix-23.11.20240512.44072e2.drv' failed to build ```

To reproduce

My flake looks something like the following. Also, I have devenv installed with home-manager home.packages. My config: becknik/dotfiles.nix

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";

    nixos-hardware.url = "github:NixOS/nixos-hardware/master";
    disko = {
      url = "github:nix-community/disko";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    devenv = {
      url = "github:cachix/devenv";
      inputs.nixpkgs.follows = "nixpkgs-unstable"; # requires > rustc-1.74.0
    };
    # --snip--
  };

  outputs = { ... }@inputs: let
    let
      systems = [ "x86_64-darwin" "x86_64-linux" ];
      forAllSystems = nixpkgs.lib.genAttrs systems;
    in {
    # --snip--
      devShell = forAllSystems
        (system:
          let
            pkgs = nixpkgs.legacyPackages.${system};
          in
          inputs.devenv.lib.mkShell {
            inherit inputs pkgs;
            modules = [
              ({ pkgs, config, ... }: {
                # https://devenv.sh/guides/using-with-flakes/
                # https://devenv.sh/reference/options/
                # https://github.com/expipiplus1/update-nix-fetchgit
                packages = [ pkgs.update-nix-fetchgit ];

                languages.nix.enable = true;

                pre-commit.hooks = {
                  nixpkgs-fmt.enable = true;
                };

                scripts.update-fetchgit.exec = "update-nix-fetchgit $DEVENV_ROOT/overlays/modifications.nix";
              })
            ];
          }
        );
    };
}

Version

Paste the output of $ devenv version here or tell us if you're using flakes.

domenkozar commented 2 weeks ago

See https://github.com/NixOS/nixpkgs/pull/306036

becknik commented 2 weeks ago

I know that this isn't really a problem caused by devenv, but do you have a clue why this issue persist for my devenv build event tho I set devenv.inputs.nixpkgs.follows = "nixpkgs-unstable";? This is really confusing to me...

luxus commented 2 weeks ago

I have the same issue @becknik You are not alone :)

sandydoo commented 2 weeks ago

but do you have a clue why this issue persist for my devenv build event tho I set devenv.inputs.nixpkgs.follows = "nixpkgs-unstable";?

devenv uses a custom build of Nix nix-devenv. Looks like it follows the nixpkgs input.

luxus commented 2 weeks ago

but that still means that it fails under unstable or why does it work with using , devenv

sandydoo commented 1 week ago

@luxus, the boehm patch is still being applied in the flake build of nix. When you set devenv to follow unstable, the nix derivation tries to patch a newer version of boehm and fails.

nixpkgs has its own derivation for nix, where this patch was removed. The nixpkgs version of devenv reuses that.