38 lines
1.2 KiB
Nix
38 lines
1.2 KiB
Nix
|
{
|
||
|
description = "Flake utils demo";
|
||
|
|
||
|
inputs = {
|
||
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||
|
flake-utils.url = "github:numtide/flake-utils";
|
||
|
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||
|
};
|
||
|
|
||
|
outputs = { self, nixpkgs, flake-utils, pre-commit-hooks }:
|
||
|
flake-utils.lib.eachDefaultSystem (system:
|
||
|
let
|
||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||
|
minVersion = 8;
|
||
|
maxVersion = 11;
|
||
|
mkPython = version: "python3${toString version}";
|
||
|
pythonVersions = map mkPython (pkgs.lib.lists.range minVersion maxVersion);
|
||
|
mkDevShell = version: pkgs.mkShell {
|
||
|
buildInputs = [ pkgs.${version} pkgs.poetry ];
|
||
|
};
|
||
|
in
|
||
|
{
|
||
|
devShells = pkgs.lib.genAttrs pythonVersions mkDevShell // {
|
||
|
default = self.devShells.${system}.${mkPython maxVersion};
|
||
|
};
|
||
|
checks.pre-commit-check = pre-commit-hooks.lib."${system}".run {
|
||
|
src = ./.;
|
||
|
hooks = {
|
||
|
nixpkgs-fmt.enable = true;
|
||
|
statix.enable = true;
|
||
|
shellcheck.enable = true;
|
||
|
black.enable = true;
|
||
|
isort.enable = true;
|
||
|
};
|
||
|
};
|
||
|
});
|
||
|
}
|