|
| 1 | +{ |
| 2 | + inputs = { |
| 3 | + utils.url = "github:numtide/flake-utils"; |
| 4 | + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; |
| 5 | + }; |
| 6 | + outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system: |
| 7 | + let |
| 8 | + pkgs = nixpkgs.legacyPackages.${system}; |
| 9 | + python = pkgs.python3; |
| 10 | + in |
| 11 | + { |
| 12 | + devShell = pkgs.mkShell { |
| 13 | + # Use these variables in ./src/_c_internal_utils.cpp |
| 14 | + LIBX11_REPLACEMENT = "${pkgs.xorg.libX11}/lib/libX11.so.6"; |
| 15 | + LIBWAYLAND_EPLACEMENT = "${pkgs.wayland}/lib/libwayland-client.so.0"; |
| 16 | + nativeBuildInputs = [ |
| 17 | + python.pkgs.pytest |
| 18 | + python.pkgs.meson-python |
| 19 | + python.pkgs.pip |
| 20 | + python.pkgs.mypy |
| 21 | + python.pkgs.flake8 |
| 22 | + pkgs.ninja |
| 23 | + ] |
| 24 | + ++ python.pkgs.matplotlib.nativeBuildInputs |
| 25 | + ; |
| 26 | + buildInputs = [ |
| 27 | + ] |
| 28 | + ++ python.pkgs.matplotlib.buildInputs |
| 29 | + ; |
| 30 | + propagatedBuildInputs = [ |
| 31 | + # To test qt backend related scripts |
| 32 | + python.pkgs.pyqt6 |
| 33 | + ] |
| 34 | + ++ python.pkgs.matplotlib.propagatedBuildInputs |
| 35 | + ++ python.pkgs.matplotlib.dependencies |
| 36 | + ; |
| 37 | + QT_PLUGIN_PATH = pkgs.lib.pipe [ |
| 38 | + pkgs.qt6.qtbase |
| 39 | + pkgs.qt6.qtwayland |
| 40 | + ] [ |
| 41 | + (map (p: "${pkgs.lib.getBin p}/${pkgs.qt6.qtbase.qtPluginPrefix}")) |
| 42 | + (pkgs.lib.concatStringsSep ":") |
| 43 | + ]; |
| 44 | + QT_QPA_PLATFORM="wayland"; |
| 45 | + XDG_DATA_DIRS = pkgs.lib.concatStringsSep ":" [ |
| 46 | + # So we'll be able to save figures from the plot dialog |
| 47 | + "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}" |
| 48 | + "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}" |
| 49 | + # So pdf mime types and perhaps others could be detected by 'gio open' |
| 50 | + # / xdg-open. TODO: Is this the best way to overcome this issue - |
| 51 | + # manually every time we generate a devShell? |
| 52 | + "${pkgs.shared-mime-info}/share" |
| 53 | + "${pkgs.hicolor-icon-theme}/share" |
| 54 | + ]; |
| 55 | + GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg}/${pkgs.gdk-pixbuf.moduleDir}.cache"; |
| 56 | + # Install to this path with (in contrast to upstream's documentation): |
| 57 | + # |
| 58 | + # python -m pip install \ |
| 59 | + # --config-settings=setup-args="-Dsystem-freetype=true" \ |
| 60 | + # --config-settings=setup-args="-Dsystem-qhull=true" \ |
| 61 | + # --config-settings=setup-args="-Db_lto=false" \ |
| 62 | + # --config-settings=builddir=build \ |
| 63 | + # --prefix dist/nix \ |
| 64 | + # --no-build-isolation \ |
| 65 | + # ".[dev]" |
| 66 | + # |
| 67 | + # |
| 68 | + # Run test(s) with (e.g): |
| 69 | + # |
| 70 | + # pytest \ |
| 71 | + # --import-mode=append \ |
| 72 | + # --showlocals \ |
| 73 | + # $INSTALLDIR/matplotlib/tests/test_ticker.py \ |
| 74 | + # -k 'TestLogFormatterMathtext' |
| 75 | + INSTALLDIR = "dist/nix/${python.sitePackages}"; |
| 76 | + }; |
| 77 | + } |
| 78 | + ); |
| 79 | +} |
0 commit comments