nix: add flake
This commit is contained in:
parent
e2acd44936
commit
1337f92ef3
2 changed files with 134 additions and 0 deletions
65
flake.nix
Normal file
65
flake.nix
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
description = "My Advent of Code solutions";
|
||||
|
||||
inputs = {
|
||||
futils = {
|
||||
type = "github";
|
||||
owner = "numtide";
|
||||
repo = "flake-utils";
|
||||
ref = "master";
|
||||
};
|
||||
|
||||
nixpkgs = {
|
||||
type = "github";
|
||||
owner = "NixOS";
|
||||
repo = "nixpkgs";
|
||||
ref = "nixos-unstable";
|
||||
};
|
||||
|
||||
pre-commit-hooks = {
|
||||
type = "github";
|
||||
owner = "cachix";
|
||||
repo = "pre-commit-hooks.nix";
|
||||
ref = "master";
|
||||
inputs = {
|
||||
flake-utils.follows = "futils";
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, futils, nixpkgs, pre-commit-hooks }:
|
||||
futils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
checks = {
|
||||
pre-commit = pre-commit-hooks.lib.${system}.run {
|
||||
src = self;
|
||||
|
||||
hooks = {
|
||||
black = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
isort = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
nixpkgs-fmt = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
python3
|
||||
];
|
||||
|
||||
inherit (self.checks.${system}.pre-commit) shellHook;
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue