Synthetica9 / nix-linter

Linter for the Nix expression language
BSD 3-Clause "New" or "Revised" License
158 stars 16 forks source link

Failure when parsing `foo ? ./${bar}` #67

Open azahi opened 1 year ago

azahi commented 1 year ago

Given this valid Nix expression:

{
  inputs,
  lib,
}:
with lib; let
  mkConfiguration = name: {
    modules ? [],
    configuration ? ./${name},
    this ? my.configurations.${name},
  }:
    nameValuePair name (nixosSystem {
      inherit (this) system;
      modules =
        attrValues inputs.self.nixosModules
        ++ modules
        ++ [(import configuration)];
      specialArgs = {inherit inputs lib this;};
    });
in
  mapAttrs' mkConfiguration {
    melian.modules = with inputs; [
      nixos-hardware.nixosModules.common-pc-laptop-ssd
      nixos-hardware.nixosModules.lenovo-thinkpad-t480
      nixpkgs.nixosModules.notDetected
    ];
};

nix-linter 0.2.0.4 fails with:

Failure when parsing:
configurations/default.nix:8:23:
  |
8 |     configuration ? ./${name},
  |                       ^
unexpected '$'
expecting '!', '-', or path

Not sure if I must report it here or in the hnix repo.