Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: specify that flake.lock files are JSON #11594

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

Jayman2000
Copy link
Contributor

@Jayman2000 Jayman2000 commented Sep 25, 2024

Motivation

To make it 100% clear that flake.lock files should be parsed as JSON. This is desirable for people who want to write code that process flake.lock files and want to make sure that their code parses them correctly.

Context

Recently, I decided that I was going to write some code that would parse flake.lock files. I went to the Nix Reference Manual in order to look up information on the format of flake.lock files, and I realized that a key detail was missing from the Nix Reference Manual: it never says that flake.lock files are JSON files. This PR fixes that issue.

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Recently, I decided that I was going to write some code that would parse
flake.lock files. I went to the Nix Reference Manual in order to look up
information on the format of flake.lock files, and I realized that a key
detail was missing from the Nix Reference Manual: it never says that
flake.lock files are JSON files. This commit fixes that issue.

This commit makes sure to specify that flake.lock files are encoded in
UTF-8. Confusingly, there’s multiple different JSON standards. Neither
ECMA-404, 2nd Edition [1] nor ISO/IEC 21778:2017 [2] mention UTF-8. RFC
8259 requires UTF-8, but only sometimes [3]. I chose to explicitly
specify that flake.lock files are UTF-8 in order to avoid any possible
ambiguities from the JSON standards.

[1]: <https://ecma-international.org/publications-and-standards/standards/ecma-404>
[2]: <https://www.iso.org/standard/71616.html>
[3]: <https://www.rfc-editor.org/rfc/rfc8259.html#section-8.1>
@github-actions github-actions bot added documentation new-cli Relating to the "nix" command labels Sep 25, 2024
src/nix/flake.md Outdated Show resolved Hide resolved
@fricklerhandwerk fricklerhandwerk enabled auto-merge (squash) September 25, 2024 23:41
@fricklerhandwerk fricklerhandwerk merged commit a5959aa into NixOS:master Sep 26, 2024
11 checks passed
@Jayman2000 Jayman2000 deleted the flack.lock-is-json branch September 26, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation new-cli Relating to the "nix" command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants