Skip to content

Commit

Permalink
Move nixsa_build stuff to nixsa-build/
Browse files Browse the repository at this point in the history
  • Loading branch information
noamraph committed Aug 16, 2024
1 parent e010acf commit 76ef4e0
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
9 changes: 7 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@
check-editorconfig
touch $out
'';
check-ruff = pkgs.runCommand "check-ruff" { buildInputs = [ check.check-ruff ]; } ''
cd ${./nixsa-build}
check-ruff
touch $out
'';
});

packages = forAllSystems
Expand All @@ -182,7 +187,7 @@
nixsa-dir = pkgs.stdenv.mkDerivation {
pname = "nixsa-dir";
inherit version;
src = ./.;
src = ./nixsa-build;
buildInputs = [ pkgs.python3 pkgs.bubblewrap ];
buildPhase = ''
set -x
Expand All @@ -196,7 +201,7 @@
nixsa-tarball = pkgs.stdenv.mkDerivation {
pname = "nixsa-tarball";
inherit version;
src = ./.;
src = ./nixsa-build;
buildInputs = [ pkgs.xz ];
buildPhase = ''
dir=nixsa-${version}-${system}
Expand Down
16 changes: 4 additions & 12 deletions lefthook.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,23 @@
parallel = true

[pre-commit.commands.ruff]
root = "nixsa-build"
glob = "*.py"
run = ".venv/bin/ruff check --fix --exit-non-zero-on-fix {all_files}"

[pre-commit.commands.ruff-fmt]
root = "nixsa-build"
glob = "*.py"
# Needed since currenty ruff-fmt doesn't support both fixing and returning non-zero on change.
# See https://github.com/astral-sh/ruff/issues/8191
run = "if ! .venv/bin/ruff format --check {all_files}; then .venv/bin/ruff format {all_files}; false; fi"

[pre-commit.commands.pylint]
root = "nixsa-build"
glob = "*.py"
run = ".venv/bin/pylint -rn -sn {all_files}"

[pre-commit.commands.mypy]
root = "nixsa-build"
glob = "*.py"
run = ".venv/bin/mypy --strict {all_files}"

[pre-commit.commands.cargo-fmt]
root = "tools/trail/trail_gcc"
glob = "*.rs"
# I add {all_files} as a comment because otherwise `leftcommit run --all-files pre-commit` only runs on staged files
run = "if ! cargo fmt -- --check --files-with-diff ; then cargo fmt; false; fi # {all_files}"

[pre-commit.commands.clippy]
root = "tools/trail/trail_gcc"
glob = "*.rs"
# I add {all_files} as a comment because otherwise `leftcommit run --all-files pre-commit` only runs on staged files
run = "cargo clippy -q -- -Dwarnings # {all_files}"
10 changes: 10 additions & 0 deletions nix/check.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ in
cargo-semver-checks semver-checks check-release
'';
});

# Clippy
check-clippy = (writeShellApplication {
name = "check-clippy";
Expand All @@ -60,4 +61,13 @@ in
'';
});

# Ruff
check-ruff = (writeShellApplication {
name = "check-ruff";
runtimeInputs = [ pkgs.ruff ];
text = ''
ruff check
'';
});

}
File renamed without changes.
File renamed without changes.
9 changes: 3 additions & 6 deletions pyproject.toml → nixsa-build/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[project]
name = "nixsa"
name = "nixsa-build"
version = "0.1.0"
description = "Add your description here"
description = "build the nixsa dir"
authors = [{ name = "Noam Yorav-Raphael", email = "[email protected]" }]
dependencies = []
readme = "README.md"
readme = "../README.md"
requires-python = ">= 3.8"

[build-system]
Expand All @@ -24,9 +24,6 @@ dev-dependencies = [
[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/nixsa"]

[tool.ruff]
line-length = 120

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 76ef4e0

Please sign in to comment.