Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Lorri misbehaves when the shell has disallowedReferences #489

Open
michaelpj opened this issue Jan 21, 2021 · 0 comments
Open

Lorri misbehaves when the shell has disallowedReferences #489

michaelpj opened this issue Jan 21, 2021 · 0 comments

Comments

@michaelpj
Copy link

Describe the bug
lorri fails in some cases if the shell derivation uses disallowedReferences or disallowedRequisites. This can be useful as a safety guard to avoid e.g. situations where your shell depends on building too much stuff (happened to me at work!).

To Reproduce
Steps to reproduce the behavior:

{ pkgs ? (import <nixpkgs> {}) }:
pkgs.mkShell {
  buildInputs = [ pkgs.hello ];
  disallowedReferences = [ pkgs.hello ];
  # so you can nix-build this file and check that it's okay
  nobuildPhase = ''touch $out'';
}

Observe:

  • nix-build shell.nix is fine
  • lorri will fail with logs: [LogLine("these derivations will be built:"), LogLine(" /nix/store/w23dsh466vh9clalnd0mc8hsgxli5gj8-lorri-keep-env-hack-nix-shell.drv"), LogLine("building \'/nix/store/w23dsh466vh9clalnd0mc8hsgxli5gj8-lorri-keep-env-hack-nix-shell.drv\'..."), LogLine("output \'/nix/store/mggmmwyrpkywaavix36l0il7mcfcvsxg-lorri-keep-env-hack-nix-shell\' is not allowed to refer to the following paths:"), LogLine(" /nix/store/8a6lbpbxbc5lc60ljwhw69sszr25ys5f-hello-2.10"), LogLine("error: build of \'/nix/store/w23dsh466vh9clalnd0mc8hsgxli5gj8-lorri-keep-env-hack-nix-shell.drv\' failed")]

Expected behavior
lorri does not fail if the normal use of the shell.nix does not fail.

Additional context
I'm pretty sure the problem is here:

drv.drvAttrs // {

This keeps all the drv attributes but messes with the inputs, thus making disallowedReferences and disallowedRequisites do the wrong thing. A simple fix would probably be to just strip those attributes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant