Files
joel/flake.nix
2026-03-22 02:35:10 +01:00

66 lines
1.6 KiB
Nix

{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
git-hooks.url = "github:cachix/git-hooks.nix";
repo-lib.url = "git+https://git.dgren.dev/eric/nix-flake-lib?ref=refs/tags/v3.0.0";
};
outputs =
{ self, nixpkgs, ... }@inputs:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
# Run the hooks with `nix fmt`.
formatter = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
config = self.checks.${system}.pre-commit-check.config;
inherit (config) package configFile;
script = ''
${pkgs.lib.getExe package} run --all-files --config ${configFile}
'';
in
pkgs.writeShellScriptBin "pre-commit-run" script
);
checks = forAllSystems (system: {
pre-commit-check = inputs.git-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixfmt.enable = true;
};
};
});
devShells = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
inherit (self.checks.${system}.pre-commit-check) shellHook enabledPackages;
in
{
default = pkgs.mkShell {
packages = with pkgs; [
ffmpeg
bun
gitlint
];
inherit shellHook;
buildInputs = enabledPackages;
};
}
);
};
}