50 lines
1.8 KiB
Nix
50 lines
1.8 KiB
Nix
{
|
|
description = "Test with poetry2nix and flakes";
|
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
inputs.poetry2nix = {
|
|
url = "github:nix-community/poetry2nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication overrides;
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
{
|
|
packages = {
|
|
test_flake_poetry2nix = mkPoetryApplication {
|
|
projectDir = self;
|
|
overrides = overrides.withDefaults (self: super: {
|
|
pillow = super.pillow.overridePythonAttrs(old: {
|
|
# 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";
|
|
tag = "latest";
|
|
copyToRoot = pkgs.buildEnv {
|
|
name = "test_flake_poetry2nix_root_img";
|
|
paths = [ self.packages.${system}.test_flake_poetry2nix ];
|
|
pathsToLink = [ "/bin" ];
|
|
};
|
|
};
|
|
default = self.packages.${system}.test_flake_poetry2nix;
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
packages = [ poetry2nix.packages.${system}.poetry ];
|
|
};
|
|
});
|
|
}
|