Mic92 / nix-update

Swiss-knife for updating nix packages.
MIT License
504 stars 46 forks source link

use `nixfmt` with `--format` #251

Closed getchoo closed 4 months ago

getchoo commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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

Mic92 commented 5 months ago

@mergify queue

mergify[bot] commented 5 months ago

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at *9ed2ca4778f1c6834ce033ef007d6be8046e4d67*
Mic92 commented 5 months ago

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: https://github.com/Mic92/nix-update/issues/253

Guanran928 commented 5 months ago

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 commented 4 months ago

@mergify rebase

mergify[bot] commented 4 months ago

rebase

✅ Branch has been successfully rebased

colemickens commented 4 months ago
  $ 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 commented 4 months ago
  FileNotFoundError: [Errno 2] No such file or directory: 'nixfmt'

You might need nixfmt in your $PATH

colemickens commented 4 months ago

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.