From f882157fb20c3016b2a4afac87edbbd647fb53d9 Mon Sep 17 00:00:00 2001 From: Ara Adkins Date: Wed, 2 Oct 2024 11:17:56 -0600 Subject: [PATCH] Make the nix stuff work reliably This fixes some commands that were depending on things being in the system path and not provided by the nix development environment. It also makes the precommit hooks more efficient, now only ever running on changed files as needed. --- .husky/pre-commit | 2 +- flake.nix | 8 ++++++-- package.json | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index f1f12b5..2312dc5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -cargo clippy --all-targets --all-features -- -D warnings && cargo +nightly fmt && npx lint-staged +npx lint-staged diff --git a/flake.nix b/flake.nix index 554a6c8..3afb3c5 100644 --- a/flake.nix +++ b/flake.nix @@ -71,9 +71,9 @@ # We get your default shell to make sure things feel familiar in the dev shell. getUserShellCommand = if pkgs.stdenv.hostPlatform.isDarwin then - "dscl . -read ~ UserShell | cut -d ' ' -f2" + "dscl . -read ~ UserShell | cut -d ' ' -f2 | tr -d '\n'" else - "getent passwd $USER | cut -d ':' -f7"; + "getent passwd $USER | cut -d ':' -f7 | tr -d '\n'"; in { packages = { inherit all; @@ -98,6 +98,10 @@ devShells.ci = craneLib.devShell { LLVM_SYS_180_PREFIX = "${pkgs.lib.getDev pkgs.llvmPackages_18.libllvm}"; inputsFrom = lib.attrValues llvmToCairo; + + packages = [ + pkgs.nodejs_22 + ]; }; } ); diff --git a/package.json b/package.json index 43ebda2..03ea888 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,15 @@ "lint-staged": { "(*.md|*.toml|*.json|*.yaml|*.yml|*.css|*.js|*.ts)": [ "prettier --write" + ], + "*.rs": [ + "rustfmt --unstable-features --edition 2021", + "clippy-driver" ] }, "husky": { "hooks": { - "pre-commit": "npx lint-staged && cargo clippy -- -D warnings" + "pre-commit": "npx lint-staged" } }, "scripts": {