poetry2nix/templates/app/flake.nix
Jörg Thalheim 05b788f7b9 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
2023-01-15 13:01:36 +01:00

28 lines
930 B
Nix

{
description = "Application packaged using poetry2nix";
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
# 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
{
packages = {
myapp = mkPoetryApplication { projectDir = self; };
default = self.packages.${system}.myapp;
};
devShells.default = pkgs.mkShell {
packages = [ poetry2nix.packages.${system}.poetry ];
};
});
}