2021-02-05 17:12:51 +00:00
|
|
|
{ lib, callPackage, python3Packages, fetchFromGitLab, cacert,
|
2021-03-09 03:18:52 +00:00
|
|
|
rustPlatform, bubblewrap, git, perlPackages, imagemagick, fetchurl, fetchzip,
|
2021-09-18 10:52:07 +00:00
|
|
|
jre, makeWrapper, tr-patcher, tes3cmd, fetchpatch }:
|
2020-10-27 00:29:36 +00:00
|
|
|
|
|
|
|
let
|
2021-09-18 10:52:07 +00:00
|
|
|
version = "2.0.3";
|
2020-10-27 00:29:36 +00:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "portmod";
|
|
|
|
repo = "Portmod";
|
|
|
|
rev = "v${version}";
|
2021-09-18 10:52:07 +00:00
|
|
|
sha256 = "sha256-vMdyaI1Ps7bFoRvwdVNVG9vPFEiGb7CPvKEWfxiM128=";
|
2020-10-27 00:29:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
portmod-rust = rustPlatform.buildRustPackage rec {
|
|
|
|
inherit src version;
|
|
|
|
pname = "portmod-rust";
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
cargoHash = "sha256-tAghZmlg34jHr8gtNgL3MQ8EI7K6/TfDcTbBjxdWLr0=";
|
2020-10-27 00:29:36 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ python3Packages.python ];
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
bin-programs = [
|
|
|
|
bubblewrap
|
|
|
|
git
|
|
|
|
python3Packages.virtualenv
|
|
|
|
tr-patcher
|
|
|
|
tes3cmd
|
2021-03-09 03:18:52 +00:00
|
|
|
imagemagick
|
2020-10-27 00:29:36 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
in
|
|
|
|
python3Packages.buildPythonApplication rec {
|
|
|
|
inherit src version;
|
|
|
|
|
|
|
|
pname = "portmod";
|
|
|
|
|
|
|
|
SETUPTOOLS_SCM_PRETEND_VERSION = version;
|
|
|
|
|
|
|
|
# build the rust library independantly
|
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "from setuptools_rust import Binding, RustExtension" "" \
|
2021-09-18 10:52:07 +00:00
|
|
|
--replace "RustExtension(\"portmodlib.portmod\", binding=Binding.PyO3, strip=True)" ""
|
2020-10-27 00:29:36 +00:00
|
|
|
'';
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
# fix error when symlinks are present in the path (https://gitlab.com/portmod/portmod/-/merge_requests/393)
|
|
|
|
# happen with ~/.nix-profile
|
|
|
|
url = "https://gitlab.com/portmod/portmod/-/merge_requests/393.patch";
|
|
|
|
sha256 = "sha256-XHifwD/Nh7UiMZdvSNudVF7qpBOpjGTKSr4VVdJqUdA=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-10-27 00:29:36 +00:00
|
|
|
propagatedBuildInputs = with python3Packages; [
|
2021-06-04 09:07:49 +00:00
|
|
|
setuptools-scm
|
2020-10-27 00:29:36 +00:00
|
|
|
setuptools
|
|
|
|
requests
|
|
|
|
chardet
|
|
|
|
colorama
|
|
|
|
restrictedpython
|
|
|
|
appdirs
|
|
|
|
GitPython
|
|
|
|
progressbar2
|
|
|
|
python-sat
|
|
|
|
redbaron
|
|
|
|
patool
|
|
|
|
packaging
|
2021-09-18 10:52:07 +00:00
|
|
|
fasteners
|
2020-10-27 00:29:36 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = with python3Packages; [
|
|
|
|
pytestCheckHook
|
|
|
|
] ++ bin-programs;
|
|
|
|
|
|
|
|
preCheck = ''
|
2021-09-18 10:52:07 +00:00
|
|
|
cp ${portmod-rust}/lib/libportmod.so portmodlib/portmod.so
|
2020-10-27 00:29:36 +00: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-09-18 10:52:07 +00:00
|
|
|
"test_sync"
|
|
|
|
"test_manifest"
|
|
|
|
"test_add_repo"
|
2020-10-27 00:29:36 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# for some reason, installPhase doesn't copy the compiled binary
|
|
|
|
postInstall = ''
|
2021-09-18 10:52:07 +00:00
|
|
|
cp ${portmod-rust}/lib/libportmod.so $out/${python3Packages.python.sitePackages}/portmodlib/portmod.so
|
2020-10-27 00:29:36 +00:00
|
|
|
|
|
|
|
makeWrapperArgs+=("--prefix" "GIT_SSL_CAINFO" ":" "${cacert}/etc/ssl/certs/ca-bundle.crt" \
|
|
|
|
"--prefix" "PATH" ":" "${lib.makeBinPath bin-programs }")
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "mod manager for openMW based on portage";
|
|
|
|
homepage = "https://gitlab.com/portmod/portmod";
|
|
|
|
license = lib.licenses.gpl3;
|
|
|
|
maintainers = with lib.maintainers; [ marius851000 ];
|
|
|
|
};
|
|
|
|
}
|