Skip to content
This repository was archived by the owner on Feb 25, 2019. It is now read-only.
This repository was archived by the owner on Feb 25, 2019. It is now read-only.

Feature names beginning with numbers break builds #2

Description

@tazjin

Issue description

Some Rust crates (most prominently Diesel) have features with
names that start with numbers.

In the current implementation of Carnix, these generate unquoted
attribute set keys which end up breaking the Nix parser.

Example from the Cargo.nix of a project depending on Diesel:

  diesel_1_2_2_features = f: updateFeatures f (rec {
    bitflags_1_0_2.default = true;
    byteorder_1_2_2.default = true;

                 ----- This breaks Nix
                 v
    diesel_1_2_2.128-column-tables =
      (f.diesel_1_2_2.128-column-tables or false) ||
      (f.diesel_1_2_2.x128-column-tables or false) ||
      (diesel_1_2_2.x128-column-tables or false);

                 ----- Same here
                 v
    diesel_1_2_2.32-column-tables = ....;

Leads to errors like this:

error: syntax error, unexpected FLOAT, expecting '.' or '=', at /home/vincent/projects/REDACTED/Cargo.nix:2358:17

An easy fix would be to simply quote all feature names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions