diff --git a/flake.nix b/flake.nix index 1910d56..b4bd845 100644 --- a/flake.nix +++ b/flake.nix @@ -11,12 +11,32 @@ outputs = { self, nixpkgs, flake-utils, poetry2nix }: flake-utils.lib.eachDefaultSystem (system: let - inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication; + inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication overrides; pkgs = nixpkgs.legacyPackages.${system}; in { packages = { - test_flake_poetry2nix = mkPoetryApplication { projectDir = self; }; + test_flake_poetry2nix = mkPoetryApplication { + projectDir = self; + overrides = overrides.withDefaults (self: super: { + pillow = super.pillow.overridePythonAttrs(old: { + # Use preConfigure from nixpkgs to fix library detection issues and + # impurities which can break the build process; this also requires + # adding propagatedBuildInputs and buildInputs from the same source. +# propagatedBuildInputs = (old.buildInputs or []) ++ pkgs.python3.pkgs.pillow.propagatedBuildInputs; +# buildInputs = (old.buildInputs or []) ++ pkgs.python3.pkgs.pillow.buildInputs; +# preConfigure = (old.preConfigure or "") + pkgs.python3.pkgs.pillow.preConfigure; + + # https://github.com/nix-community/poetry2nix/issues/1139 + patches = (old.patches or []) ++ nixpkgs.lib.optionals (old.version == "9.5.0") [ + (pkgs.fetchpatch { + url = "https://github.com/python-pillow/Pillow/commit/0ec0a89ead648793812e11739e2a5d70738c6be5.diff"; + sha256 = "sha256-rZfk+OXZU6xBpoumIW30E80gRsox/Goa3hMDxBUkTY0="; + }) + ]; + }); + }); + }; docker = pkgs.dockerTools.buildImage { name = "test_flake_poetry2nix"; copyToRoot = pkgs.buildEnv { diff --git a/pyproject.toml b/pyproject.toml index 1481e89..5e933a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ numpy = "^1.24.3" matplotlib = "^3.7.1" [tool.poetry.scripts] -test = "test_flake_poetry2nix.cli:main" +test_p2n = "test_flake_poetry2nix.cli:main" [tool.poetry.group.dev.dependencies] pytest = "*" diff --git a/test_flake_poetry2nix/cli.py b/test_flake_poetry2nix/cli.py index 6668b75..8f1d3ae 100644 --- a/test_flake_poetry2nix/cli.py +++ b/test_flake_poetry2nix/cli.py @@ -3,6 +3,7 @@ import matplotlib.pyplot as plt def main(): + print("plop") fig, (ax1, ax2) = plt.subplots(2, 1) # make a little extra space between the subplots fig.subplots_adjust(hspace=0.5)