nancy/flake.nix

52 lines
1.3 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
{
defaultPackage = pkgs.nancy;
devShell =
let
e = pkgs.poetry2nix.mkPoetryEnv {
inherit python;
projectDir = ./.;
editablePackageSources = {
nancy = ./src;
};
};
in
e.env.overrideAttrs (oldAttrs: {
buildInputs = with pkgs; with python.pkgs; [
nixpkgs-fmt
black
poetry
pkgs.pre-commit
sqlite
];
});
}));
}