nix config show --json outputs experimental-features as integer bitmap #738
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#738
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
Running
nix config show --jsonrenders thevaluefield ofexperimental-featuresas an integer bitmap, likely because oflix-project/lix@007211e7a2.Thank to Vaskel for finding this (I don't think she's registered here).
Steps To Reproduce
Execute
nix config show --json | jq '."experimental-features"'Expected behavior
Get the same output as in Lix 2.91, which is a list of strings with the names of the active experimental features:
nix --versionoutputnix (Lix, like Nix) 2.93.0-devpre20250314_af15a44
Additional context
Running
nix config showwithout--jsonstill correctly serializes theexperimental-featuresto their string representations:wait, what. nlohmann json automatically casts scoped enum to ints. that's some cursed nonsense right there
is this a screw up involving experimental-features-json.hh that would otherwise set up the necessary specialization to not screw this up? i might have a CL deleting that file that's languishing for some reason; there's a ticket for it.
it doesn't look like it. that header implement json hooks for
ExperimentalFeature, notExperimentalFeatures, which is the bitmap type ofExperimentalFeature:/looked at this for a bit and concluded that we need to abandon using straight
nlohmann:jsonobjects and define our ownbasic_jsonspecialization instead; one that doesn't use the default adl_serializer but a variant that simply rejects enum typesThis issue was mentioned on Gerrit on the following CLs:
this seems to have affected 2.92 as well
@pennae wrote in #738 (comment):
Yes,
007211e7a2was already shipped in 2.92