numtide / treefmt-nix

treefmt nix configuration
https://numtide.github.io/treefmt/
MIT License
258 stars 78 forks source link

nix fmt errors out with "warnings does not exist" #210

Open kjeremy opened 3 months ago

kjeremy commented 3 months ago

Describe the bug

$ nix fmt
warning: Git tree '/home/jkolb/ara/mrak-robot' is dirty
error:
       … while calling the 'head' builtin
         at /nix/store/16ik5rfzbjbl2kxpagqx5rp03hkd32qp-source/lib/attrsets.nix:522:11:
          521|         || pred here (elemAt values 1) (head values) then
          522|           head values
             |           ^
          523|         else

       … while calling the 'head' builtin
         at /nix/store/16ik5rfzbjbl2kxpagqx5rp03hkd32qp-source/lib/attrsets.nix:522:11:
          521|         || pred here (elemAt values 1) (head values) then
          522|           head values
             |           ^
          523|         else

       … while calling the 'head' builtin
         at /nix/store/16ik5rfzbjbl2kxpagqx5rp03hkd32qp-source/lib/attrsets.nix:522:11:
          521|         || pred here (elemAt values 1) (head values) then
          522|           head values
             |           ^
          523|         else

       … while calling the 'head' builtin
         at /nix/store/16ik5rfzbjbl2kxpagqx5rp03hkd32qp-source/lib/attrsets.nix:522:11:
          521|         || pred here (elemAt values 1) (head values) then
          522|           head values
             |           ^
          523|         else

       … while calling the 'head' builtin
         at /nix/store/16ik5rfzbjbl2kxpagqx5rp03hkd32qp-source/lib/attrsets.nix:522:11:
          521|         || pred here (elemAt values 1) (head values) then
          522|           head values
             |           ^
          523|         else

       … while evaluating the attribute 'config.build.wrapper'
         at /nix/store/16ik5rfzbjbl2kxpagqx5rp03hkd32qp-source/lib/modules.nix:363:9:
          362|         options = checked options;
          363|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          364|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: The option `warnings' does not exist. Definition values:
       - In `/nix/store/p3qlccgpbygl0qpjcw9j9b0dx3vpdxrn-source/programs/ruff.nix': [ ]

To Reproduce

Steps to reproduce the behavior:

  1. Add nixtree-fmt to your flake
  2. run nix fmt

Expected behavior

It should work

System information

$ nix --version
nix (Nix) 2.23.3

cat flake.lock

{
  "nodes": {
    "flake-utils": {
      "locked": {
        "lastModified": 1659877975,
        "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "nix-ros": {
      "inputs": {
        "flake-utils": [
          "flake-utils"
        ],
        "nixpkgs": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1664303028,
        "narHash": "sha256-7UuUEIkPxqDMDrfmFJZ/gdM6nGFpUzBWe10ss41Kofk=",
        "owner": "lopsided98",
        "repo": "nix-ros-overlay",
        "rev": "139ab5d3fa3c8327c2cf493d8b6e45b39f9714dd",
        "type": "github"
      },
      "original": {
        "owner": "lopsided98",
        "repo": "nix-ros-overlay",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1672580127,
        "narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "0874168639713f547c05947c76124f78441ea46c",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-22.05",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "flake-utils": "flake-utils",
        "nix-ros": "nix-ros",
        "nixpkgs": "nixpkgs",
        "treefmt-nix": "treefmt-nix"
      }
    },
    "treefmt-nix": {
      "inputs": {
        "nixpkgs": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1722330636,
        "narHash": "sha256-uru7JzOa33YlSRwf9sfXpJG+UAV+bnBEYMjrzKrQZFw=",
        "owner": "numtide",
        "repo": "treefmt-nix",
        "rev": "768acdb06968e53aa1ee8de207fd955335c754b7",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "treefmt-nix",
        "type": "github"
      }
    }
  },
  "root": "root",
  "version": 7
}

Removing inputs.nixpkgs.follows = "nixpkgs"; from my flake doesn't help.

Additional context

zimbatm commented 3 months ago

I suspect the issue is that nixos-22.05 is too old and doesn't support https://github.com/numtide/treefmt-nix/blob/768acdb06968e53aa1ee8de207fd955335c754b7/programs/ruff.nix#L7

kjeremy commented 3 months ago

Even if not overriding nixpkgs in my flake?

On Sat, Aug 10, 2024, 5:29 AM Jonas Chevalier @.***> wrote:

I suspect the issue is that nixos-22.05 is too old and doesn't support https://github.com/numtide/treefmt-nix/blob/768acdb06968e53aa1ee8de207fd955335c754b7/programs/ruff.nix#L7

— Reply to this email directly, view it on GitHub https://github.com/numtide/treefmt-nix/issues/210#issuecomment-2280593911, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBACREGTIZFD7SXYURUJK3ZQXMO3AVCNFSM6AAAAABMHI4Y6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBQGU4TGOJRGE . You are receiving this because you authored the thread.Message ID: @.***>

kjeremy commented 3 months ago

I suspect the issue is that nixos-22.05 is too old and doesn't support

https://github.com/numtide/treefmt-nix/blob/768acdb06968e53aa1ee8de207fd955335c754b7/programs/ruff.nix#L7

mkRenamedOptionModule was introduced well before 22.05 so I don't think that's it.

zimbatm commented 3 months ago

I don't know how to reproduce the error, sorry