NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.94k stars 1.53k forks source link

`nix profile upgrade` does not respect `submodules=1` #6788

Open Atry opened 2 years ago

Atry commented 2 years ago

Describe the bug

I added a Nix Flake to HHVM, which requires submodules=1 to build. I can use nix profile install to install the Flake with submodules=1. However nix profile upgrade does not respect submodules=1 and results in build failures.

Steps To Reproduce

  1. Install Nix on macOS
  2. Execute the following command
    (
    sudo tee -a /etc/nix/nix.conf <<EOF
    extra-experimental-features = nix-command flakes
    extra-substituters = s3://hhvm-nix-cache?region=us-west-2&endpoint=hhvm-nix-cache.s3-accelerate.amazonaws.com
    extra-trusted-substituters = s3://hhvm-nix-cache?region=us-west-2&endpoint=hhvm-nix-cache.s3-accelerate.amazonaws.com
    extra-trusted-public-keys = hhvm-nix-cache-1:MvKxscw16fAq6835oG8sbRgTGITb+1xGfYNhs+ee4yo=
    sandbox = false
    EOF
    ) &&
    sudo launchctl remove org.nixos.nix-daemon && 
    sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist &&
    sleep 3 &&
    nix profile install 'git+https://github.com/facebook/hhvm.git?submodules=1&shallow=1&ref=refs/tags/nightly-2022.07.08' &&
    nix profile upgrade '.*'

Then nix profile upgrade '.*' would fail because the git submodules are not actually checked out.

[1/0/1 built, 0.0 MiB DL] building hhvm_nightly-4.164.0-20220708015935 (configurePhase): See also "/tmp/nix-build-hhvm_nightly-4.164.0-20220708015935.drv-0/0r3dkq3k0hscxysmxfhgyi6arc4ld26v-source/build/CMakeFiles/CMakeError.log".
error: builder for '/nix/store/4n9lcf0lkanbsh8hlhk0g5d2dxx5g4s4-hhvm_nightly-4.164.0-20220708015935.drv' failed with exit code 1;
       last 10 log lines:
       >   Policy CMP0076 is not set: target_sources() command converts relative paths
       >   to absolute.  Run "cmake --help-policy CMP0076" for policy details.  Use
       >   the cmake_policy command to set the policy and suppress this warning.
       >
       >   An interface source of target "hhvm" has a relative path.
       > This warning is for project developers.  Use -Wno-dev to suppress it.
       > 
       > -- Configuring incomplete, errors occurred!
       > See also "/tmp/nix-build-hhvm_nightly-4.164.0-20220708015935.drv-0/0r3dkq3k0hscxysmxfhgyi6arc4ld26v-source/build/CMakeFiles/CMakeOutput.log".
       > See also "/tmp/nix-build-hhvm_nightly-4.164.0-20220708015935.drv-0/0r3dkq3k0hscxysmxfhgyi6arc4ld26v-source/build/CMakeFiles/CMakeError.log".
       For full logs, run 'nix log /nix/store/4n9lcf0lkanbsh8hlhk0g5d2dxx5g4s4-hhvm_nightly-4.164.0-20220708015935.drv'.

Expected behavior

No error

nix-env --version output

nix-env (Nix) 2.8.0

Additional context This bug can be reproduced in both macOS and Linux.

I cannot see submodules=1 from nix profile list even when I previously executed nix profile install with submodules=1

nix profile list
0 git+https://github.com/facebook/hhvm.git?ref=refs%2ftags%2fnightly-2022.07.08&shallow=1#packages.x86_64-darwin.default git+https://github.com/facebook/hhvm.git?ref=refs%2ftags%2fnightly-2022.07.08&rev=66561fe5a363575844b511a1a8955dedbf053ef0&shallow=1#packages.x86_64-darwin.default /nix/store/41k3gr00brjnw1xjsgkd6fr1bhlglp0m-hhvm_nightly-4.164.0-20220708015935
winterqt commented 7 months ago

Not stale, see above dupe issue from two days ago.