Skip to content

Commit

Permalink
Make the nix stuff work reliably (#70)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
iamrecursion authored Oct 2, 2024
1 parent 12eb081 commit 98aab5d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cargo clippy --all-targets --all-features -- -D warnings && cargo +nightly fmt && npx lint-staged
npx lint-staged
8 changes: 6 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand 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
];
};
}
);
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 98aab5d

Please sign in to comment.