diff --git a/.gitattributes b/.gitattributes
index 7edc0df..4022f99 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,19 +1,20 @@
-*rs text eol=lf
-*md text eol=lf
-*txt text eol=lf
-*yaml text eol=lf
-*yml text eol=lf
-*toml text eol=lf
-*are binary
-*bam binary
-*bcs binary
-*cre binary
-*itm binary
-*png binary
-*pro binary
-*spl binary
-*sto binary
-*vvc binary
-*wav binary
-*wbm binary
-*wed binary
+*.md text eol=lf
+*.rs text eol=lf
+*.toml text eol=lf
+*.txt text eol=lf
+*.yaml text eol=lf
+*.yml text eol=lf
+*.are binary
+*.bam binary
+*.bcs binary
+*.cre binary
+*.itm binary
+*.png binary
+*.pro binary
+*.spl binary
+*.sto binary
+*.svg binary
+*.vvc binary
+*.wav binary
+*.wbm binary
+*.wed binary
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 0207461..c46eee6 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -18,9 +18,9 @@ jobs:
- name: cache
uses: nix-community/cache-nix-action@v7
with:
- primary-key: nix-${{ runner.os }}-pre-${{ hashFiles('flake.nix', 'flake.lock') }}
+ primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
- gc-max-store-size-linux: 1G
+ gc-max-store-size-linux: 5G
- name: pre-commit
shell: 'nix develop -c bash -e {0}'
run: hk run pre-commit --all -j 10
@@ -86,7 +86,7 @@ jobs:
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
- gc-max-store-size-linux: 1G
+ gc-max-store-size-linux: 5G
- run: nix build
- name: Archive release artifacts
uses: actions/upload-artifact@main
diff --git a/docs/rust.svg b/docs/rust.svg
index ca096ae..700b505 100644
--- a/docs/rust.svg
+++ b/docs/rust.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/flake.lock b/flake.lock
index 982be49..2e71072 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,6 +1,60 @@
{
"nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "hk": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ },
+ "locked": {
+ "lastModified": 1777243570,
+ "narHash": "sha256-PJ8RaUeHfOVWl9wwQo5sYbuo8kap8DhtcunI6XosBCg=",
+ "owner": "jdx",
+ "repo": "hk",
+ "rev": "3cb88fb883b29281fff68c4edfc57a5fb97758fd",
+ "type": "github"
+ },
+ "original": {
+ "owner": "jdx",
+ "ref": "v1.44.2",
+ "repo": "hk",
+ "type": "github"
+ }
+ },
"nixpkgs": {
+ "locked": {
+ "lastModified": 1759417375,
+ "narHash": "sha256-O7eHcgkQXJNygY6AypkF9tFhsoDQjpNEojw3eFs73Ow=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "dc704e6102e76aad573f63b74c742cd96f8f1e6c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_2": {
"locked": {
"lastModified": 1772963539,
"narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=",
@@ -18,7 +72,23 @@
},
"root": {
"inputs": {
- "nixpkgs": "nixpkgs"
+ "hk": "hk",
+ "nixpkgs": "nixpkgs_2"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
}
}
},
diff --git a/flake.nix b/flake.nix
index 0425a53..2ed6a10 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,50 +1,62 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
+ hk = {
+ url = "github:jdx/hk/v1.44.2";
+ };
};
-
- outputs = { self, nixpkgs }:
+ outputs =
+ {
+ self,
+ nixpkgs,
+ hk,
+ }:
let
- systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "aarch64-darwin"
+ ];
forEachSystem = f: nixpkgs.lib.genAttrs systems (system: f system);
pkgsFor = nixpkgs.legacyPackages;
- in {
- devShells = forEachSystem (system:
+ in
+ {
+ devShells = forEachSystem (
+ system:
let
pkgs = import nixpkgs { inherit system; };
overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml));
- remote = builtins.fetchTarball {
- url = "https://github.com/jdx/hk/archive/refs/tags/v1.44.2.tar.gz";
- sha256 = "0a045ixfkj79f9nkiw598vraifv1dj744c6wjxbfaz478xli37rw";
- };
- hk = pkgs.callPackage (remote + "/default.nix") { };
- in {
+ in
+ {
default =
with pkgs;
mkShell rec {
- nativeBuildInputs = [
- cargo
- clippy
- hk
- codespell
- git
- pkg-config
- rust-analyzer
- rustc
- rustfmt
- yamlfmt
- ];
- buildInputs = [
- openssl
- ];
- env.HK_PKL_BACKEND = "pklr";
- env.OCAMLRUNPARAM = "s=16M,o=500,O=1000000";
- env.RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
- env.RUSTC_VERSION = overrides.toolchain.channel;
+ nativeBuildInputs = [
+ cargo
+ clippy
+ hk.packages.${system}.default
+ nixfmt
+ codespell
+ git
+ pkg-config
+ rust-analyzer
+ rustc
+ rustfmt
+ yamlfmt
+ ];
+ buildInputs = [
+ openssl
+ ];
+ env.HK_PKL_BACKEND = "pklr";
+ env.OCAMLRUNPARAM = "s=16M,o=500,O=1000000";
+ env.RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
+ env.RUSTC_VERSION = overrides.toolchain.channel;
};
- });
+ }
+ );
packages = forEachSystem (system: {
default = pkgsFor.${system}.callPackage ./default.nix { };
});
+ formatter = forEachSystem (system: nixpkgs.${system}.nixfmt);
};
}
diff --git a/hk.pkl b/hk.pkl
index beb3bf4..5be538e 100644
--- a/hk.pkl
+++ b/hk.pkl
@@ -6,8 +6,13 @@ local message = new Mapping {
}
local builtins = new Mapping {
- ["check-merge-conflict"] = Builtins.check_merge_conflict
+ ["cargo-check"] = Builtins.cargo_check
+ ["cargo-clippy"] = Builtins.cargo_clippy
+ ["cargo-fmt"] = Builtins.cargo_fmt
["check-case-conflict"] = Builtins.check_case_conflict
+ ["check-merge-conflict"] = Builtins.check_merge_conflict
+ ["end-of-file-fixer"] = Builtins.newlines
+ ["trailing-whitespace"] = Builtins.trailing_whitespace
["yamlfmt"] = Builtins.yamlfmt
}
@@ -18,27 +23,15 @@ local local_hooks = new Mapping {
check = "codespell -c {{files}}"
fix = "codespell -cw {{files}}"
}
- ["cargo-fmt"] {
- glob = "**/*.rs"
- check = "cargo fmt --all"
- fix = "cargo fmt --all"
- }
- ["cargo-check"] {
- glob = "**/*.rs"
- check = "cargo check"
- fix = "cargo fix --allow-dirty --allow-staged"
- }
- ["cargo-clippy"] {
- glob = "**/*.rs"
- check = "cargo clippy -- -D warnings"
- fix = "cargo clippy --fix --allow-dirty"
- }
["version-check"] {
check = "scripts/check-version.sh"
}
["git-check"] {
check = "scripts/check-git.sh"
}
+ ["nix fmt"] {
+ fix = "nixfmt flake.nix"
+ }
}
hooks {