Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

error: value is a string while a set was expected #6

@elmarsto

Description

@elmarsto

When, in an overlay, I attempt:

    (final: prev: {
      python39Packages = prev.python39Packages // {
        dte = final.python39.pkgs.buildPythonPackage rec {
          pname = "dte";
          version = "0.2.7";
          src = fetchPypi "dte" "0.2.7";
          doCheck = false;
          meta = with pkgs.lib; {
            description = "Date Time Expressions";
            homepage = "https://github.com/mvrozanti/dte";
          };
        };
      };
    })

I get

error: attribute 'dte' missing

       at /nix/store/jk1474syhbvaj8ccch1spjav8hhm6r2y-nix-pypi-fetcher/default.nix:12:56:

           11|   pkgs.fetchurl {
           12|     url = "https://files.pythonhosted.org/packages/" + pypi-sources."${pkg_name}"."${version}"."url";
             |                                                        ^
           13|     sha256 = pypi-sources."${pkg_name}"."${version}"."sha256";

My best guess is that the version of nix-pypi-fetcher I was pulling in did not yet know about dte.

This would in turn mean that the solution would be to pull in a more recent nix-pypi-fetcher.

So, I modified this code from your README.md:

  commit =   "73de0e330fd611769c192e98c11afc2d846d822b";
  fetchPypi = import (builtins.fetchTarball {
    name = "nix-pypi-fetcher";
    url = "https://github.com/DavHau/nix-pypi-fetcher/tarball/${commit}";
    # Hash obtained using `nix-prefetch-url --unpack <url>`
    sha256 = "1c06574aznhkzvricgy5xbkyfs33kpln7fb41h8ijhib60nharnp";
  });

With the following changes (based on current rev)

url = "https://github.com/DavHau/nix-pypi-fetcher/tarball/51dda5dbb2bb57bc9ad61ed47b5270b458791ec3"; # no need for a commit variable
sha256 = "1vqzw87hpfah2hg8qlyzrm9xi43360gqj7qjr47c0ggjqkjn1i27";

And I got a different error:

error: value is a string while a set was expected

       at /tenebrae/code/mine/lattice-nix/home-manager/dev.nix:98:17:

           97|           version = "0.2.7";
           98|           src = fetchPypi "dte" "0.2.7";
             |                 ^
           99|           doCheck = false;

I'm relatively new to NixOS, but I think what this new error message is trying to say is that the function fetchPypi was expecting a set as argument for the parameter in position 1.

In other words, I think that the API for fetchPypi changed at some point, but that the change is not yet documented in the README.md.

  1. is this analysis correct? I'm not yet Nix Enough to know.
  2. If so, could you please update the README.md with a fresh example of calling fetchPypi?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions