I recently used pkgs.python3.override
in order to create a minimal python environment for a container with some additional packages. I also need to use poetry2nix for the packages that are not available in nix. However I now discovered that non of the overrides are actually packaged up. It took me a while to discover this since some of the packages were also pulled in as part of the poetry dependencies.
Excerpt from my flake.nix:
mypython = pkgs.python3.override {
packageOverrides = self: super: {
matplotlib = pkgs.python3Packages.matplotlib; # use the nixpkgs version
#notebook = pkgs.python3Packages.notebook; # use the nixpkgs version
nbformat = pkgs.python3Packages.nbformat; # use the nixpkgs version
numpy = pkgs.python3Packages.numpy; # use the nixpkgs version
plotly = pkgs.python3Packages.plotly; # use the nixpkgs version
scipy = pkgs.python3Packages.scipy; # use the nixpkgs version
};
};
p2n = import poetry2nix { }; # use when workaround is no longer necessary
pythonWithPackages = p2n.mkPoetryEnv {
python = mypython;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock; # make sure it is added to git!
};
pythonLayer = pkgs.dockerTools.buildLayeredImage {
name = "python-layer";
contents = [
pythonWithPackages
pkgs.coreutils
pkgs.bash
pkgs.fish
pkgs.nano];
};
none of the packages get actually packaged. What am I missing?
Any pointers are highly appreciated.