with import <nixpkgs> {};
pkgs.python3Packages.callPackage ./quickwal.nix {}
quickwal.nix
{ lib,
buildPythonApplication,
fetchPypi,
setuptools
}:
buildPythonApplication rec {
pname = "QuickWall";
version = "0.0.5";
src = fetchPypi {
inherit pname version;
sha256 = "1qcayvbcv9jnfkp4q1rpdnlyxhzmg9dsldw8jvkq1f1r6kqpkglz";
};
buildInputs = with import <nixpkgs> {};
[pkgs.python39Packages.dbus-python];
propagatedBuildInputs = [setuptools];
meta = with lib; {
description = "Set latest wallpapers from Unsplash from the commandline";
homepage = "deepjyoti30.github.io/quickwall";
license = licenses.mit;
};
}
When I run nix-build it gives me this:
ERROR: Could not find a version that satisfies the requirement dbus-python (from quickwall) (from versions: none)
ERROR: No matching distribution found for dbus-python
I tried specifying the dependency as a buildInput but that didn’t work.
{ lib,
buildPythonApplication,
fetchPypi,
setuptools
}:
buildPythonApplication rec {
pname = "QuickWall";
version = "0.0.5";
src = fetchPypi {
inherit pname version;
sha256 = "1qcayvbcv9jnfkp4q1rpdnlyxhzmg9dsldw8jvkq1f1r6kqpkglz";
};
propagatedBuildInputs = with import <nixpkgs> {};
[pkgs.python39Packages.dbus-python setuptools];
meta = with lib; {
description = "Set latest wallpapers from Unsplash from the commandline";
homepage = "deepjyoti30.github.io/quickwall";
license = licenses.mit;
};
}
Same error
Executing pipInstallPhase
/build/QuickWall-0.0.5/dist /build/QuickWall-0.0.5
Processing ./QuickWall-0.0.5-py3-none-any.whl
ERROR: Could not find a version that satisfies the requirement dbus-python (from quickwall) (from versions: none)
ERROR: No matching distribution found for dbus-python
Do not use with here, drop importing <nixpkgs>, add dbus-python to the argset and then use the passed in version, to make sure you get the correct one built for and with exactly the python you are using.
As @NobbZ said, you should remove the with import <nixpkgs>.
When doing pkgs.python3Packages.callPackage ./quickwal.nix {} you’ll have the python3Packages namespace (?) at hand and can pick what you need from there.
Otherwise you may intermix python packages from different versions. Atm. python3 == python39, but what if python310 gets aliased to python3?
And by picking dependencies from the argset you’ll be able to change python versions (nearly) at will, i.e. pkgs.python310Packages.callPackage ./quickwal.nix {}.
Adopting the changes quickwall.nix may look like below, which builds. Though, I had to patch setup.py and remove the install_requires argument from setup(). Maybe a real nix-python-pro-packager could enlighten us, why this is necessary?
{ lib
, buildPythonPackage
, fetchPypi
, beautifulsoup4
, dbus-python
, downloader-cli
, pywal
, requests
, simber
}:
buildPythonPackage rec {
pname = "QuickWall";
version = "0.0.5";
src = fetchPypi {
inherit pname version;
sha256 = "1qcayvbcv9jnfkp4q1rpdnlyxhzmg9dsldw8jvkq1f1r6kqpkglz";
};
propagatedBuildInputs = [
beautifulsoup4
dbus-python
downloader-cli
pywal
requests
simber
];
# XXX: Remove install_requires from setup(), as it triggers:
# Processing ./QuickWall-0.0.5-py3-none-any.whl
# ERROR: Could not find a version that satisfies the requirement dbus-python (from quickwall) (from versions: none)
# ERROR: No matching distribution found for dbus-python
patchPhase = "sed -i '/install_requires/d' setup.py";
# Need to disable checks. There're no tests atm, causing the build to fail.
doCheck = false;
meta = with lib; {
description = "Set latest wallpapers from Unsplash from the commandline";
homepage = "deepjyoti30.github.io/quickwall";
license = licenses.mit;
};
}