Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use nixfmt with --format #251

Merged
merged 3 commits into from
Jun 6, 2024
Merged

use nixfmt with --format #251

merged 3 commits into from
Jun 6, 2024

Conversation

getchoo
Copy link
Contributor

@getchoo getchoo commented May 21, 2024

following rfc 166, nixfmt is now the official formatter for nix and slowing becoming more commonplace in both nixpkgs and the community. though it isn't stable just yet, i think it might be good to start using it sooner rather than later

@SuperSandro2000
Copy link
Collaborator

IMO we should probably drop that option entirely from a tool that is about updating packages since those changes also most of the time should get their own commit.

@getchoo
Copy link
Contributor Author

getchoo commented May 22, 2024

i personally use this a lot to make sure that any changes i've (or nix-update) have made are still inline with the previous styling. i've been doing this less lately mainly because it's still using nixpkgs-fmt

i think it may be nice to have an option for a separate format commit, though - as that would be more inline with what we should be doing

default.nix Outdated Show resolved Hide resolved
@Mic92
Copy link
Owner

Mic92 commented May 30, 2024

@mergify queue

Copy link
Contributor

mergify bot commented May 30, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 9ed2ca4

@Mic92
Copy link
Owner

Mic92 commented May 30, 2024

IMO we should probably drop that option entirely from a tool that is about updating packages since those changes also most of the time should get their own commit.

I think that's too late now. I feel like already too many people depend on it: #253

@Guanran928
Copy link

Guanran928 commented May 30, 2024

IMO we should probably drop that option entirely from a tool that is about updating packages since those changes also most of the time should get their own commit.

I think that's too late now. I feel like already too many people depend on it: #253

I created the issue because nix-update was depending on nixpkgs-fmt, I think removing --format is a good idea.

image

@Mic92
Copy link
Owner

Mic92 commented Jun 6, 2024

@mergify rebase

getchoo and others added 3 commits June 6, 2024 12:17
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/8c9fa2545007b49a5db5f650ae91f227672c3877' (2023-11-01)
  → 'github:hercules-ci/flake-parts/8dc45382d5206bd292f9c2768b8058a8fd8311d9' (2024-05-16)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/ec750fd01963ab6b20ee1f0cb488754e8036d89d' (2023-11-07)
  → 'github:NixOS/nixpkgs/5a5ac83292c7842072318f57d68a48474f8bd34d' (2024-05-20)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/5deb8dc125a9f83b65ca86cf0c8167c46593e0b1' (2023-10-27)
  → 'github:numtide/treefmt-nix/2fba33a182602b9d49f0b2440513e5ee091d838b' (2024-05-17)
Copy link
Contributor

mergify bot commented Jun 6, 2024

rebase

✅ Branch has been successfully rebased

@mergify mergify bot merged commit 9ed2ca4 into Mic92:master Jun 6, 2024
4 checks passed
@colemickens
Copy link

  $ nixfmt /var/lib/github-actions-runners/raisin-default/work/nixcfg/nixcfg/pkgs/alacritty/default.nix
  Traceback (most recent call last):
    File "/nix/store/kjknpmby5d3ff565aq7ldmklzr2pxfx8-nix-update-1.0.0/bin/.nix-update-wrapped", line 9, in <module>
      sys.exit(main())
               ^^^^^^
    File "/nix/store/kjknpmby5d3ff565aq7ldmklzr2pxfx8-nix-update-1.0.0/lib/python3.11/site-packages/nix_update/__init__.py", line 329, in main
      run(["nixfmt", package.filename], stdout=None)
    File "/nix/store/kjknpmby5d3ff565aq7ldmklzr2pxfx8-nix-update-1.0.0/lib/python3.11/site-packages/nix_update/utils.py", line 37, in run
      return subprocess.run(
             ^^^^^^^^^^^^^^^
    File "/nix/store/6b1fqdwb3g56j5pazv8zkx9qd0mv3wiz-python3-3.11.9/lib/python3.11/subprocess.py", line 548, in run
      with Popen(*popenargs, **kwargs) as process:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/nix/store/6b1fqdwb3g56j5pazv8zkx9qd0mv3wiz-python3-3.11.9/lib/python3.11/subprocess.py", line 1026, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File "/nix/store/6b1fqdwb3g56j5pazv8zkx9qd0mv3wiz-python3-3.11.9/lib/python3.11/subprocess.py", line 1955, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'nixfmt'

I get this recently, seems related to this PR.

@Guanran928
Copy link

  FileNotFoundError: [Errno 2] No such file or directory: 'nixfmt'

You might need nixfmt in your $PATH

@colemickens
Copy link

sure, nixfmt docs say its in nixpkgs, but it's not. So I guess I'll go hunt the derivation name.

I guess it's nixfmt-rfc-style. Thanks.

@getchoo getchoo deleted the nixfmt branch June 29, 2024 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants