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