use nixfmt with --format

This commit is contained in:
seth 2024-05-20 03:21:22 -04:00 committed by mergify[bot]
parent e278a56d12
commit 3b1c559db5
4 changed files with 5 additions and 6 deletions

View File

@ -140,7 +140,7 @@ tested. Additionally, the `--review` flag can be used to
initiate a run of [nixpkgs-review](https://github.com/Mic92/nixpkgs-review), which will ensure all
dependent packages can be built. In order to ensure consistent
formatting, the `--format` flag will invoke
[nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt).
[nixfmt](https://github.com/NixOS/nixfmt).
```console
# Also runs nix-build

View File

@ -21,7 +21,7 @@ pkgs.python311.pkgs.buildPythonApplication {
makeWrapperArgs = [
"--prefix PATH"
":"
(pkgs.lib.makeBinPath [ pkgs.nixVersions.stable or pkgs.nix_2_4 pkgs.nixpkgs-review pkgs.nix-prefetch-git ])
(pkgs.lib.makeBinPath [ pkgs.nixVersions.stable or pkgs.nix_2_4 pkgs.nixpkgs-review pkgs.nix-prefetch-git pkgs.nixfmt-rfc-style ])
];
shellHook = ''
# workaround because `python setup.py develop` breaks for me

View File

@ -31,7 +31,7 @@ def parse_args(args: list[str]) -> Options:
parser.add_argument(
"--review", action="store_true", help="Run `nixpkgs-review wip`"
)
parser.add_argument("--format", action="store_true", help="Run `nixpkgs-fmt`")
parser.add_argument("--format", action="store_true", help="Run `nixfmt`")
parser.add_argument(
"--commit", action="store_true", help="Commit the updated package"
)
@ -326,7 +326,7 @@ def main(args: list[str] = sys.argv[1:]) -> None:
nixpkgs_review()
if options.format:
run(["nixpkgs-fmt", package.filename], stdout=None)
run(["nixfmt", package.filename], stdout=None)
if options.commit:
assert git_dir is not None

View File

@ -27,8 +27,7 @@ from .version import Version, VersionPreference
class SnapshotFetcher(Protocol):
def __call__(self, url: ParseResult, branch: str) -> list[Version]:
...
def __call__(self, url: ParseResult, branch: str) -> list[Version]: ...
fetchers: list[Callable[[ParseResult], list[Version]]] = [