roll/flake.nix

66 lines
1.9 KiB
Nix

{
description = "roll - for initiative!";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.pre-commit.flakeModule
];
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }:
let
buildPkgs = builtins.attrValues {
inherit (pkgs.python311Packages)
hatchling
tomli
;
hatch = pkgs.hatch.override {
python3 = pkgs.python311;
};
};
package = pkgs.python311.pkgs.buildPythonApplication {
pname = "roll";
version = "0.1.0";
src = ./.;
format = "pyproject";
nativeBuildInputs = buildPkgs;
};
in
{
pre-commit.settings.hooks = {
autoflake.enable = true;
black.enable = true;
# mypy.enable = true;
ruff.enable = true;
};
packages.default = package;
devShells.default = pkgs.mkShell {
shellHook = ''
${config.pre-commit.installationScript}
echo "welcome to your python project >~(:)=====--" 1>&2
'';
nativeBuildInputs = buildPkgs;
buildInputs = builtins.attrValues {
inherit (pkgs)
autoflake
black
pyright
ruff
;
inherit (pkgs.python311Packages)
ipython
;
roll = package;
};
};
};
};
}