coolbot/flake.nix
2024-07-28 23:28:21 +08:00

40 lines
1 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
poetry2nix,
treefmt-nix,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
inherit (poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}) mkPoetryApplication;
in {
formatter = treefmtEval.config.build.wrapper;
checks.formatting = treefmtEval.config.build.check self;
packages.default = mkPoetryApplication {projectDir = self;};
devShells.default = pkgs.mkShellNoCC {
packages = with pkgs; [
python3
poetry
black
ruff
];
};
});
}