nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
388 stars 36 forks source link

Stack derivation fails to evaluate in NixOS 23.11 #124

Closed jonathanlking closed 7 months ago

jonathanlking commented 7 months ago

With nixos-23.11, running

nix path-info --derivation --impure --expr '(import ~/github/static-haskell-nix/survey/default.nix { normalPkgs = (import ~/github/nixpkgs/default.nix {}); }).haskellPackages.stack'

we get:

error: infinite recursion encountered

       at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:402:7:

          401|       depsHostHostPropagated      = elemAt (elemAt propagatedDependencies 1) 0;
          402|       propagatedBuildInputs       = elemAt (elemAt propagatedDependencies 1) 1;
             |       ^
          403|       depsTargetTargetPropagated  = elemAt (elemAt propagatedDependencies 2) 0;
--show-trace error: … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'stack-2.13.1' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'buildInputs' of the derivation 'aeson-2.1.2.1' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'buildInputs' of the derivation 'attoparsec-0.14.4' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'buildInputs' of the derivation 'scientific-0.3.7.0' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'smallcheck-1.2.1.1' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'buildInputs' of the derivation 'logict-0.8.0.0' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'async-2.2.4' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'hashable-1.4.3.0' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'buildInputs' of the derivation 'data-array-byte-0.1.0.1' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'tasty-1.4.3' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'optparse-applicative-0.18.1.0' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'buildInputs' of the derivation 'prettyprinter-ansi-terminal-1.1.3' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'buildInputs' of the derivation 'doctest-0.20.1' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'hspec-2.10.10' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'hspec-core-2.10.10' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'tf-random-0.5' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'primitive-0.8.0.0' at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:348:7: 347| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 348| name = | ^ 349| let error: infinite recursion encountered at /home/jonathan/github/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:402:7: 401| depsHostHostPropagated = elemAt (elemAt propagatedDependencies 1) 0; 402| propagatedBuildInputs = elemAt (elemAt propagatedDependencies 1) 1; | ^ 403| depsTargetTargetPropagated = elemAt (elemAt propagatedDependencies 2) 0;

Running a git bisect, the first bad commit is https://github.com/NixOS/nixpkgs/commit/691a877730c2a5fc8831503efce24b447369f21c.

To get the bisect to run, I needed to comment out the zstd override, as that change was only upstreamed just before the 23.11 release. I'm very confident this makes no difference.

-    zstd = previous.zstd.override { enableStatic = true; };
+    # zstd = previous.zstd.override { enableStatic = true; };
jonathanlking commented 7 months ago

From splitting up the overlays into isolated changes, I believe overriding haskellPackages is relevant, as the package set after this is the first to give the infinite recursion error. https://github.com/nh2/static-haskell-nix/blob/88f1e2d57e3f4cd6d980eb3d8f99d5e60040ad54/survey/default.nix#L875-L882 https://github.com/nh2/static-haskell-nix/blob/88f1e2d57e3f4cd6d980eb3d8f99d5e60040ad54/survey/default.nix#L925

jonathanlking commented 7 months ago

I'm very confused as I can no longer reproduce this, even with https://github.com/NixOS/nixpkgs/commit/691a877730c2a5fc8831503efce24b447369f21c.