21 buildPythonPackage rec {
22 pname = "craft-providers";
27 src = fetchFromGitHub {
29 repo = "craft-providers";
30 rev = "refs/tags/${version}";
31 hash = "sha256-f+0AEoVUFL/+v4sRYirc6OD5dYH4dlLk8h7im+CLuhM=";
35 # This lib will try to inject snaps *from the host system* into the build
36 # system. This patch short-circuits that logic and ensures that snaps are
37 # installed on the build system from the snap store - because there is no
38 # snapd on NixOS hosts that can be used for the injection. This patch will
39 # likely never be accepted upstream.
44 substituteInPlace craft_providers/lxd/installer.py \
45 --replace-fail "/var/snap/lxd/common/lxd/unix.socket" "/var/lib/lxd/unix.socket"
47 substituteInPlace craft_providers/__init__.py \
48 --replace-fail "dev" "${version}"
50 # The urllib3 incompat: https://github.com/msabramo/requests-unixsocket/pull/69
51 # This is already patched in nixpkgs.
52 substituteInPlace pyproject.toml \
53 --replace-fail "setuptools==73.0.1" "setuptools"
56 pythonRelaxDeps = [ "requests" ];
58 build-system = [ setuptools-scm ];
68 pythonImportsCheck = [ "craft_providers" ];
82 export HOME="$(pwd)/check-phase"
85 pytestFlagsArray = [ "tests/unit" ];
88 # Relies upon "logassert" python package which isn't in nixpkgs
89 "tests/unit/bases/test_ubuntu_buildd.py"
90 "tests/unit/bases/test_centos_7.py"
91 "tests/unit/bases/test_almalinux.py"
92 "tests/unit/actions/test_snap_installer.py"
93 # Relies upon "pytest-time" python package which isn't in nixpkgs
94 "tests/unit/multipass"
96 "tests/unit/test_base.py"
97 "tests/unit/util/test_retry.py"
100 passthru.updateScript = nix-update-script { };
103 description = "Interfaces for instantiating and controlling a variety of build environments";
104 homepage = "https://github.com/canonical/craft-providers";
105 changelog = "https://github.com/canonical/craft-providers/releases/tag/${version}";
106 license = lib.licenses.lgpl3Only;
107 maintainers = with lib.maintainers; [ jnsgruk ];
108 platforms = lib.platforms.linux;