1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
{ lib
, bubblewrap
, cacert
, fetchFromGitLab
, git
, imagemagick
, openmw
, python3Packages
, rustPlatform
, tes3cmd
, tr-patcher
}:
let
version = "2.1.0";
src = fetchFromGitLab {
owner = "portmod";
repo = "Portmod";
rev = "v${version}";
hash = "sha256-b/ENApFovMPNUMbJhwY+TZCnSzpr1e/IKJ/5XAGTQjE=";
};
portmod-rust = rustPlatform.buildRustPackage rec {
inherit src version;
pname = "portmod-rust";
cargoHash = "sha256-3EfMMpSWSYsB3nXaoGGDuKQ9duyCKzbrT6oeATnzqLE=";
nativeBuildInputs = [
python3Packages.python
];
doCheck = false;
};
bin-programs = [
bubblewrap
git
python3Packages.virtualenv
tr-patcher
tes3cmd
imagemagick
openmw
];
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" "" \
--replace "RustExtension(\"portmodlib.portmod\", binding=Binding.PyO3, strip=True)" ""
'';
propagatedBuildInputs = with python3Packages; [
setuptools-scm
setuptools
requests
chardet
colorama
restrictedpython
appdirs
gitpython
progressbar2
python-sat
redbaron
patool
packaging
fasteners
];
nativeCheckInputs = with python3Packages; [
pytestCheckHook
] ++ bin-programs;
preCheck = ''
cp ${portmod-rust}/lib/libportmod.so portmodlib/portmod.so
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"
"test_sync"
"test_manifest"
"test_add_repo"
];
# for some reason, installPhase doesn't copy the compiled binary
postInstall = ''
cp ${portmod-rust}/lib/libportmod.so $out/${python3Packages.python.sitePackages}/portmodlib/portmod.so
makeWrapperArgs+=("--prefix" "GIT_SSL_CAINFO" ":" "${cacert}/etc/ssl/certs/ca-bundle.crt" \
"--prefix" "PATH" ":" "${lib.makeBinPath bin-programs }")
'';
meta = with lib; {
description = "mod manager for openMW based on portage";
homepage = "https://gitlab.com/portmod/portmod";
license = licenses.gpl3Only;
maintainers = with maintainers; [ marius851000 ];
};
}
|