treewide: introduce formatter#314
Conversation
|
Resolved merge conflicts and rebased on main. |
|
This is what the deadnix formatter also includes when it's run. diff --git a/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix b/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix
index 6e1f324..413fffd 100644
--- a/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix
+++ b/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix
@@ -1,5 +1,4 @@
{
- lib,
fetchFromGitHub,
alsa-ucm-conf,
}:
diff --git a/apple-silicon-support/packages/asahi-audio/default.nix b/apple-silicon-support/packages/asahi-audio/default.nix
index 7c0582c..553c739 100644
--- a/apple-silicon-support/packages/asahi-audio/default.nix
+++ b/apple-silicon-support/packages/asahi-audio/default.nix
@@ -1,6 +1,5 @@
{
stdenv,
- lib,
fetchFromGitHub,
lsp-plugins,
bankstown-lv2,
diff --git a/apple-silicon-support/packages/linux-asahi/default.nix b/apple-silicon-support/packages/linux-asahi/default.nix
index 19edef0..cd4b868 100644
--- a/apple-silicon-support/packages/linux-asahi/default.nix
+++ b/apple-silicon-support/packages/linux-asahi/default.nix
@@ -75,12 +75,11 @@ let
stdenv,
lib,
fetchFromGitHub,
- fetchpatch,
linuxKernel,
rustc,
rust-bindgen,
...
- }@args:
+ }:
let
origConfigText = builtins.readFile origConfigfile;
@@ -118,8 +117,6 @@ let
builtins.listToAttrs (map makePair (lib.lists.reverseList configList));
# used to fix issues when nixpkgs gets ahead of the kernel
- rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version);
- bindgenAtLeast = version: withRust && (lib.versionAtLeast rust-bindgen.unwrapped.version version);
in
linuxKernel.manualConfig rec {
inherit stdenv lib;
diff --git a/apple-silicon-support/packages/m1n1/default.nix b/apple-silicon-support/packages/m1n1/default.nix
index 7628ed5..d117d5a 100644
--- a/apple-silicon-support/packages/m1n1/default.nix
+++ b/apple-silicon-support/packages/m1n1/default.nix
@@ -29,7 +29,7 @@ let
stdenv = lib.recursiveUpdate buildPackages.stdenv stdenvOpts;
};
rustPackages = rust.packages.stable.overrideScope (
- f: p: {
+ _f: p: {
rustc-unwrapped = p.rustc-unwrapped.override {
stdenv = lib.recursiveUpdate p.rustc-unwrapped.stdenv stdenvOpts;
};
diff --git a/iso-configuration/default.nix b/iso-configuration/default.nix
index 1ae8e42..9397e01 100644
--- a/iso-configuration/default.nix
+++ b/iso-configuration/default.nix
@@ -1,7 +1,6 @@
# configuration that is specific to the ISO
{
config,
- pkgs,
lib,
...
}:
diff --git a/iso-configuration/installer-configuration.nix b/iso-configuration/installer-configuration.nix
index 4970784..129de68 100644
--- a/iso-configuration/installer-configuration.nix
+++ b/iso-configuration/installer-configuration.nix
@@ -98,13 +98,13 @@
};
nixpkgs.overlays = [
- (final: prev: {
+ (_final: prev: {
# disabling pcsclite avoids the need to cross-compile gobject
# introspection stuff which works now but is slow and unnecessary
libfido2 = prev.libfido2.override {
withPcsclite = false;
};
- openssh = prev.openssh.overrideAttrs (old: {
+ openssh = prev.openssh.overrideAttrs (_old: {
# we have to cross compile openssh ourselves for whatever reason
# but the tests take quite a long time to run
doCheck = false; |
|
I can optionally add deadnix as a formatter. |
|
I've added deadnix as a formatter, this has the effect of introducing a '_' character to functions whose parameters are unused as well as cleaning up any unused code. I've also reworded some commits and updated the ignore revision. |
|
My personal thoughts:
|
|
Responding to @tpwrules
1: https://github.com/NixOS/nixfmt/releases/tag/v1.0.0 |
|
Resolved merge conflicts and rebased on current main. |
Enables formatting support via `nix fmt` and `nix flake check` for Nix code.
|
Resolved merge conflicts and rebased on main. |
|
@normalcea I'm ok with Let's add CI soon, to prevent something accidentially being merged unformatted, but that can be a followup. Thanks! |
tpwrules
left a comment
There was a problem hiding this comment.
Tested that nix fmt works and makes the same set of changes. Also checked that it doesn't change the system derivation.
|
@normalcea I upgraded nixpkgs to a two month newer revision and the new Can you help me understand why the difference is so big? I would have expected the Maybe the wrong version got picked when I requested that we follow this flake's nixpkgs? |
|
It looks like there was actually that much difference between Are other users just doing the same? |
|
Yes there should be another treewide re-format similar to this PR when the flake inputs are upgraded. |
|
Okay, I didn't realize that was a necessary step. We'll see how that goes. I guess it's good that we can control exactly when the formatter changes. |
Since this is under the
nix-communitybanner, this project should decide on a formatter. This PR currently choosesnixfmt-rfc-styleviagithub:numtide/treefmt-nixflake, formats all files, and adds a.git-blame-ignore-revsfile to ignore this mass reformat when blaming.This would also allow for pre-commit hooks for formatting all files as well as automatic merge checks when opening additional PRs which reduces the chance of merge conflicts occurring.