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"; }; -} +})