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