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

nixpkgs-check-by-name fails for poetry2nix.mkPoetryApplication packages created in pkgs/by-name/ #261052

Closed
ghost opened this issue Oct 14, 2023 · 3 comments
Labels
0.kind: bug Something is broken

Comments

@ghost
Copy link

ghost commented Oct 14, 2023

Describe the bug

Packages created under pkgs/by-name/... using the poetry2nix.mkPoetryApplication builder fail the nixpkgs-check-by-name test because the corresponding drv file does not exist in /nix/store.

Full Trace

First and last frames in the trace.

error:
       … while evaluating the attribute 'testfails'

         at /home/rdevm/src/nixpkgs/nix.0/pkgs/test/nixpkgs-check-by-name/src/eval.nix:77:5:

           76|     inherit name;
           77|     value = attrInfo name;
             |     ^
           78|   }) attrs);
[...]
       … while calling 'readTOML'

         at /home/rdevm/src/nixpkgs/nix.0/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix:78:14:

           77|     );
           78|   readTOML = path: fromTOML (builtins.readFile path);
             |              ^
           79|

       error: path '/nix/store/2vvz5866f1ljc547rfbqj8xvsr2pxg6p-source.drv' is not valid

Steps To Reproduce

running the bash script below in the nixpkgs source root creates a skeleton package in pkgs/by-name/te/testfails and then evaluates pkgs/test/nixpkgs-check-by-name/src/eval.nix to generate the failure.

#!/usr/bin/env bash

set -ex

# nixpkgs source root.
nixpkgs="$(realpath "${nixpkgs:-$PWD}")"
# a file we can clobber.
attrsPath="$(realpath "${attrsPath:-attrsPath.json}")"
# name of package to create.
pname=${pname:-testfails}


pdir="${nixpkgs}"/pkgs/by-name/${pname:0:2}/${pname}

echo "[\"${pname}\"]" > "${attrsPath}"

mkdir -p "${pdir}"
cat > "${pdir}"/package.nix <<NIX
{ lib, poetry2nix, fetchFromGitHub }:

poetry2nix.mkPoetryApplication rec {
  pname = "${pname}";
  version = "0.1";
  projectDir = src;

  src = fetchFromGitHub {
    owner = "owner";
    repo = "repo";
    rev = "v\${version}";
    hash = "";
  };
}
NIX
nix-instantiate --eval --strict --readonly-mode --show-trace \
	--arg attrsPath "${attrsPath}" -I "${attrsPath}" \
	--arg nixpkgsPath "${nixpkgs}" -I "${nixpkgs}" \
	"${nixpkgs}"/pkgs/test/nixpkgs-check-by-name/src/eval.nix

Note: the nix-instantiate command was extracted from running nixpkgs-check-by-name

nix-build -A tests.nixpkgs-check-by-name
./result/bin/nixpkgs-check-by-name .

Expected behavior

expect the evaluation to succeed and return

{ testfails = { is_derivation = true; variant = { AutoCalled = null; }; }; }

Notify maintainers

@infinisil
@adisbladis
@jbaum98

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
  /nix/store/fyvbj5mvrvdnvhbx6hc977wsgl33pk3i-nix-info
copying path '/nix/store/fyvbj5mvrvdnvhbx6hc977wsgl33pk3i-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.2.0-34-generic, Ubuntu, 22.04.3 LTS (Jammy Jellyfish), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - channels(rdm): `"nixpkgs"`
 - channels(root): `"nixpkgs"`
 - channels(rob): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
$ git log -1
commit c2676d1f74b0ed5149e9b258fdf6a0a82057562e (HEAD -> master, upstream/master)
Merge: fbc9711e91bf 2e6ff5cb300a
Author: Weijia Wang <[email protected]>
Date:   Fri Oct 13 18:56:23 2023 +0200

    Merge pull request NixOS/nixpkgs#260891 from lovesegfault/nix-your-shell-mainProgram
    
    nix-your-shell: set meta.mainProgram
@ghost ghost added the 0.kind: bug Something is broken label Oct 14, 2023
@ghost ghost mentioned this issue Oct 14, 2023
12 tasks
@ghost
Copy link
Author

ghost commented Oct 14, 2023

poetry2nix inside nixpkgs appears to be unsupported. closing.

@infinisil
Copy link
Member

Thanks for the nice report regardless! The error message is really rather poor though, this should be improved. I opened NixOS/nixpkgs-vet#4 to track this

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixpkgs-architecture-team-conclusion-and-prospective/41020/7

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants