roll/flake.nix

66 lines
1.9 KiB
Nix
Raw Normal View History

2023-08-10 01:02:53 +00:00
{
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
2023-08-13 22:05:42 +00:00
buildPkgs = builtins.attrValues {
inherit (pkgs.python311Packages)
hatchling
tomli
;
hatch = pkgs.hatch.override {
python3 = pkgs.python311;
};
};
package = pkgs.python311.pkgs.buildPythonApplication {
2023-08-10 01:02:53 +00:00
pname = "roll";
version = "0.1.0";
src = ./.;
format = "pyproject";
2023-08-13 22:05:42 +00:00
nativeBuildInputs = buildPkgs;
2023-08-10 01:02:53 +00:00
};
in
{
pre-commit.settings.hooks = {
autoflake.enable = true;
black.enable = true;
2023-08-13 18:54:11 +00:00
# mypy.enable = true;
2023-08-10 01:02:53 +00:00
ruff.enable = true;
};
packages.default = package;
devShells.default = pkgs.mkShell {
shellHook = ''
${config.pre-commit.installationScript}
echo "welcome to your python project >~(:)=====--" 1>&2
'';
2023-08-13 22:05:42 +00:00
nativeBuildInputs = buildPkgs;
2023-08-10 01:02:53 +00:00
buildInputs = builtins.attrValues {
inherit (pkgs)
autoflake
black
pyright
ruff
;
2023-08-11 20:05:51 +00:00
inherit (pkgs.python311Packages)
ipython
;
2023-08-13 22:05:42 +00:00
roll = package;
2023-08-10 01:02:53 +00:00
};
};
};
};
}