added checks and formatting pre-commit hooks
This commit is contained in:
parent
d8dd32193d
commit
81f128265c
10 changed files with 166 additions and 42 deletions
48
flake.nix
48
flake.nix
|
|
@ -1,12 +1,54 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.11";
|
||||
systems.url = "github:nix-systems/default";
|
||||
git-hooks.url = "github:cachix/git-hooks.nix";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
{
|
||||
# hydraJobs = nixpkgs.lib.mapAttrs (_: value: value.config.system.build.toplevel) self.nixosConfigurations;
|
||||
self,
|
||||
systems,
|
||||
nixpkgs,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
forEachSystem = inputs.nixpkgs.lib.genAttrs (import systems);
|
||||
in
|
||||
{
|
||||
formatter = forEachSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
pkgs.treefmt
|
||||
);
|
||||
|
||||
checks = forEachSystem (system: {
|
||||
pre-commit-check = inputs.git-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
treefmt.enable = true;
|
||||
treefmt.settings.formatters = [ inputs.nixpkgs.legacyPackages.${system}.nixfmt ];
|
||||
statix.enable = true;
|
||||
deadnix.enable = true;
|
||||
nil.enable = true;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
devShells = forEachSystem (system: {
|
||||
default =
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook enabledPackages;
|
||||
in
|
||||
pkgs.mkShell {
|
||||
inherit shellHook;
|
||||
buildInputs = enabledPackages;
|
||||
};
|
||||
});
|
||||
|
||||
nixosConfigurations = {
|
||||
vm = nixpkgs.lib.nixosSystem { modules = [ ./systems/vm/configuration.nix ]; };
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue