Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{ pkgs, ... }:
{ pkgs, config, ... }:
let
flake = builtins.getFlake (toString ./.);
packages = flake.packages.${pkgs.stdenv.hostPlatform.system};
in
{
imports = [ flake.devenvModules.default ];
packages = [ pkgs.bun ];
packages = [ pkgs.bun packages.hk ];
env.HK_STATE_DIR = "${config.devenv.state}/hk";
}
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
in {
inherit (meissaPackages) rumdl biome;
"rumdl-base-config" = meissaPackages."rumdl-base-config";
hk = import ./tools/toolchain/hk.nix { inherit pkgs; };
bun = pkgs.bun;
});
devenvModules.default = meissa.devenvModules.default;
Expand Down
34 changes: 34 additions & 0 deletions hk.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Git hooks managed by hk (https://hk.jdx.dev).
amends "package://github.com/jdx/hk/releases/download/v2.11.1/hk@2.11.1#/Config.pkl"

default_branch = "main"

hooks {
["pre-push"] {
steps {
["install"] = new Step {
check = "bun install --frozen-lockfile"
}
["test"] = new Step {
depends = "install"
check = "bun test"
}
["markdown"] = new Step {
depends = "test"
check = "rumdl check ."
}
["biome"] = new Step {
depends = "markdown"
check = "biome ci ."
}
["ref-gate"] = new Step {
depends = "biome"
check = "bun run ref-gate"
}
["build"] = new Step {
depends = "ref-gate"
check = "bun run build"
}
}
}
}
34 changes: 34 additions & 0 deletions tools/toolchain/hk.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{ pkgs }:
let
version = "2.11.1";
srcs = {
"x86_64-linux" = {
url = "https://github.com/jdx/hk/releases/download/v${version}/hk-x86_64-unknown-linux-musl.tar.gz";
hash = "sha256-IGfMtO60yxdiOn+EDuJKZO3PokJDGwkDWKhU5hmz00U=";
};
"aarch64-linux" = {
url = "https://github.com/jdx/hk/releases/download/v${version}/hk-aarch64-unknown-linux-musl.tar.gz";
hash = "sha256-XiB0fhM1xZniwc9b/waoFTzUKnGa8AztIYhoeEh1pj8=";
};
"aarch64-darwin" = {
url = "https://github.com/jdx/hk/releases/download/v${version}/hk-aarch64-apple-darwin.tar.gz";
hash = "sha256-lfiebu9g4MaQsNQ5sw47hVj0cjWhpFy/97U1HSlOQyI=";
};
};
src = srcs.${pkgs.stdenv.hostPlatform.system} or (throw "hk: unsupported platform ${pkgs.stdenv.hostPlatform.system}");
in
pkgs.stdenvNoCC.mkDerivation {
pname = "hk";
inherit version;
src = pkgs.fetchurl src;
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
install -d "$out/bin"
tar -xzf "$src" -C "$out/bin" hk
chmod 755 "$out/bin/hk"
runHook postInstall
'';
}
Loading