add precommit checks for formatting

This commit is contained in:
willemml 2023-03-20 09:23:41 -07:00
parent b2ad6233e7
commit b2cc028bac
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
2 changed files with 28 additions and 14 deletions

View file

@ -13,11 +13,12 @@
nixos-apple-silicon.url = "github:tpwrules/nixos-apple-silicon";
nixos-apple-silicon.inputs.nixpkgs.follows = "nixpkgs";
rycee-firefox-addons.url = "git+https://git.sr.ht/~rycee/nur-expressions?dir=pkgs/firefox-addons";
pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
./flake-parts
];
@ -28,6 +29,23 @@
"aarch64-darwin"
# "aarch64-linux"
];
perSystem = {
system,
self',
pkgs,
...
}: {
checks.pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
};
};
devShells.default = pkgs.mkShell {
inherit (self'.checks.pre-commit-check) shellHook;
};
};
};
}

View file

@ -1,9 +1,7 @@
{ pkgs, ... }:
{
environment.pathsToLink = [ "/share/zsh" ];
environment.shells = [ pkgs.bashInteractive pkgs.zsh ];
environment.systemPackages = [ pkgs.coreutils-full ];
{pkgs, ...}: {
environment.pathsToLink = ["/share/zsh"];
environment.shells = [pkgs.bashInteractive pkgs.zsh];
environment.systemPackages = [pkgs.coreutils-full];
environment.variables.LANG = "en_US.UTF-8";
environment.variables.LANGUAGE = "en_US.UTF-8";
environment.variables.LC_ALL = "en_US.UTF-8";
@ -15,20 +13,18 @@
generateRegistryFromInputs = true;
linkInputs = true;
package = pkgs.nix;
settings.experimental-features = [ "nix-command" "flakes" "repl-flake" ];
settings.trusted-users = [ "root" "willem" ];
settings.experimental-features = ["nix-command" "flakes" "repl-flake"];
settings.trusted-users = ["root" "willem"];
};
programs.nix-index.enable = false;
programs.bash.enable = true;
programs.bash.enableCompletion = true;
programs.bash.interactiveShellInit = ''
export PS1=$'\n'"\e[0mbash: \e[34;1m\w"$'\n'"\e[32m\\$\e[0m "
'';
programs.man.enable = true;
documentation.man.enable = true;
programs.zsh.enable = true;
programs.zsh.enableBashCompletion = true;