1{ stdenv
2, lib
3, fetchFromGitHub
4, meson
5, pkg-config
6, ninja
7, glib
8, gtk3
9, nemo
10, python3
11, substituteAll
12}:
13
14stdenv.mkDerivation rec {
15 pname = "nemo-python";
16 version = "5.6.0";
17
18 src = fetchFromGitHub {
19 owner = "linuxmint";
20 repo = "nemo-extensions";
21 rev = version;
22 sha256 = "sha256-cxutiz5bc/dZ9D7XzvMWodWNYvNJPj+5IhJDPJwnb5I=";
23 };
24
25 sourceRoot = "${src.name}/nemo-python";
26
27 patches = [
28 # Load extensions from NEMO_PYTHON_EXTENSION_DIR environment variable
29 # https://github.com/NixOS/nixpkgs/issues/78327
30 ./load-extensions-from-env.patch
31
32 # Required for pygobject_init ().
33 (substituteAll {
34 src = ./python-path.patch;
35 env = "${python3.pkgs.pygobject3}/${python3.sitePackages}";
36 })
37 ];
38
39 nativeBuildInputs = [
40 meson
41 pkg-config
42 ninja
43 ];
44
45 buildInputs = [
46 glib
47 gtk3
48 nemo
49 python3
50 python3.pkgs.pygobject3
51 ];
52
53 postPatch = ''
54 # Tries to load libpython3.so via g_module_open ().
55 substituteInPlace meson.build \
56 --replace "get_option('prefix'), get_option('libdir')" "'${python3}/lib'"
57 '';
58
59 PKG_CONFIG_LIBNEMO_EXTENSION_EXTENSIONDIR = "${placeholder "out"}/${nemo.extensiondir}";
60
61 meta = with lib; {
62 homepage = "https://github.com/linuxmint/nemo-extensions/tree/master/nemo-python";
63 description = "Python bindings for the Nemo extension library";
64 license = licenses.gpl2Plus;
65 platforms = platforms.linux;
66 maintainers = teams.cinnamon.members;
67 };
68}