From 2bd9b7d670d8c78ddf5ad47a6716d5199e7daa7e Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Wed, 28 Jan 2026 02:16:43 +0000 Subject: [PATCH] silver-platter: build the Rust portion rather than the Python bindings At the moment this package just builds the Python bindings, which isn't as useful as building the Rust binary. I'll package the Python bindings up separately. --- pkgs/by-name/si/silver-platter/package.nix | 71 ++++++++++++---------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/pkgs/by-name/si/silver-platter/package.nix b/pkgs/by-name/si/silver-platter/package.nix index 5e1cb6a84736..8674f0e5926c 100644 --- a/pkgs/by-name/si/silver-platter/package.nix +++ b/pkgs/by-name/si/silver-platter/package.nix @@ -1,53 +1,62 @@ { - python3Packages, lib, stdenv, - fetchFromGitHub, - pkg-config, rustPlatform, - cargo, - rustc, + fetchFromGitHub, + python3, + makeBinaryWrapper, + pkg-config, libiconv, openssl, + versionCheckHook, }: -python3Packages.buildPythonApplication rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "silver-platter"; version = "0.8.1"; - pyproject = true; src = fetchFromGitHub { owner = "jelmer"; repo = "silver-platter"; - tag = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-/GFTM/VF+b0I8cDY4vkHzSxCBbvpMiLBVVEPFHcn1/Q="; }; - cargoDeps = rustPlatform.fetchCargoVendor { - inherit pname version src; - hash = "sha256-Y16OnSBC4v21NcCeWAwwGoFYJMQq/se25QqvpMyblmk="; - }; + cargoHash = "sha256-Y16OnSBC4v21NcCeWAwwGoFYJMQq/se25QqvpMyblmk="; - dependencies = with python3Packages; [ - setuptools - breezy - dulwich - jinja2 - pyyaml - ruamel-yaml - ]; - nativeBuildInputs = [ - python3Packages.setuptools-rust - rustPlatform.cargoSetupHook - cargo - rustc + buildInputs = [ + python3 ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ]; - buildInputs = - lib.optionals stdenv.hostPlatform.isLinux [ openssl ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ]; + ++ lib.optionals stdenv.hostPlatform.isLinux [ openssl ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ]; - pythonImportsCheck = [ "silver_platter" ]; + nativeBuildInputs = [ + python3 + pkg-config + + python3.pkgs.wrapPython + makeBinaryWrapper + ]; + + nativeCheckInputs = [ + python3.pkgs.breezy + ]; + + pythonPath = [ + python3.pkgs.breezy + ]; + + postFixup = '' + wrapPythonPrograms + for pgm in $out/bin/svp $out/bin/debian-svp; do + wrapProgram "$pgm" \ + --set PYTHONNOUSERSITE "true" \ + --set PYTHONPATH "$program_PYTHONPATH" + done + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; meta = { description = "Automate the creation of merge proposals for scriptable changes"; @@ -56,4 +65,4 @@ python3Packages.buildPythonApplication rec { maintainers = with lib.maintainers; [ lukegb ]; mainProgram = "svp"; }; -} +})