diff --git a/.gitignore b/.gitignore index 2a8645f..c7dba38 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .hugo_build.lock +.direnv +.pre-commit-config.yaml diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ad0b878 --- /dev/null +++ b/flake.nix @@ -0,0 +1,17 @@ +{ + description = "cronyakatsuki.xyz"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-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, ... }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + devShells.x86_64-linux.default = + (import ./shell.nix { inherit pkgs pre-commit-hooks; }); + }; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..98cea50 --- /dev/null +++ b/shell.nix @@ -0,0 +1,15 @@ +{ pkgs ? import { }, pre-commit-hooks }: +let + pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run { + src = ./.; + hooks = { + shfmt.enable = true; + html-tidy.enable = true; + taplo.enable = true; + }; + }; +in pkgs.mkShell { + inherit (pre-commit-check) shellHook; + name = "cronyakatsuki.xyz"; + nativeBuildInputs = [ pkgs.hugo ]; +}