python/{{ cookiecutter.project_slug }}/flake.nix

37 lines
1.2 KiB
Nix
Raw Normal View History

2023-05-20 23:11:08 +02:00
{
description = "{{ cookiecutter.project_short_description }}";
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;
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages = {
{{ cookiecutter.project_slug }} = mkPoetryApplication { projectDir = self; };
docker = pkgs.dockerTools.buildImage {
name = "{{ cookiecutter.project_slug }}";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "{{ cookiecutter.project_slug }}_root_img";
paths = [ self.packages.${system}.{{ cookiecutter.project_slug }} ];
pathsToLink = [ "/bin" ];
};
};
default = self.packages.${system}.{{ cookiecutter.project_slug }};
};
devShells.default = pkgs.mkShell {
packages = [ poetry2nix.packages.${system}.poetry ];
};
});
}