nancy/flake.nix

55 lines
1.5 KiB
Nix

{
description = "Application packaged using poetry2nix";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
{
# Nixpkgs overlay providing the application
overlay = nixpkgs.lib.composeManyExtensions [
poetry2nix.overlay
(final: prev: {
# The application
nancy = prev.poetry2nix.mkPoetryApplication {
projectDir = ./.;
};
})
];
} // (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
python = pkgs.python310;
in
{
#apps = {
#nancy = pkgs.nancy;
#};
#defaultApp = pkgs.nancy;
defaultPackage = pkgs.nancy;
devShell = pkgs.mkShell {
buildInputs = with pkgs; with python.pkgs; [
nixpkgs-fmt
poetry
(pkgs.poetry2nix.mkPoetryEnv {
inherit python;
projectDir = ./.;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
editablePackageSources = {
nancy = ./src;
};
})
];
shellHook = "echo 'Execute `poetry shell` to access an environment with an editable install.'";
};
}));
}