Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect warning for "contains the path expression ... which may point outside the directory of that package" #113

Open
Mic92 opened this issue Sep 24, 2024 · 0 comments

Comments

@Mic92
Copy link
Member

Mic92 commented Sep 24, 2024

In this pull request: NixOS/nixpkgs#344127

With the following nix-shell:

{                                   
  pkgs ? import ../../../.. { },    
}:                                  
pkgs.switch-to-configuration-ng

in pkgs/by-name/sw/switch-to-configuration-ng, I get:

 if result/bin/nixpkgs-vet --base "$base" .; then
    exit 0
  else
    exitCode=$?
    echo "To run locally: ./ci/nixpkgs-vet.sh $GITHUB_BASE_REF https://github.com/$GITHUB_REPOSITORY.git"
    echo "If you're having trouble, ping @NixOS/nixpkgs-vet"
    exit "$exitCode"
  fi
  shell: /usr/bin/bash -e {0}
  env:
    mergedSha: ed7535a632177a6c51f0011a40445af80c0c1d2e
    base: /tmp/tmp.oS66tb8QYG
    TMPDIR: /home/runner/work/_temp
    CLICOLOR_FORCE: 1
- pkgs/by-name/sw/switch-to-configuration-ng: File shell.nix at line 2 contains the path expression "../../../.." which may point outside the directory of that package.
  This is undesirable because it creates dependencies between internal paths, making it harder to reorganise Nixpkgs in the future.
  Alternatives include:
  - If you are creating a new version of a package with a common file between versions, consider following the recommendation in https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name#recommendation-for-new-packages-with-multiple-versions.
  - If the path being referenced could be considered a stable interface with multiple uses, consider exposing it via a `pkgs` attribute, then taking it as a attribute argument in package.nix.
  - If the path being referenced is internal and has multiple uses, consider passing the file as an explicit `callPackage` argument in `pkgs/top-level/all-packages.nix`.
  - If the path being referenced is internal and will need to be modified independently of the original, consider copying it into the pkgs/by-name/sw/switch-to-configuration-ng directory.

The nix-shell points to the toplevel of nixpkgs, so it should not produce this error.

@Mic92 Mic92 changed the title Incorrect warning for contains the path expression "../../../.." which may point outside the directory of that package. Incorrect warning for "contains the path expression ... which may point outside the directory of that package" Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant