nixpkgs-suyu/pkgs/games/portmod/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

126 lines
2.6 KiB
Nix
Raw Normal View History

2022-12-05 22:04:59 +01:00
{ lib
, bubblewrap
, cacert
, fetchFromGitLab
, git
, imagemagick
, openmw
, python3Packages
, rustPlatform
, tes3cmd
, tr-patcher
}:
2020-10-17 10:50:51 +02:00
let
2023-08-30 20:04:28 +02:00
version = "2.6.2";
2020-10-17 10:50:51 +02:00
src = fetchFromGitLab {
owner = "portmod";
repo = "Portmod";
rev = "v${version}";
2023-08-30 20:04:28 +02:00
hash = "sha256-ufr2guaPdCvI5JOicL/lTrT3t6UlaY1hEB2xbwzhw6A=";
2020-10-17 10:50:51 +02:00
};
portmod-rust = rustPlatform.buildRustPackage rec {
inherit src version;
pname = "portmod-rust";
2023-08-30 20:04:28 +02:00
cargoHash = "sha256-sAjgGVVjgXaWbmN/eGEvatYjkHeFTZNX1GXFcJqs3GI=";
2020-10-17 10:50:51 +02:00
2022-12-05 22:04:59 +01:00
nativeBuildInputs = [
python3Packages.python
];
2020-10-17 10:50:51 +02:00
doCheck = false;
};
bin-programs = [
bubblewrap
git
python3Packages.virtualenv
tr-patcher
tes3cmd
imagemagick
openmw
2020-10-17 10:50:51 +02:00
];
in
python3Packages.buildPythonApplication rec {
inherit src version;
pname = "portmod";
2023-08-30 20:04:28 +02:00
format = "pyproject";
2020-10-17 10:50:51 +02:00
# build the rust library independantly
prePatch = ''
substituteInPlace setup.py \
2023-08-30 20:04:28 +02:00
--replace "from setuptools_rust import Binding, RustExtension, Strip" "" \
--replace "RustExtension(\"portmodlib.portmod\", binding=Binding.PyO3, strip=Strip.Debug)" ""
substituteInPlace pyproject.toml \
--replace '"setuptools-rust"' ""
2020-10-17 10:50:51 +02:00
'';
2023-08-30 20:04:28 +02:00
nativeBuildInputs = with python3Packages; [
setuptools
wheel
];
2020-10-17 10:50:51 +02:00
propagatedBuildInputs = with python3Packages; [
setuptools-scm
2020-10-17 10:50:51 +02:00
setuptools
requests
chardet
colorama
2023-08-30 20:04:28 +02:00
deprecated
2020-10-17 10:50:51 +02:00
restrictedpython
appdirs
2022-12-05 22:04:59 +01:00
gitpython
2020-10-17 10:50:51 +02:00
progressbar2
python-sat
redbaron
patool
packaging
2021-08-10 11:55:15 +02:00
fasteners
2020-10-17 10:50:51 +02:00
];
nativeCheckInputs = with python3Packages; [
2020-10-17 10:50:51 +02:00
pytestCheckHook
] ++ bin-programs;
preCheck = ''
2021-08-10 11:55:15 +02:00
cp ${portmod-rust}/lib/libportmod.so portmodlib/portmod.so
2020-10-17 10:50:51 +02:00
export HOME=$(mktemp -d)
'';
# some test require network access
disabledTests = [
"test_masters_esp"
"test_logging"
"test_execute_network_permissions"
"test_execute_permissions_bleed"
"test_git"
2021-08-10 11:55:15 +02:00
"test_sync"
"test_manifest"
"test_add_repo"
2023-08-30 20:04:28 +02:00
"test_init_prefix_interactive"
"test_scan_sources"
"test_unpack"
2020-10-17 10:50:51 +02:00
];
# for some reason, installPhase doesn't copy the compiled binary
postInstall = ''
2021-08-10 11:55:15 +02:00
cp ${portmod-rust}/lib/libportmod.so $out/${python3Packages.python.sitePackages}/portmodlib/portmod.so
2020-10-17 10:50:51 +02:00
makeWrapperArgs+=("--prefix" "GIT_SSL_CAINFO" ":" "${cacert}/etc/ssl/certs/ca-bundle.crt" \
"--prefix" "PATH" ":" "${lib.makeBinPath bin-programs }")
'';
2022-12-05 22:04:59 +01:00
meta = with lib; {
2020-10-17 10:50:51 +02:00
description = "mod manager for openMW based on portage";
homepage = "https://gitlab.com/portmod/portmod";
2022-12-05 22:04:59 +01:00
license = licenses.gpl3Only;
maintainers = with maintainers; [ marius851000 ];
2020-10-17 10:50:51 +02:00
};
}