Skip to content

Comments

Revert "nixos/documentation: avoid copying nixpkgs subpaths"#153592

Merged
roberth merged 1 commit intoNixOS:masterfrom
kraem:kraem/revert_1511e72
Jan 5, 2022
Merged

Revert "nixos/documentation: avoid copying nixpkgs subpaths"#153592
roberth merged 1 commit intoNixOS:masterfrom
kraem:kraem/revert_1511e72

Conversation

@kraem
Copy link
Member

@kraem kraem commented Jan 5, 2022

This reverts commit 1511e72 (part of #149532)

Motivation for this change

builtins.storePath is not allowed in pure evaluation mode and breaks systems built with flakes unfortunately

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

builtins.storePath is not allowed in pure evaluation mode

This reverts commit 1511e72.
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jan 5, 2022
@kraem kraem requested a review from pennae January 5, 2022 11:47
@pennae pennae requested a review from roberth January 5, 2022 11:49
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 5, 2022
Copy link
Contributor

@pennae pennae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed broken with pure flakes. would be nice to have this functionality, but no idea how to keep it. threading nixpkgs through the flakes machinery into here probably wouldn't help much either. @roberth any ideas? 🙁

@roberth
Copy link
Member

roberth commented Jan 5, 2022

I've tested this with pure and restricted mode. It's probably a difference between Nix versions then.
Anyway, I think it's possible to do it by complicating the wiring, but let's merge this first.

@pennae
Copy link
Contributor

pennae commented Jan 5, 2022

we've just retested with nix 2.4, 2.5.1, and 2.6.0pre20211217_6e6e998. all of them fail with the same error:

error: 'builtins.storePath' is not allowed in pure evaluation mode

       at /nix/store/zzh8c75c5bvivyh5lpfivmd472spx0vb-source/nixos/modules/misc/documentation.nix:72:19:

           71|           if isStorePath pkgs.path
           72|           then "${builtins.storePath pkgs.path}/${dir}"
             |                   ^
           73|           else filter "${toString pkgs.path}/${dir}";

very strange :(

@roberth
Copy link
Member

roberth commented Jan 5, 2022

nix repl has a bug. Will test on master and write a nix issue.

$ nix repl --option pure-eval true
Welcome to Nix 2.4. Type :? for help.

nix-repl> builtins.storePath /nix/store/90y23lrznwmkdnczk1dzdsq4m35zj8ww-bash-interactive-5.1-p8/bin/bash
"/nix/store/90y23lrznwmkdnczk1dzdsq4m35zj8ww-bash-interactive-5.1-p8/bin/bash"


$ nix-instantiate --option pure-eval true --expr --eval 'builtins.storePath /nix/store/90y23lrznwmkdnczk1dzdsq4m35zj8ww-bash-interactive-5.1-p8/bin/bash'
error: 'builtins.storePath' is not allowed in pure evaluation mode

       at «string»:1:1:

            1| builtins.storePath /nix/store/90y23lrznwmkdnczk1dzdsq4m35zj8ww-bash-interactive-5.1-p8/bin/bash
             | ^

@roberth
Copy link
Member

roberth commented Jan 5, 2022

So without the builtins.storePath call, using pkgs.path directly, this should "just work", but copy the path unnecessarily. That's actually an orthogonal problem that applies to all usages of pkgs.path and should be solved independently for all of Nixpkgs.

@roberth
Copy link
Member

roberth commented Jan 5, 2022

Here's my attempt #153594. Seems to work for flakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants