poetry2nix/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

40 lines
1.1 KiB
Nix

{
description = "Poetry2nix flake";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
outputs = { self, nixpkgs, flake-utils }:
{
overlay = import ./overlay.nix;
templates = {
app = {
path = ./templates/app;
description = "An example of a NixOS container";
};
default = self.templates.app;
};
} // (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
poetry = pkgs.callPackage ./pkgs/poetry { python = pkgs.python3; };
poetry2nix = import ./default.nix { inherit pkgs poetry; };
in
rec {
packages = {
inherit poetry;
poetry2nix = poetry2nix.cli;
default = poetry2nix.cli;
};
legacyPackages = poetry2nix;
apps = {
poetry = flake-utils.lib.mkApp { drv = packages.poetry; };
poetry2nix = flake-utils.lib.mkApp { drv = packages.poetry2nix; };
default = apps.poetry2nix;
};
}));
}