mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-05 17:21:39 -05:00
template: drop use of overlay
This makes the template a lot shorter. Overlays are not only harder to read and understand (especially if multiple of them have to be combined), they also have a real performance impact as each flake would introduce its own instance of nixpkgks, which can further multiply if these flakes are than import into multiple NixOS configurations: https://zimbatm.com/notes/1000-instances-of-nixpkgs If the goal of overlays was here to make importing easier, I would rather recommend looking into https://flake.parts
This commit is contained in:
parent
16e7600337
commit
05b788f7b9
2 changed files with 11 additions and 25 deletions
|
@ -29,6 +29,7 @@
|
|||
default = poetry2nix.cli;
|
||||
};
|
||||
|
||||
legacyPackages = poetry2nix;
|
||||
|
||||
apps = {
|
||||
poetry = flake-utils.lib.mkApp { drv = packages.poetry; };
|
||||
|
|
|
@ -9,35 +9,20 @@
|
|||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
|
||||
{
|
||||
# Nixpkgs overlay providing the application
|
||||
overlay = nixpkgs.lib.composeManyExtensions [
|
||||
poetry2nix.overlay
|
||||
(final: prev: {
|
||||
# The application
|
||||
myapp = prev.poetry2nix.mkPoetryApplication {
|
||||
projectDir = ./.;
|
||||
};
|
||||
})
|
||||
];
|
||||
} // (flake-utils.lib.eachDefaultSystem (system:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlay ];
|
||||
};
|
||||
# see https://github.com/nix-community/poetry2nix/tree/master#api for more functions and examples.
|
||||
inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
apps = {
|
||||
myapp = pkgs.myapp;
|
||||
packages = {
|
||||
myapp = mkPoetryApplication { projectDir = self; };
|
||||
default = self.packages.${system}.myapp;
|
||||
};
|
||||
|
||||
defaultApp = pkgs.myapp;
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
(python310.withPackages (ps: with ps; [ poetry ]))
|
||||
];
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = [ poetry2nix.packages.${system}.poetry ];
|
||||
};
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue