use latest nixpkgs and poetry2nix

This commit is contained in:
Dmitriy Pleshevskiy 2023-03-22 14:13:36 +03:00
parent 88e2a5beb9
commit deac6def79
Signed by: pleshevskiy
GPG Key ID: 79C4487B44403985
3 changed files with 43 additions and 28 deletions

View File

@ -17,22 +17,47 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1678875422, "lastModified": 1679477347,
"narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=", "narHash": "sha256-0Vpbt5q4QG3XHVcUA9ifWxUg1eqcz0fdcQdNdiK4ZrM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459", "rev": "4dc8a5c2dcb80cbdd00b4010d41a75dd26379e86",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "NixOS",
"type": "indirect" "repo": "nixpkgs",
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1679445660,
"narHash": "sha256-yhO+5d5Ilxybmt3/oGI7KJ/kjnDq50MLrPIvjc40qeg=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "50ec694c27a12bc178fff961c4dd927fa6a47f18",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"poetry2nix": "poetry2nix"
} }
} }
}, },

View File

@ -1,9 +1,13 @@
{ {
inputs = { inputs = {
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
poetry2nix.url = "github:nix-community/poetry2nix";
poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
poetry2nix.inputs.flake-utils.follows = "flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils, ... }: outputs = { self, nixpkgs, flake-utils, poetry2nix, ... }:
let let
inherit (builtins) listToAttrs mapAttrs; inherit (builtins) listToAttrs mapAttrs;
@ -25,7 +29,8 @@
mkApp = drv: flake-utils.lib.mkApp { inherit drv; }; mkApp = drv: flake-utils.lib.mkApp { inherit drv; };
mkOverlay = name: mkOverlay = name:
final: prev: final: prev:
final.filterAttrs (n: v: n == name) (mkAllPackages prev); final.filterAttrs (n: v: n == name) (mkAllPackages prev)
// { poetry2nix = nixpkgs.packages.${final.system}.poetry2nix; };
in in
{ {
overlays = (listToAttrs overlays = (listToAttrs
@ -34,12 +39,15 @@
allPackageNames allPackageNames
) )
) // { ) // {
all = final: prev: mkAllPackages prev; all = final: prev:
mkAllPackages prev
// { poetry2nix = nixpkgs.packages.${final.system}.poetry2nix; };
}; };
} }
// flake-utils.lib.eachDefaultSystem (system: // flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = import nixpkgs { inherit system; }; overlays = [ poetry2nix.overlay ];
pkgs = import nixpkgs { inherit system overlays; };
packages = mkAllPackages pkgs; packages = mkAllPackages pkgs;
in in
{ {

View File

@ -6,27 +6,9 @@
let let
poetryOverrides = poetry2nix.defaultPoetryOverrides.extend (full: prev: { poetryOverrides = poetry2nix.defaultPoetryOverrides.extend (full: prev: {
colorama = prev.colorama.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [ prev.hatchling ];
});
iniconfig = prev.iniconfig.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [ prev.hatchling prev.hatch-vcs ];
});
filelock = prev.filelock.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [ prev.hatchling prev.hatch-vcs ];
});
packaging = prev.packaging.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [ prev.flit-core ];
});
pathspec = prev.pathspec.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [ prev.flit-core ];
});
nox = prev.nox.overridePythonAttrs (old: { nox = prev.nox.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [ prev.setuptools ]; buildInputs = old.buildInputs ++ [ prev.setuptools ];
}); });
exceptiongroup = prev.exceptiongroup.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [ prev.flit-scm ];
});
pip-requirements-parser = prev.pip-requirements-parser.overridePythonAttrs (old: { pip-requirements-parser = prev.pip-requirements-parser.overridePythonAttrs (old: {
dontConfigure = true; dontConfigure = true;
}); });