14 python = python3.override {
15 packageOverrides = self: super: {
16 pydantic-yaml = super.pydantic-yaml.overridePythonAttrs (old: rec {
18 src = fetchFromGitHub {
19 owner = "NowanIlfideme";
20 repo = "pydantic-yaml";
21 rev = "refs/tags/v${version}";
22 hash = "sha256-AeUyVav0/k4Fz69Qizn4hcJKoi/CDR9eUan/nJhWsDY=";
24 dependencies = with self; [
35 python.pkgs.buildPythonApplication rec {
41 src = fetchFromGitHub {
44 rev = "refs/tags/${version}";
45 hash = "sha256-cdRlUY9hAJ8US93aiJymzsV27JVPY7lWCK7IUdjDmYE=";
49 # Snapcraft is only officially distributed as a snap, as is LXD. The socket
50 # path for LXD must be adjusted so that it's at the correct location for LXD
51 # on NixOS. This patch will likely never be accepted upstream.
52 ./lxd-socket-path.patch
53 # In certain places, Snapcraft expects an /etc/os-release file to determine
54 # host info which doesn't exist in our test environment. This is a
55 # relatively naive patch which helps the test suite pass - without it *many*
56 # of the tests fail. This patch will likely never be accepted upstream.
58 # Snapcraft will try to inject itself as a snap *from the host system* into
59 # the build system. This patch short-circuits that logic and ensures that
60 # Snapcraft is installed on the build system from the snap store - because
61 # there is no snapd on NixOS hosts that can be used for the injection. This
62 # patch will likely never be accepted upstream.
63 ./set-channel-for-nix.patch
64 # Certain paths (for extensions, schemas) are packaged in the snap by the
65 # upstream, so the paths are well-known, except here where Snapcraft is
66 # *not* in a snap, so this patch changes those paths to point to the correct
67 # place in the Nix store. This patch will likely never be accepted upstream.
68 ./snapcraft-data-dirs.patch
72 substituteInPlace setup.py \
73 --replace-fail 'version=determine_version()' 'version="${version}"' \
74 --replace-fail 'gnupg' 'python-gnupg'
76 substituteInPlace requirements.txt \
77 --replace-fail 'gnupg==2.3.1' 'python-gnupg'
79 substituteInPlace snapcraft/__init__.py \
80 --replace-fail '__version__ = _get_version()' '__version__ = "${version}"'
82 substituteInPlace snapcraft_legacy/__init__.py \
83 --replace-fail '__version__ = _get_version()' '__version__ = "${version}"'
85 substituteInPlace snapcraft/elf/elf_utils.py \
86 --replace-fail 'arch_linker_path = Path(arch_config.dynamic_linker)' \
87 'return str(Path("${glibc}/lib/ld-linux-x86-64.so.2"))'
89 substituteInPlace pyproject.toml \
90 --replace-fail '"pytest-cov>=4.0",' "" \
91 --replace-fail "--cov=snapcraft" ""
94 nativeBuildInputs = [ makeWrapper ];
96 dependencies = with python.pkgs; [
139 build-system = with python.pkgs; [ setuptools ];
150 wrapProgram $out/bin/snapcraft --prefix PATH : ${squashfsTools}/bin
170 export HOME="$(pwd)/check-phase"
173 pytestFlagsArray = [ "tests/unit" ];
177 "test_classic_linter_filter"
178 "test_classic_linter"
179 "test_complex_snap_yaml"
180 "test_core24_try_command"
181 "test_get_base_configuration_snap_channel"
182 "test_get_base_configuration_snap_instance_name_default"
183 "test_get_base_configuration_snap_instance_name_not_running_as_snap"
184 "test_get_extensions_data_dir"
185 "test_get_os_platform_alternative_formats"
186 "test_get_os_platform_linux"
187 "test_get_os_platform_windows"
188 "test_lifecycle_pack_components_with_output"
189 "test_lifecycle_pack_components"
190 "test_lifecycle_write_component_metadata"
191 "test_parse_info_integrated"
193 "test_remote_builder_init"
194 "test_setup_assets_remote_icon"
195 "test_snap_command_fallback"
196 "test_validate_architectures_supported"
197 "test_validate_architectures_unsupported"
198 ] ++ lib.optionals stdenv.isAarch64 [ "test_load_project" ];
200 disabledTestPaths = [
201 "tests/unit/commands/test_remote.py"
203 "tests/unit/linters/test_classic_linter.py"
204 "tests/unit/linters/test_library_linter.py"
205 "tests/unit/parts/test_parts.py"
206 "tests/unit/services"
209 passthru.updateScript = nix-update-script { };
212 mainProgram = "snapcraft";
213 description = "Build and publish Snap packages";
214 homepage = "https://github.com/canonical/snapcraft";
215 changelog = "https://github.com/canonical/snapcraft/releases/tag/${version}";
216 license = lib.licenses.gpl3Only;
217 maintainers = with lib.maintainers; [ jnsgruk ];
218 platforms = lib.platforms.linux;