Compare commits
199
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da9ade20e3 | ||
|
|
7448aedd74 | ||
|
|
19db567c67 | ||
|
|
c5fa5e503a | ||
|
|
afc2b96c5e | ||
|
|
f2465bccba | ||
|
|
bc0af77ba7 | ||
|
|
8ab5c2bc21 | ||
|
|
61de9222b0 | ||
|
|
28107db1bb | ||
|
|
6ffdd4652b | ||
|
|
401e08f839 | ||
|
|
14feb36cd6 | ||
|
|
8f89d8c139 | ||
|
|
623f3d321e | ||
|
|
e73bb666c5 | ||
|
|
02055c5a48 | ||
|
|
c080c4ca56 | ||
|
|
907a5761fa | ||
|
|
a95580e468 | ||
|
|
8c2027e138 | ||
|
|
26bf932e41 | ||
|
|
386d1d54bd | ||
|
|
32bc0ac43e | ||
|
|
ffc5dffa65 | ||
|
|
c5c05e44b3 | ||
|
|
b9b6defca6 | ||
|
|
22f993fab6 | ||
|
|
0302cd00c9 | ||
|
|
2f80fc473f | ||
|
|
d4434809fe | ||
|
|
1d56f413c2 | ||
|
|
d8ad0006c0 | ||
|
|
4652345ac3 | ||
|
|
6fb5276e7b | ||
|
|
97a60c1fab | ||
|
|
1039b6719b | ||
|
|
42d7d9676d | ||
|
|
ab0ca5f922 | ||
|
|
cca8b5ca60 | ||
|
|
d007b4e81b | ||
|
|
843629f7bf | ||
|
|
525755dadc | ||
|
|
5d7f6efc82 | ||
|
|
2bf3235115 | ||
|
|
0db70b8184 | ||
|
|
b61885786d | ||
|
|
c8601a27df | ||
|
|
d5099279f8 | ||
|
|
ee30827e20 | ||
|
|
3632abb7a5 | ||
|
|
5f42e5ebb7 | ||
|
|
926092f67f | ||
|
|
20fc54c00d | ||
|
|
294e68a3f6 | ||
|
|
92d4fafd53 | ||
|
|
953e7b8af4 | ||
|
|
c5ed22dd41 | ||
|
|
a595348f7c | ||
|
|
a4fc3863dd | ||
|
|
c555af2c77 | ||
|
|
5f73c6b416 | ||
|
|
f9089deb20 | ||
|
|
9246dca541 | ||
|
|
676fb0fffc | ||
|
|
9f0d1e9509 | ||
|
|
1ad13a1423 | ||
|
|
7f1712957a | ||
|
|
a4680cd9bb | ||
|
|
b69c565fdb | ||
|
|
ee9fb29c7b | ||
|
|
69920f9557 | ||
|
|
bec3c5cfcd | ||
|
|
29849afa63 | ||
|
|
5b95745bc9 | ||
|
|
8d0e289fb9 | ||
|
|
c338f9cc5d | ||
|
|
c7801fc347 | ||
|
|
c4dc42f306 | ||
|
|
ab6dcf2047 | ||
|
|
863f6811e4 | ||
|
|
96d8b54e42 | ||
|
|
d1f9fe984b | ||
|
|
ec6789f9da | ||
|
|
e67c97b5f0 | ||
|
|
1b2cb1d75c | ||
|
|
7f3ad17ac2 | ||
|
|
2f6550b7a7 | ||
|
|
0aef1ddb9e | ||
|
|
2636f50dd4 | ||
|
|
0ec93e7ae7 | ||
|
|
c0c1bde506 | ||
|
|
d2615571e2 | ||
|
|
18e31d404b | ||
|
|
0f4c7204f7 | ||
|
|
2c28502bc4 | ||
|
|
34e92724d6 | ||
|
|
890a4e980a | ||
|
|
a922a42b33 | ||
|
|
7eab0bf9aa | ||
|
|
1e9b1ff851 | ||
|
|
4b3536e092 | ||
|
|
4ad272015e | ||
|
|
40e3f5c0a4 | ||
|
|
bf7c53f2d3 | ||
|
|
1cc337bb5f | ||
|
|
d888846b68 | ||
|
|
8be9507a88 | ||
|
|
5b175ace18 | ||
|
|
430bcda3ea | ||
|
|
d7c29383c6 | ||
|
|
ee5860f542 | ||
|
|
dacd5eac64 | ||
|
|
3a32039508 | ||
|
|
01dbbc926f | ||
|
|
18f3598d57 | ||
|
|
c33b2c5834 | ||
|
|
686ad9b052 | ||
|
|
13b4512cbe | ||
|
|
0903b0aa7d | ||
|
|
a2acb6d7aa | ||
|
|
048a58d331 | ||
|
|
7dfad3dba7 | ||
|
|
140c5f69f0 | ||
|
|
11b0fcd6cd | ||
|
|
98c7ca2c9f | ||
|
|
a3d77a4bf2 | ||
|
|
ad07be0a55 | ||
|
|
16f218b37c | ||
|
|
35492fe94a | ||
|
|
7c76a812fe | ||
|
|
d3aa04561f | ||
|
|
80c545bcdc | ||
|
|
1e36f203e6 | ||
|
|
38bb7f532c | ||
|
|
37cf990b41 | ||
|
|
3e8c220b60 | ||
|
|
aa0265f77e | ||
|
|
e7f95783db | ||
|
|
3c2d5a1bdc | ||
|
|
f0390758dd | ||
|
|
e761a9fb6d | ||
|
|
2e262c6685 | ||
|
|
15b222b6d6 | ||
|
|
c38349583f | ||
|
|
31ce0c8169 | ||
|
|
0778b861a9 | ||
|
|
3716bd9a62 | ||
|
|
697b068756 | ||
|
|
6cc44e4fdf | ||
|
|
952be9fc96 | ||
|
|
4031343e44 | ||
|
|
0c0a41a81a | ||
|
|
97abcda9cc | ||
|
|
423e732b22 | ||
|
|
05990fb2ec | ||
|
|
6a4a1e9f72 | ||
|
|
1c10ce6047 | ||
|
|
6f33f64ce5 | ||
|
|
801cb16131 | ||
|
|
e91b7d1732 | ||
|
|
ab58d2720c | ||
|
|
7ba84437be | ||
|
|
d7b6afecdb | ||
|
|
c72f3dc27e | ||
|
|
d1470f76c7 | ||
|
|
84079e10cf | ||
|
|
88c9c6d89d | ||
|
|
4f4da90513 | ||
|
|
3e9104c9ca | ||
|
|
3a9be9fd2f | ||
|
|
0275b64b81 | ||
|
|
622a5cd1bf | ||
|
|
b0c016ae7d | ||
|
|
f78e88c973 | ||
|
|
d8d75cff9f | ||
|
|
f198e9a0b3 | ||
|
|
439af1dca1 | ||
|
|
77990e7cca | ||
|
|
3bac0d7aa2 | ||
|
|
36419a6ccb | ||
|
|
3ba51bf61b | ||
|
|
209f413e80 | ||
|
|
b8d32388bc | ||
|
|
eb53e61e08 | ||
|
|
60f09928d1 | ||
|
|
43a183120a | ||
|
|
0c786f3a3c | ||
|
|
504c5e7cf9 | ||
|
|
5d066386b5 | ||
|
|
c7b61f3d13 | ||
|
|
93c51acfb5 | ||
|
|
d689b764f3 | ||
|
|
620a6947ab | ||
|
|
294acfd807 | ||
|
|
261f674a25 | ||
|
|
08e218eb0b | ||
|
|
2349c3dbde | ||
|
|
f6aeca0522 |
No files matched your search
@@ -20,7 +20,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
app-id: ${{ vars.CI_APP_ID }}
|
app-id: ${{ vars.CI_APP_ID }}
|
||||||
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
# required to find all branches
|
# required to find all branches
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
eval:
|
eval:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: ./.github/actions/install-nix-action
|
- uses: ./.github/actions/install-nix-action
|
||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
name: pre-commit checks
|
name: pre-commit checks
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- uses: ./.github/actions/install-nix-action
|
- uses: ./.github/actions/install-nix-action
|
||||||
with:
|
with:
|
||||||
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
|
||||||
@@ -87,7 +87,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: ./.github/actions/install-nix-action
|
- uses: ./.github/actions/install-nix-action
|
||||||
@@ -162,7 +162,7 @@ jobs:
|
|||||||
name: installer test ${{ matrix.scenario }}
|
name: installer test ${{ matrix.scenario }}
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Download installer tarball
|
- name: Download installer tarball
|
||||||
uses: actions/download-artifact@v6
|
uses: actions/download-artifact@v6
|
||||||
with:
|
with:
|
||||||
@@ -227,7 +227,7 @@ jobs:
|
|||||||
github.ref_name == 'master'
|
github.ref_name == 'master'
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: ./.github/actions/install-nix-action
|
- uses: ./.github/actions/install-nix-action
|
||||||
@@ -276,14 +276,14 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout nix
|
- name: Checkout nix
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
- name: Checkout flake-regressions
|
- name: Checkout flake-regressions
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
repository: NixOS/flake-regressions
|
repository: NixOS/flake-regressions
|
||||||
path: flake-regressions
|
path: flake-regressions
|
||||||
- name: Checkout flake-regressions-data
|
- name: Checkout flake-regressions-data
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
repository: NixOS/flake-regressions-data
|
repository: NixOS/flake-regressions-data
|
||||||
path: flake-regressions/tests
|
path: flake-regressions/tests
|
||||||
@@ -303,7 +303,7 @@ jobs:
|
|||||||
github.event_name == 'push' &&
|
github.event_name == 'push' &&
|
||||||
github.ref_name == 'master'
|
github.ref_name == 'master'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: ./.github/actions/install-nix-action
|
- uses: ./.github/actions/install-nix-action
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ The underlying source files are located in [`doc/manual/source`](./doc/manual/so
|
|||||||
For small changes you can [use GitHub to edit these files](https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files)
|
For small changes you can [use GitHub to edit these files](https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files)
|
||||||
For larger changes see the [Nix reference manual](https://nix.dev/manual/nix/development/development/contributing.html).
|
For larger changes see the [Nix reference manual](https://nix.dev/manual/nix/development/development/contributing.html).
|
||||||
|
|
||||||
|
You're encouraged to add line breaks at semantic boundaries, per [sembr](https://sembr.org).
|
||||||
|
|
||||||
## Getting help
|
## Getting help
|
||||||
|
|
||||||
Whenever you're stuck or do not know how to proceed, you can always ask for help.
|
Whenever you're stuck or do not know how to proceed, you can always ask for help.
|
||||||
|
|||||||
+10
-3
@@ -24,8 +24,15 @@ def map_contents_recursively(transformer):
|
|||||||
def process_command:
|
def process_command:
|
||||||
.[0] as $context |
|
.[0] as $context |
|
||||||
.[1] as $body |
|
.[1] as $body |
|
||||||
$body + {
|
# mdbook 0.5.x uses 'items' instead of 'sections'
|
||||||
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
|
if $body.items then
|
||||||
};
|
$body + {
|
||||||
|
items: $body.items | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$body + {
|
||||||
|
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
|
||||||
|
}
|
||||||
|
end;
|
||||||
|
|
||||||
process_command
|
process_command
|
||||||
@@ -24,12 +24,3 @@ renderers = ["html"]
|
|||||||
command = "jq --from-file ./anchors.jq"
|
command = "jq --from-file ./anchors.jq"
|
||||||
|
|
||||||
[output.markdown]
|
[output.markdown]
|
||||||
|
|
||||||
[output.linkcheck]
|
|
||||||
# no Internet during the build (in the sandbox)
|
|
||||||
follow-web-links = false
|
|
||||||
|
|
||||||
# mdbook-linkcheck does not understand [foo]{#bar} style links, resulting in
|
|
||||||
# excessive "Potential incomplete link" warnings. No other kind of warning was
|
|
||||||
# produced at the time of writing.
|
|
||||||
warning-policy = "ignore"
|
|
||||||
@@ -0,0 +1,223 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Standalone markdown preprocessor for manpage generation.
|
||||||
|
|
||||||
|
Expands {{#include}} directives and handles @docroot@ references
|
||||||
|
without requiring mdbook.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
import argparse
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
def expand_includes(
|
||||||
|
content: str,
|
||||||
|
current_file: Path,
|
||||||
|
source_root: Path,
|
||||||
|
generated_root: Path | None,
|
||||||
|
visited: set[Path] | None = None,
|
||||||
|
) -> str:
|
||||||
|
"""
|
||||||
|
Recursively expand {{#include path}} directives.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content: Markdown content to process
|
||||||
|
current_file: Path to the current file (for resolving relative includes)
|
||||||
|
source_root: Root of the source directory
|
||||||
|
generated_root: Root of generated files (for @generated@/ includes)
|
||||||
|
visited: Set of already-visited files (for cycle detection)
|
||||||
|
"""
|
||||||
|
if visited is None:
|
||||||
|
visited = set()
|
||||||
|
|
||||||
|
# Track current file to detect cycles
|
||||||
|
visited.add(current_file.resolve())
|
||||||
|
|
||||||
|
lines = []
|
||||||
|
include_pattern = re.compile(r'^\s*\{\{#include\s+(.+?)\}\}\s*$')
|
||||||
|
|
||||||
|
for line in content.splitlines(keepends=True):
|
||||||
|
match = include_pattern.match(line)
|
||||||
|
if not match:
|
||||||
|
lines.append(line)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Found an include directive
|
||||||
|
include_path_str = match.group(1).strip()
|
||||||
|
|
||||||
|
# Resolve the include path
|
||||||
|
if include_path_str.startswith("@generated@/"):
|
||||||
|
# Generated file
|
||||||
|
if generated_root is None:
|
||||||
|
raise ValueError(
|
||||||
|
f"Cannot resolve @generated@ path '{include_path_str}' "
|
||||||
|
f"without --generated-root"
|
||||||
|
)
|
||||||
|
include_path = generated_root / include_path_str[12:]
|
||||||
|
else:
|
||||||
|
# Relative to current file
|
||||||
|
include_path = (current_file.parent / include_path_str).resolve()
|
||||||
|
|
||||||
|
# Check for cycles
|
||||||
|
if include_path.resolve() in visited:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Include cycle detected: {include_path} is already being processed"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check that file exists
|
||||||
|
if not include_path.exists():
|
||||||
|
raise FileNotFoundError(
|
||||||
|
f"Include file not found: {include_path_str}\n"
|
||||||
|
f" Resolved to: {include_path}\n"
|
||||||
|
f" From: {current_file}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Recursively expand the included file
|
||||||
|
included_content = include_path.read_text()
|
||||||
|
expanded = expand_includes(
|
||||||
|
included_content,
|
||||||
|
include_path,
|
||||||
|
source_root,
|
||||||
|
generated_root,
|
||||||
|
visited.copy(), # Copy visited set for this branch
|
||||||
|
)
|
||||||
|
lines.append(expanded)
|
||||||
|
# Add newline if the included content doesn't end with one
|
||||||
|
if not expanded.endswith('\n'):
|
||||||
|
lines.append('\n')
|
||||||
|
|
||||||
|
return ''.join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_docroot(content: str, current_file: Path, source_root: Path, docroot_url: str) -> str:
|
||||||
|
"""
|
||||||
|
Replace @docroot@ with nix.dev URL and convert .md to .html.
|
||||||
|
|
||||||
|
For manpages, absolute URLs are more useful than relative paths since
|
||||||
|
manpages are viewed standalone. lowdown will display these as proper
|
||||||
|
references in the manpage output.
|
||||||
|
"""
|
||||||
|
# Replace @docroot@ with the base URL
|
||||||
|
content = content.replace("@docroot@", docroot_url)
|
||||||
|
|
||||||
|
# Convert .md extensions to .html for web links
|
||||||
|
# Use lookahead to ensure that .md occurs before a fragment or a possible URL end.
|
||||||
|
content = re.sub(
|
||||||
|
r'(https://nix\.dev/[^)\s]*?)\.md(?=[#)\s]|$)',
|
||||||
|
r'\1.html',
|
||||||
|
content
|
||||||
|
)
|
||||||
|
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_at_escapes(content: str) -> str:
|
||||||
|
"""Replace @_at_ with @"""
|
||||||
|
return content.replace("@_at_", "@")
|
||||||
|
|
||||||
|
|
||||||
|
def process_file(
|
||||||
|
input_file: Path,
|
||||||
|
source_root: Path,
|
||||||
|
generated_root: Path | None,
|
||||||
|
docroot_url: str,
|
||||||
|
) -> str:
|
||||||
|
"""Process a single markdown file."""
|
||||||
|
content = input_file.read_text()
|
||||||
|
|
||||||
|
# Expand includes
|
||||||
|
content = expand_includes(content, input_file, source_root, generated_root)
|
||||||
|
|
||||||
|
# Resolve @docroot@ references
|
||||||
|
content = resolve_docroot(content, input_file, source_root, docroot_url)
|
||||||
|
|
||||||
|
# Resolve @_at_ escapes
|
||||||
|
content = resolve_at_escapes(content)
|
||||||
|
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Expand markdown includes for manpage generation",
|
||||||
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
|
epilog="""
|
||||||
|
Examples:
|
||||||
|
# Expand a manpage source file
|
||||||
|
%(prog)s \\
|
||||||
|
--source-root doc/manual/source \\
|
||||||
|
--generated-root build/doc/manual/source \\
|
||||||
|
doc/manual/source/command-ref/nix-store/query.md
|
||||||
|
|
||||||
|
# Pipe to lowdown for manpage generation
|
||||||
|
%(prog)s -s doc/manual/source -g build/doc/manual/source \\
|
||||||
|
doc/manual/source/command-ref/nix-env.md | \\
|
||||||
|
lowdown -sT man -M section=1 -o nix-env.1
|
||||||
|
""",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"input_file",
|
||||||
|
type=Path,
|
||||||
|
help="Input markdown file to process",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-s", "--source-root",
|
||||||
|
type=Path,
|
||||||
|
required=True,
|
||||||
|
help="Root directory of markdown sources",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-g", "--generated-root",
|
||||||
|
type=Path,
|
||||||
|
help="Root directory of generated files (for @generated@/ includes)",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-o", "--output",
|
||||||
|
type=Path,
|
||||||
|
help="Output file (default: stdout)",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-u", "--doc-url",
|
||||||
|
type=str,
|
||||||
|
default="https://nix.dev/manual/nix/latest",
|
||||||
|
help="Base URL for documentation links (default: https://nix.dev/manual/nix/latest)",
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Validate paths
|
||||||
|
if not args.input_file.exists():
|
||||||
|
print(f"Error: Input file not found: {args.input_file}", file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if not args.source_root.is_dir():
|
||||||
|
print(f"Error: Source root is not a directory: {args.source_root}", file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if args.generated_root and not args.generated_root.is_dir():
|
||||||
|
print(f"Error: Generated root is not a directory: {args.generated_root}", file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Process the file
|
||||||
|
output = process_file(args.input_file, args.source_root, args.generated_root, args.doc_url)
|
||||||
|
|
||||||
|
# Write output
|
||||||
|
if args.output:
|
||||||
|
args.output.write_text(output)
|
||||||
|
else:
|
||||||
|
print(output, end='')
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error processing {args.input_file}: {e}", file=sys.stderr)
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc(file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Generate redirects.js from template and JSON data."""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
template_path, json_path, output_path = sys.argv[1:]
|
||||||
|
|
||||||
|
with open(json_path) as f:
|
||||||
|
json_content = f.read().rstrip()
|
||||||
|
|
||||||
|
with open(template_path) as f:
|
||||||
|
template = f.read()
|
||||||
|
|
||||||
|
with open(output_path, 'w') as f:
|
||||||
|
f.write(template.replace('@REDIRECTS_JSON@', json_content))
|
||||||
+132
-69
@@ -5,11 +5,29 @@ project(
|
|||||||
license : 'LGPL-2.1-or-later',
|
license : 'LGPL-2.1-or-later',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Compute documentation URL based on version and release type
|
||||||
|
version = meson.project_version()
|
||||||
|
official_release = get_option('official-release')
|
||||||
|
|
||||||
|
if official_release
|
||||||
|
# For official releases, use versioned URL (dropping patch version)
|
||||||
|
version_parts = version.split('.')
|
||||||
|
major_minor = '@0@.@1@'.format(version_parts[0], version_parts[1])
|
||||||
|
doc_url = 'https://nix.dev/manual/nix/@0@'.format(major_minor)
|
||||||
|
else
|
||||||
|
# For development builds, use /latest
|
||||||
|
doc_url = 'https://nix.dev/manual/nix/latest'
|
||||||
|
endif
|
||||||
|
|
||||||
nix = find_program('nix', native : true)
|
nix = find_program('nix', native : true)
|
||||||
|
|
||||||
mdbook = find_program('mdbook', native : true)
|
|
||||||
bash = find_program('bash', native : true)
|
bash = find_program('bash', native : true)
|
||||||
rsync = find_program('rsync', required : true, native : true)
|
|
||||||
|
# HTML manual dependencies (conditional)
|
||||||
|
if get_option('html-manual')
|
||||||
|
mdbook = find_program('mdbook', native : true)
|
||||||
|
rsync = find_program('rsync', required : true, native : true)
|
||||||
|
endif
|
||||||
|
|
||||||
pymod = import('python')
|
pymod = import('python')
|
||||||
python = pymod.find_installation('python3')
|
python = pymod.find_installation('python3')
|
||||||
@@ -57,6 +75,24 @@ generate_manual_deps = files(
|
|||||||
'generate-deps.py',
|
'generate-deps.py',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Generate redirects.js from template and JSON data
|
||||||
|
redirects_js = custom_target(
|
||||||
|
'redirects.js',
|
||||||
|
command : [
|
||||||
|
python,
|
||||||
|
'@INPUT0@',
|
||||||
|
'@INPUT1@',
|
||||||
|
'@INPUT2@',
|
||||||
|
'@OUTPUT@',
|
||||||
|
],
|
||||||
|
input : [
|
||||||
|
'generate-redirects.py',
|
||||||
|
'redirects.js.in',
|
||||||
|
'redirects.json',
|
||||||
|
],
|
||||||
|
output : 'redirects.js',
|
||||||
|
)
|
||||||
|
|
||||||
# Generates types
|
# Generates types
|
||||||
subdir('source/store')
|
subdir('source/store')
|
||||||
# Generates builtins.md and builtin-constants.md.
|
# Generates builtins.md and builtin-constants.md.
|
||||||
@@ -77,66 +113,71 @@ else
|
|||||||
nix_input = []
|
nix_input = []
|
||||||
endif
|
endif
|
||||||
|
|
||||||
manual = custom_target(
|
# HTML manual build (conditional)
|
||||||
'manual',
|
if get_option('html-manual')
|
||||||
command : [
|
manual = custom_target(
|
||||||
bash,
|
|
||||||
'-euo',
|
|
||||||
'pipefail',
|
|
||||||
'-c',
|
|
||||||
'''
|
|
||||||
@0@ @INPUT0@ @CURRENT_SOURCE_DIR@ > @DEPFILE@
|
|
||||||
@0@ @INPUT1@ summary @2@ < @CURRENT_SOURCE_DIR@/source/SUMMARY.md.in > @2@/source/SUMMARY.md
|
|
||||||
sed -e 's|@version@|@3@|g' < @INPUT2@ > @2@/book.toml
|
|
||||||
@4@ -r -L --include='*.md' @CURRENT_SOURCE_DIR@/ @2@/
|
|
||||||
(cd @2@; RUST_LOG=warn @1@ build -d @2@ 3>&2 2>&1 1>&3) | { grep -Fv "because fragment resolution isn't implemented" || :; } 3>&2 2>&1 1>&3
|
|
||||||
rm -rf @2@/manual
|
|
||||||
mv @2@/html @2@/manual
|
|
||||||
# Remove Mathjax 2.7, because we will actually use MathJax 3.x
|
|
||||||
find @2@/manual | grep .html | xargs sed -i -e '/2.7.1.MathJax.js/d'
|
|
||||||
find @2@/manual -iname meson.build -delete
|
|
||||||
'''.format(
|
|
||||||
python.full_path(),
|
|
||||||
mdbook.full_path(),
|
|
||||||
meson.current_build_dir(),
|
|
||||||
meson.project_version(),
|
|
||||||
rsync.full_path(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
input : [
|
|
||||||
generate_manual_deps,
|
|
||||||
'substitute.py',
|
|
||||||
'book.toml.in',
|
|
||||||
'anchors.jq',
|
|
||||||
'custom.css',
|
|
||||||
nix3_cli_files,
|
|
||||||
experimental_features_shortlist_md,
|
|
||||||
experimental_feature_descriptions_md,
|
|
||||||
types_dir,
|
|
||||||
conf_file_md,
|
|
||||||
builtins_md,
|
|
||||||
rl_next_generated,
|
|
||||||
summary_rl_next,
|
|
||||||
json_schema_generated_files,
|
|
||||||
nix_input,
|
|
||||||
],
|
|
||||||
output : [
|
|
||||||
'manual',
|
'manual',
|
||||||
'markdown',
|
command : [
|
||||||
],
|
bash,
|
||||||
depfile : 'manual.d',
|
'-euo',
|
||||||
env : {
|
'pipefail',
|
||||||
'RUST_LOG' : 'info',
|
'-c',
|
||||||
'MDBOOK_SUBSTITUTE_SEARCH' : meson.current_build_dir() / 'source',
|
'''
|
||||||
},
|
@0@ @INPUT0@ @CURRENT_SOURCE_DIR@ > @DEPFILE@
|
||||||
)
|
@0@ @INPUT1@ summary @2@ < @CURRENT_SOURCE_DIR@/source/SUMMARY.md.in > @2@/source/SUMMARY.md
|
||||||
manual_html = manual[0]
|
sed -e 's|@version@|@3@|g' < @INPUT2@ > @2@/book.toml
|
||||||
manual_md = manual[1]
|
@4@ -r -L --exclude='*.drv' --include='*.md' @CURRENT_SOURCE_DIR@/ @2@/
|
||||||
|
(cd @2@; RUST_LOG=warn @1@ build -d @2@ 3>&2 2>&1 1>&3) | { grep -Fv "because fragment resolution isn't implemented" || :; } 3>&2 2>&1 1>&3
|
||||||
|
rm -rf @2@/manual
|
||||||
|
mv @2@/html @2@/manual
|
||||||
|
# Remove Mathjax 2.7, because we will actually use MathJax 3.x
|
||||||
|
find @2@/manual | grep .html | xargs sed -i -e '/2.7.1.MathJax.js/d'
|
||||||
|
find @2@/manual -iname meson.build -delete
|
||||||
|
'''.format(
|
||||||
|
python.full_path(),
|
||||||
|
mdbook.full_path(),
|
||||||
|
meson.current_build_dir(),
|
||||||
|
meson.project_version(),
|
||||||
|
rsync.full_path(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
input : [
|
||||||
|
generate_manual_deps,
|
||||||
|
'substitute.py',
|
||||||
|
'book.toml.in',
|
||||||
|
'anchors.jq',
|
||||||
|
'custom.css',
|
||||||
|
redirects_js,
|
||||||
|
nix3_cli_files,
|
||||||
|
experimental_features_shortlist_md,
|
||||||
|
experimental_feature_descriptions_md,
|
||||||
|
types_dir,
|
||||||
|
conf_file_md,
|
||||||
|
builtins_md,
|
||||||
|
rl_next_generated,
|
||||||
|
summary_rl_next,
|
||||||
|
json_schema_generated_files,
|
||||||
|
nix_input,
|
||||||
|
],
|
||||||
|
output : [
|
||||||
|
'manual',
|
||||||
|
'markdown',
|
||||||
|
],
|
||||||
|
depfile : 'manual.d',
|
||||||
|
build_by_default : true,
|
||||||
|
env : {
|
||||||
|
'RUST_LOG' : 'info',
|
||||||
|
'MDBOOK_SUBSTITUTE_SEARCH' : meson.current_build_dir() / 'source',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
manual_html = manual[0]
|
||||||
|
manual_md = manual[1]
|
||||||
|
|
||||||
install_subdir(
|
install_subdir(
|
||||||
manual_html.full_path(),
|
manual_html.full_path(),
|
||||||
install_dir : get_option('datadir') / 'doc/nix',
|
install_dir : get_option('datadir') / 'doc/nix',
|
||||||
)
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
nix_nested_manpages = [
|
nix_nested_manpages = [
|
||||||
[
|
[
|
||||||
@@ -182,6 +223,7 @@ nix_nested_manpages = [
|
|||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Manpage generation (standalone, no mdbook dependency)
|
||||||
foreach command : nix_nested_manpages
|
foreach command : nix_nested_manpages
|
||||||
foreach page : command[1]
|
foreach page : command[1]
|
||||||
title = command[0] + ' --' + page
|
title = command[0] + ' --' + page
|
||||||
@@ -189,15 +231,19 @@ foreach command : nix_nested_manpages
|
|||||||
custom_target(
|
custom_target(
|
||||||
command : [
|
command : [
|
||||||
bash,
|
bash,
|
||||||
files('./render-manpage.sh'),
|
'@INPUT0@',
|
||||||
'--out-no-smarty',
|
'--out-no-smarty',
|
||||||
title,
|
title,
|
||||||
section,
|
section,
|
||||||
'@INPUT0@/command-ref' / command[0] / (page + '.md'),
|
meson.current_source_dir() / 'source',
|
||||||
|
meson.current_build_dir() / 'source',
|
||||||
|
doc_url,
|
||||||
|
meson.current_source_dir() / 'source/command-ref' / command[0] / (page + '.md'),
|
||||||
'@OUTPUT0@',
|
'@OUTPUT0@',
|
||||||
],
|
],
|
||||||
input : [
|
input : [
|
||||||
manual_md,
|
files('./render-manpage.sh'),
|
||||||
|
files('./expand-includes.py'),
|
||||||
nix_input,
|
nix_input,
|
||||||
],
|
],
|
||||||
output : command[0] + '-' + page + '.1',
|
output : command[0] + '-' + page + '.1',
|
||||||
@@ -306,14 +352,21 @@ foreach page : nix3_manpages
|
|||||||
command : [
|
command : [
|
||||||
bash,
|
bash,
|
||||||
'@INPUT0@',
|
'@INPUT0@',
|
||||||
|
# Note: no --out-no-smarty flag (original behavior)
|
||||||
page,
|
page,
|
||||||
section,
|
section,
|
||||||
'@INPUT1@/command-ref/new-cli/@0@.md'.format(page),
|
meson.current_source_dir() / 'source',
|
||||||
|
meson.current_build_dir() / 'source',
|
||||||
|
doc_url,
|
||||||
|
meson.current_build_dir() / 'source/command-ref/new-cli/@0@.md'.format(
|
||||||
|
page,
|
||||||
|
),
|
||||||
'@OUTPUT@',
|
'@OUTPUT@',
|
||||||
],
|
],
|
||||||
input : [
|
input : [
|
||||||
files('./render-manpage.sh'),
|
files('./render-manpage.sh'),
|
||||||
manual_md,
|
files('./expand-includes.py'),
|
||||||
|
nix3_cli_files,
|
||||||
nix_input,
|
nix_input,
|
||||||
],
|
],
|
||||||
output : page + '.1',
|
output : page + '.1',
|
||||||
@@ -333,7 +386,12 @@ nix_manpages = [
|
|||||||
[ 'nix-channel', 1 ],
|
[ 'nix-channel', 1 ],
|
||||||
[ 'nix-hash', 1 ],
|
[ 'nix-hash', 1 ],
|
||||||
[ 'nix-copy-closure', 1 ],
|
[ 'nix-copy-closure', 1 ],
|
||||||
[ 'nix.conf', 5, conf_file_md.full_path() ],
|
[
|
||||||
|
'nix.conf',
|
||||||
|
5,
|
||||||
|
conf_file_md.full_path(),
|
||||||
|
[ conf_file_md, experimental_features_shortlist_md ],
|
||||||
|
],
|
||||||
[ 'nix-daemon', 8 ],
|
[ 'nix-daemon', 8 ],
|
||||||
[ 'nix-profiles', 5, 'files/profiles.md' ],
|
[ 'nix-profiles', 5, 'files/profiles.md' ],
|
||||||
]
|
]
|
||||||
@@ -345,19 +403,24 @@ foreach entry : nix_manpages
|
|||||||
# Therefore we use an optional third element of this array to override the name pattern
|
# Therefore we use an optional third element of this array to override the name pattern
|
||||||
md_file = entry.get(2, title + '.md')
|
md_file = entry.get(2, title + '.md')
|
||||||
section = entry[1].to_string()
|
section = entry[1].to_string()
|
||||||
md_file_resolved = join_paths('@INPUT1@/command-ref/', md_file)
|
input_file = meson.current_source_dir() / 'source/command-ref' / md_file
|
||||||
|
|
||||||
custom_target(
|
custom_target(
|
||||||
command : [
|
command : [
|
||||||
bash,
|
bash,
|
||||||
'@INPUT0@',
|
'@INPUT0@',
|
||||||
|
# Note: no --out-no-smarty flag (original behavior)
|
||||||
title,
|
title,
|
||||||
section,
|
section,
|
||||||
md_file_resolved,
|
meson.current_source_dir() / 'source',
|
||||||
|
meson.current_build_dir() / 'source',
|
||||||
|
doc_url,
|
||||||
|
input_file,
|
||||||
'@OUTPUT@',
|
'@OUTPUT@',
|
||||||
],
|
],
|
||||||
input : [
|
input : [
|
||||||
files('./render-manpage.sh'),
|
files('./render-manpage.sh'),
|
||||||
manual_md,
|
files('./expand-includes.py'),
|
||||||
entry.get(3, []),
|
entry.get(3, []),
|
||||||
nix_input,
|
nix_input,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
option(
|
||||||
|
'official-release',
|
||||||
|
type : 'boolean',
|
||||||
|
value : true,
|
||||||
|
description : 'Whether this is an official release build (affects documentation URLs)',
|
||||||
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'html-manual',
|
||||||
|
type : 'boolean',
|
||||||
|
value : true,
|
||||||
|
description : 'Whether to build the HTML manual (requires mdbook)',
|
||||||
|
)
|
||||||
+64
-28
@@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
|
callPackage,
|
||||||
mkMesonDerivation,
|
mkMesonDerivation,
|
||||||
|
runCommand,
|
||||||
|
|
||||||
meson,
|
meson,
|
||||||
ninja,
|
ninja,
|
||||||
lowdown-unsandboxed,
|
lowdown-unsandboxed,
|
||||||
mdbook,
|
mdbook,
|
||||||
mdbook-linkcheck,
|
|
||||||
jq,
|
jq,
|
||||||
python3,
|
python3,
|
||||||
rsync,
|
rsync,
|
||||||
@@ -18,6 +19,11 @@
|
|||||||
# Configuration Options
|
# Configuration Options
|
||||||
|
|
||||||
version,
|
version,
|
||||||
|
/**
|
||||||
|
Whether to build the HTML manual.
|
||||||
|
When false, only manpages are built, avoiding the mdbook dependency.
|
||||||
|
*/
|
||||||
|
buildHtmlManual ? true,
|
||||||
|
|
||||||
# `tests` attribute
|
# `tests` attribute
|
||||||
testers,
|
testers,
|
||||||
@@ -42,10 +48,12 @@ mkMesonDerivation (finalAttrs: {
|
|||||||
../../src/libstore-tests/data/content-address
|
../../src/libstore-tests/data/content-address
|
||||||
../../src/libstore-tests/data/store-path
|
../../src/libstore-tests/data/store-path
|
||||||
../../src/libstore-tests/data/realisation
|
../../src/libstore-tests/data/realisation
|
||||||
|
../../src/libstore-tests/data/derivation
|
||||||
../../src/libstore-tests/data/derived-path
|
../../src/libstore-tests/data/derived-path
|
||||||
../../src/libstore-tests/data/path-info
|
../../src/libstore-tests/data/path-info
|
||||||
../../src/libstore-tests/data/nar-info
|
../../src/libstore-tests/data/nar-info
|
||||||
../../src/libstore-tests/data/build-result
|
../../src/libstore-tests/data/build-result
|
||||||
|
../../src/libstore-tests/data/dummy-store
|
||||||
# Too many different types of files to filter for now
|
# Too many different types of files to filter for now
|
||||||
../../doc/manual
|
../../doc/manual
|
||||||
./.
|
./.
|
||||||
@@ -54,9 +62,22 @@ mkMesonDerivation (finalAttrs: {
|
|||||||
../../doc/manual/package.nix;
|
../../doc/manual/package.nix;
|
||||||
|
|
||||||
# TODO the man pages should probably be separate
|
# TODO the man pages should probably be separate
|
||||||
outputs = [
|
outputs =
|
||||||
"out"
|
if buildHtmlManual then
|
||||||
"man"
|
[
|
||||||
|
"out"
|
||||||
|
"man"
|
||||||
|
]
|
||||||
|
else
|
||||||
|
[ "out" ]; # Only one output when HTML manual is disabled; use "out" for manpages
|
||||||
|
|
||||||
|
# When HTML manual is disabled, install manpages to "out" instead of "man"
|
||||||
|
mesonFlags = [
|
||||||
|
(lib.mesonBool "official-release" officialRelease)
|
||||||
|
(lib.mesonBool "html-manual" buildHtmlManual)
|
||||||
|
]
|
||||||
|
++ lib.optionals (!buildHtmlManual) [
|
||||||
|
"--mandir=${placeholder "out"}/share/man"
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
@@ -64,15 +85,15 @@ mkMesonDerivation (finalAttrs: {
|
|||||||
meson
|
meson
|
||||||
ninja
|
ninja
|
||||||
(lib.getBin lowdown-unsandboxed)
|
(lib.getBin lowdown-unsandboxed)
|
||||||
mdbook
|
|
||||||
mdbook-linkcheck
|
|
||||||
jq
|
jq
|
||||||
python3
|
python3
|
||||||
|
]
|
||||||
|
++ lib.optionals buildHtmlManual [
|
||||||
|
mdbook
|
||||||
rsync
|
rsync
|
||||||
json-schema-for-humans
|
json-schema-for-humans
|
||||||
changelog-d
|
|
||||||
]
|
]
|
||||||
++ lib.optionals (!officialRelease) [
|
++ lib.optionals (!officialRelease && buildHtmlManual) [
|
||||||
# When not an official release, we likely have changelog entries that have
|
# When not an official release, we likely have changelog entries that have
|
||||||
# yet to be rendered.
|
# yet to be rendered.
|
||||||
# When released, these are rendered into a committed file to save a dependency.
|
# When released, these are rendered into a committed file to save a dependency.
|
||||||
@@ -84,32 +105,47 @@ mkMesonDerivation (finalAttrs: {
|
|||||||
echo ${finalAttrs.version} > ./.version
|
echo ${finalAttrs.version} > ./.version
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = lib.optionalString buildHtmlManual ''
|
||||||
mkdir -p ''$out/nix-support
|
mkdir -p ''$out/nix-support
|
||||||
echo "doc manual ''$out/share/doc/nix/manual" >> ''$out/nix-support/hydra-build-products
|
echo "doc manual ''$out/share/doc/nix/manual" >> ''$out/nix-support/hydra-build-products
|
||||||
'';
|
'';
|
||||||
|
|
||||||
/**
|
passthru = lib.optionalAttrs buildHtmlManual {
|
||||||
The root of the HTML manual.
|
/**
|
||||||
E.g. "${nix-manual.site}/index.html" exists.
|
The root of the HTML manual.
|
||||||
*/
|
E.g. "${nix-manual.site}/index.html" exists.
|
||||||
passthru.site = finalAttrs.finalPackage + "/share/doc/nix/manual";
|
*/
|
||||||
|
|
||||||
passthru.tests = {
|
site = finalAttrs.finalPackage + "/share/doc/nix/manual";
|
||||||
# https://nixos.org/manual/nixpkgs/stable/index.html#tester-lycheeLinkCheck
|
|
||||||
linkcheck = testers.lycheeLinkCheck {
|
tests =
|
||||||
inherit (finalAttrs.finalPackage) site;
|
let
|
||||||
extraConfig = {
|
redirect-targets = callPackage ./redirect-targets-html.nix { };
|
||||||
exclude = [
|
in
|
||||||
# Exclude auto-generated JSON schema documentation which has
|
{
|
||||||
# auto-generated fragment IDs that don't match the link references
|
# https://nixos.org/manual/nixpkgs/stable/index.html#tester-lycheeLinkCheck
|
||||||
".*/protocols/json/.*\\.html"
|
linkcheck = testers.lycheeLinkCheck {
|
||||||
# Exclude undocumented builtins
|
site =
|
||||||
".*/language/builtins\\.html#builtins-addErrorContext"
|
let
|
||||||
".*/language/builtins\\.html#builtins-appendContext"
|
plain = finalAttrs.finalPackage.site;
|
||||||
];
|
in
|
||||||
|
runCommand "nix-manual-with-redirect-targets" { } ''
|
||||||
|
cp -r ${plain} $out
|
||||||
|
chmod -R u+w $out
|
||||||
|
cp ${redirect-targets}/redirect-targets.html $out/redirect-targets.html
|
||||||
|
'';
|
||||||
|
extraConfig = {
|
||||||
|
exclude = [
|
||||||
|
# Exclude auto-generated JSON schema documentation which has
|
||||||
|
# auto-generated fragment IDs that don't match the link references
|
||||||
|
".*/protocols/json/.*\\.html"
|
||||||
|
# Exclude undocumented builtins
|
||||||
|
".*/language/builtins\\.html#builtins-addErrorContext"
|
||||||
|
".*/language/builtins\\.html#builtins-appendContext"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
# Generates redirect-targets.html containing all redirect targets for link checking.
|
||||||
|
# Used by: doc/manual/package.nix (passthru.tests.linkcheck)
|
||||||
|
|
||||||
|
{
|
||||||
|
stdenv,
|
||||||
|
lib,
|
||||||
|
jq,
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "redirect-targets-html";
|
||||||
|
|
||||||
|
src = lib.fileset.toSource {
|
||||||
|
root = ./.;
|
||||||
|
fileset = ./redirects.json;
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ jq ];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
|
||||||
|
{
|
||||||
|
echo '<!DOCTYPE html>'
|
||||||
|
echo '<html><head><title>Nix Manual Redirect Targets</title></head><body>'
|
||||||
|
echo '<h1>Redirect Targets to Check</h1>'
|
||||||
|
echo '<p>This document contains all redirect targets from the Nix manual.</p>'
|
||||||
|
|
||||||
|
echo '<h2>Client-side redirects (from redirects.json)</h2>'
|
||||||
|
echo '<ul>'
|
||||||
|
|
||||||
|
# Extract all redirects with their source pages to properly resolve relative paths
|
||||||
|
jq -r 'to_entries[] | .key as $page | .value | to_entries[] | "\($page)\t\(.value)"' \
|
||||||
|
redirects.json | while IFS=$'\t' read -r page target; do
|
||||||
|
|
||||||
|
page_dir=$(dirname "$page")
|
||||||
|
|
||||||
|
# Handle fragment-only targets (e.g., #primitives)
|
||||||
|
if [[ "$target" == \#* ]]; then
|
||||||
|
# Fragment is on the same page
|
||||||
|
resolved="$page$target"
|
||||||
|
echo "<li><a href=\"$resolved\">$resolved</a> (fragment on $page)</li>"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Resolve relative path based on the source page location
|
||||||
|
resolved="$page_dir/$target"
|
||||||
|
|
||||||
|
echo "<li><a href=\"$resolved\">$resolved</a> (from $page)</li>"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo '</ul>'
|
||||||
|
echo '</body></html>'
|
||||||
|
} > $out/redirect-targets.html
|
||||||
|
|
||||||
|
echo "Generated redirect targets document with $(grep -c '<li>' $out/redirect-targets.html) links"
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "HTML document listing all Nix manual redirect targets for link checking";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,460 +0,0 @@
|
|||||||
// redirect rules for URL fragments (client-side) to prevent link rot.
|
|
||||||
// this must be done on the client side, as web servers do not see the fragment part of the URL.
|
|
||||||
// it will only work with JavaScript enabled in the browser, but this is the best we can do here.
|
|
||||||
// see source/_redirects for path redirects (server-side)
|
|
||||||
|
|
||||||
// redirects are declared as follows:
|
|
||||||
// each entry has as its key a path matching the requested URL path, relative to the mdBook document root.
|
|
||||||
//
|
|
||||||
// IMPORTANT: it must specify the full path with file name and suffix
|
|
||||||
//
|
|
||||||
// each entry is itself a set of key-value pairs, where
|
|
||||||
// - keys are anchors on the matched path.
|
|
||||||
// - values are redirection targets relative to the current path.
|
|
||||||
|
|
||||||
const redirects = {
|
|
||||||
"index.html": {
|
|
||||||
"part-advanced-topics": "advanced-topics/index.html",
|
|
||||||
"chap-tuning-cores-and-jobs": "advanced-topics/cores-vs-jobs.html",
|
|
||||||
"chap-diff-hook": "advanced-topics/diff-hook.html",
|
|
||||||
"check-dirs-are-unregistered": "advanced-topics/diff-hook.html#check-dirs-are-unregistered",
|
|
||||||
"chap-distributed-builds": "command-ref/conf-file.html#conf-builders",
|
|
||||||
"chap-post-build-hook": "advanced-topics/post-build-hook.html",
|
|
||||||
"chap-post-build-hook-caveats": "advanced-topics/post-build-hook.html#implementation-caveats",
|
|
||||||
"chap-writing-nix-expressions": "language/index.html",
|
|
||||||
"part-command-ref": "command-ref/index.html",
|
|
||||||
"conf-allow-import-from-derivation": "command-ref/conf-file.html#conf-allow-import-from-derivation",
|
|
||||||
"conf-allow-new-privileges": "command-ref/conf-file.html#conf-allow-new-privileges",
|
|
||||||
"conf-allowed-uris": "command-ref/conf-file.html#conf-allowed-uris",
|
|
||||||
"conf-allowed-users": "command-ref/conf-file.html#conf-allowed-users",
|
|
||||||
"conf-auto-optimise-store": "command-ref/conf-file.html#conf-auto-optimise-store",
|
|
||||||
"conf-binary-cache-public-keys": "command-ref/conf-file.html#conf-binary-cache-public-keys",
|
|
||||||
"conf-binary-caches": "command-ref/conf-file.html#conf-binary-caches",
|
|
||||||
"conf-build-compress-log": "command-ref/conf-file.html#conf-build-compress-log",
|
|
||||||
"conf-build-cores": "command-ref/conf-file.html#conf-build-cores",
|
|
||||||
"conf-build-extra-chroot-dirs": "command-ref/conf-file.html#conf-build-extra-chroot-dirs",
|
|
||||||
"conf-build-extra-sandbox-paths": "command-ref/conf-file.html#conf-build-extra-sandbox-paths",
|
|
||||||
"conf-build-fallback": "command-ref/conf-file.html#conf-build-fallback",
|
|
||||||
"conf-build-max-jobs": "command-ref/conf-file.html#conf-build-max-jobs",
|
|
||||||
"conf-build-max-log-size": "command-ref/conf-file.html#conf-build-max-log-size",
|
|
||||||
"conf-build-max-silent-time": "command-ref/conf-file.html#conf-build-max-silent-time",
|
|
||||||
"conf-build-timeout": "command-ref/conf-file.html#conf-build-timeout",
|
|
||||||
"conf-build-use-chroot": "command-ref/conf-file.html#conf-build-use-chroot",
|
|
||||||
"conf-build-use-sandbox": "command-ref/conf-file.html#conf-build-use-sandbox",
|
|
||||||
"conf-build-use-substitutes": "command-ref/conf-file.html#conf-build-use-substitutes",
|
|
||||||
"conf-build-users-group": "command-ref/conf-file.html#conf-build-users-group",
|
|
||||||
"conf-builders": "command-ref/conf-file.html#conf-builders",
|
|
||||||
"conf-builders-use-substitutes": "command-ref/conf-file.html#conf-builders-use-substitutes",
|
|
||||||
"conf-compress-build-log": "command-ref/conf-file.html#conf-compress-build-log",
|
|
||||||
"conf-connect-timeout": "command-ref/conf-file.html#conf-connect-timeout",
|
|
||||||
"conf-cores": "command-ref/conf-file.html#conf-cores",
|
|
||||||
"conf-diff-hook": "command-ref/conf-file.html#conf-diff-hook",
|
|
||||||
"conf-env-keep-derivations": "command-ref/conf-file.html#conf-env-keep-derivations",
|
|
||||||
"conf-extra-binary-caches": "command-ref/conf-file.html#conf-extra-binary-caches",
|
|
||||||
"conf-extra-platforms": "command-ref/conf-file.html#conf-extra-platforms",
|
|
||||||
"conf-extra-sandbox-paths": "command-ref/conf-file.html#conf-extra-sandbox-paths",
|
|
||||||
"conf-extra-substituters": "command-ref/conf-file.html#conf-extra-substituters",
|
|
||||||
"conf-fallback": "command-ref/conf-file.html#conf-fallback",
|
|
||||||
"conf-fsync-metadata": "command-ref/conf-file.html#conf-fsync-metadata",
|
|
||||||
"conf-gc-keep-derivations": "command-ref/conf-file.html#conf-gc-keep-derivations",
|
|
||||||
"conf-gc-keep-outputs": "command-ref/conf-file.html#conf-gc-keep-outputs",
|
|
||||||
"conf-hashed-mirrors": "command-ref/conf-file.html#conf-hashed-mirrors",
|
|
||||||
"conf-http-connections": "command-ref/conf-file.html#conf-http-connections",
|
|
||||||
"conf-keep-build-log": "command-ref/conf-file.html#conf-keep-build-log",
|
|
||||||
"conf-keep-derivations": "command-ref/conf-file.html#conf-keep-derivations",
|
|
||||||
"conf-keep-env-derivations": "command-ref/conf-file.html#conf-keep-env-derivations",
|
|
||||||
"conf-keep-outputs": "command-ref/conf-file.html#conf-keep-outputs",
|
|
||||||
"conf-max-build-log-size": "command-ref/conf-file.html#conf-max-build-log-size",
|
|
||||||
"conf-max-free": "command-ref/conf-file.html#conf-max-free",
|
|
||||||
"conf-max-jobs": "command-ref/conf-file.html#conf-max-jobs",
|
|
||||||
"conf-max-silent-time": "command-ref/conf-file.html#conf-max-silent-time",
|
|
||||||
"conf-min-free": "command-ref/conf-file.html#conf-min-free",
|
|
||||||
"conf-narinfo-cache-negative-ttl": "command-ref/conf-file.html#conf-narinfo-cache-negative-ttl",
|
|
||||||
"conf-narinfo-cache-positive-ttl": "command-ref/conf-file.html#conf-narinfo-cache-positive-ttl",
|
|
||||||
"conf-netrc-file": "command-ref/conf-file.html#conf-netrc-file",
|
|
||||||
"conf-plugin-files": "command-ref/conf-file.html#conf-plugin-files",
|
|
||||||
"conf-post-build-hook": "command-ref/conf-file.html#conf-post-build-hook",
|
|
||||||
"conf-pre-build-hook": "command-ref/conf-file.html#conf-pre-build-hook",
|
|
||||||
"conf-require-sigs": "command-ref/conf-file.html#conf-require-sigs",
|
|
||||||
"conf-restrict-eval": "command-ref/conf-file.html#conf-restrict-eval",
|
|
||||||
"conf-run-diff-hook": "command-ref/conf-file.html#conf-run-diff-hook",
|
|
||||||
"conf-sandbox": "command-ref/conf-file.html#conf-sandbox",
|
|
||||||
"conf-sandbox-dev-shm-size": "command-ref/conf-file.html#conf-sandbox-dev-shm-size",
|
|
||||||
"conf-sandbox-paths": "command-ref/conf-file.html#conf-sandbox-paths",
|
|
||||||
"conf-secret-key-files": "command-ref/conf-file.html#conf-secret-key-files",
|
|
||||||
"conf-show-trace": "command-ref/conf-file.html#conf-show-trace",
|
|
||||||
"conf-stalled-download-timeout": "command-ref/conf-file.html#conf-stalled-download-timeout",
|
|
||||||
"conf-substitute": "command-ref/conf-file.html#conf-substitute",
|
|
||||||
"conf-substituters": "command-ref/conf-file.html#conf-substituters",
|
|
||||||
"conf-system": "command-ref/conf-file.html#conf-system",
|
|
||||||
"conf-system-features": "command-ref/conf-file.html#conf-system-features",
|
|
||||||
"conf-tarball-ttl": "command-ref/conf-file.html#conf-tarball-ttl",
|
|
||||||
"conf-timeout": "command-ref/conf-file.html#conf-timeout",
|
|
||||||
"conf-trace-function-calls": "command-ref/conf-file.html#conf-trace-function-calls",
|
|
||||||
"conf-trusted-binary-caches": "command-ref/conf-file.html#conf-trusted-binary-caches",
|
|
||||||
"conf-trusted-public-keys": "command-ref/conf-file.html#conf-trusted-public-keys",
|
|
||||||
"conf-trusted-substituters": "command-ref/conf-file.html#conf-trusted-substituters",
|
|
||||||
"conf-trusted-users": "command-ref/conf-file.html#conf-trusted-users",
|
|
||||||
"extra-sandbox-paths": "command-ref/conf-file.html#extra-sandbox-paths",
|
|
||||||
"sec-conf-file": "command-ref/conf-file.html",
|
|
||||||
"env-NIX_PATH": "command-ref/env-common.html#env-NIX_PATH",
|
|
||||||
"env-common": "command-ref/env-common.html",
|
|
||||||
"envar-remote": "command-ref/env-common.html#env-NIX_REMOTE",
|
|
||||||
"sec-common-env": "command-ref/env-common.html",
|
|
||||||
"ch-files": "command-ref/files.html",
|
|
||||||
"ch-main-commands": "command-ref/main-commands.html",
|
|
||||||
"opt-out-link": "command-ref/nix-build.html#opt-out-link",
|
|
||||||
"sec-nix-build": "command-ref/nix-build.html",
|
|
||||||
"sec-nix-channel": "command-ref/nix-channel.html",
|
|
||||||
"sec-nix-collect-garbage": "command-ref/nix-collect-garbage.html",
|
|
||||||
"sec-nix-copy-closure": "command-ref/nix-copy-closure.html",
|
|
||||||
"sec-nix-daemon": "command-ref/nix-daemon.html",
|
|
||||||
"refsec-nix-env-install-examples": "command-ref/nix-env.html#examples",
|
|
||||||
"rsec-nix-env-install": "command-ref/nix-env.html#operation---install",
|
|
||||||
"rsec-nix-env-set": "command-ref/nix-env.html#operation---set",
|
|
||||||
"rsec-nix-env-set-flag": "command-ref/nix-env.html#operation---set-flag",
|
|
||||||
"rsec-nix-env-upgrade": "command-ref/nix-env.html#operation---upgrade",
|
|
||||||
"sec-nix-env": "command-ref/nix-env.html",
|
|
||||||
"ssec-version-comparisons": "command-ref/nix-env.html#versions",
|
|
||||||
"sec-nix-hash": "command-ref/nix-hash.html",
|
|
||||||
"sec-nix-instantiate": "command-ref/nix-instantiate.html",
|
|
||||||
"sec-nix-prefetch-url": "command-ref/nix-prefetch-url.html",
|
|
||||||
"sec-nix-shell": "command-ref/nix-shell.html",
|
|
||||||
"ssec-nix-shell-shebang": "command-ref/nix-shell.html#use-as-a--interpreter",
|
|
||||||
"nixref-queries": "command-ref/nix-store.html#queries",
|
|
||||||
"opt-add-root": "command-ref/nix-store.html#opt-add-root",
|
|
||||||
"refsec-nix-store-dump": "command-ref/nix-store.html#operation---dump",
|
|
||||||
"refsec-nix-store-export": "command-ref/nix-store.html#operation---export",
|
|
||||||
"refsec-nix-store-import": "command-ref/nix-store.html#operation---import",
|
|
||||||
"refsec-nix-store-query": "command-ref/nix-store.html#operation---query",
|
|
||||||
"refsec-nix-store-verify": "command-ref/nix-store.html#operation---verify",
|
|
||||||
"rsec-nix-store-gc": "command-ref/nix-store.html#operation---gc",
|
|
||||||
"rsec-nix-store-generate-binary-cache-key": "command-ref/nix-store.html#operation---generate-binary-cache-key",
|
|
||||||
"rsec-nix-store-realise": "command-ref/nix-store.html#operation---realise",
|
|
||||||
"rsec-nix-store-serve": "command-ref/nix-store.html#operation---serve",
|
|
||||||
"sec-nix-store": "command-ref/nix-store.html",
|
|
||||||
"opt-I": "command-ref/opt-common.html#opt-I",
|
|
||||||
"opt-attr": "command-ref/opt-common.html#opt-attr",
|
|
||||||
"opt-common": "command-ref/opt-common.html",
|
|
||||||
"opt-cores": "command-ref/opt-common.html#opt-cores",
|
|
||||||
"opt-log-format": "command-ref/opt-common.html#opt-log-format",
|
|
||||||
"opt-max-jobs": "command-ref/opt-common.html#opt-max-jobs",
|
|
||||||
"opt-max-silent-time": "command-ref/opt-common.html#opt-max-silent-time",
|
|
||||||
"opt-timeout": "command-ref/opt-common.html#opt-timeout",
|
|
||||||
"sec-common-options": "command-ref/opt-common.html",
|
|
||||||
"ch-utilities": "command-ref/utilities.html",
|
|
||||||
"chap-hacking": "development/building.html",
|
|
||||||
"adv-attr-allowSubstitutes": "language/advanced-attributes.html#adv-attr-allowSubstitutes",
|
|
||||||
"adv-attr-allowedReferences": "language/advanced-attributes.html#adv-attr-allowedReferences",
|
|
||||||
"adv-attr-allowedRequisites": "language/advanced-attributes.html#adv-attr-allowedRequisites",
|
|
||||||
"adv-attr-disallowedReferences": "language/advanced-attributes.html#adv-attr-disallowedReferences",
|
|
||||||
"adv-attr-disallowedRequisites": "language/advanced-attributes.html#adv-attr-disallowedRequisites",
|
|
||||||
"adv-attr-exportReferencesGraph": "language/advanced-attributes.html#adv-attr-exportReferencesGraph",
|
|
||||||
"adv-attr-impureEnvVars": "language/advanced-attributes.html#adv-attr-impureEnvVars",
|
|
||||||
"adv-attr-outputHash": "language/advanced-attributes.html#adv-attr-outputHash",
|
|
||||||
"adv-attr-outputHashAlgo": "language/advanced-attributes.html#adv-attr-outputHashAlgo",
|
|
||||||
"adv-attr-outputHashMode": "language/advanced-attributes.html#adv-attr-outputHashMode",
|
|
||||||
"adv-attr-passAsFile": "language/advanced-attributes.html#adv-attr-passAsFile",
|
|
||||||
"adv-attr-preferLocalBuild": "language/advanced-attributes.html#adv-attr-preferLocalBuild",
|
|
||||||
"fixed-output-drvs": "language/advanced-attributes.html#adv-attr-outputHash",
|
|
||||||
"sec-advanced-attributes": "language/advanced-attributes.html",
|
|
||||||
"builtin-abort": "language/builtins.html#builtins-abort",
|
|
||||||
"builtin-add": "language/builtins.html#builtins-add",
|
|
||||||
"builtin-all": "language/builtins.html#builtins-all",
|
|
||||||
"builtin-any": "language/builtins.html#builtins-any",
|
|
||||||
"builtin-attrNames": "language/builtins.html#builtins-attrNames",
|
|
||||||
"builtin-attrValues": "language/builtins.html#builtins-attrValues",
|
|
||||||
"builtin-baseNameOf": "language/builtins.html#builtins-baseNameOf",
|
|
||||||
"builtin-bitAnd": "language/builtins.html#builtins-bitAnd",
|
|
||||||
"builtin-bitOr": "language/builtins.html#builtins-bitOr",
|
|
||||||
"builtin-bitXor": "language/builtins.html#builtins-bitXor",
|
|
||||||
"builtin-builtins": "language/builtins.html#builtins-builtins",
|
|
||||||
"builtin-compareVersions": "language/builtins.html#builtins-compareVersions",
|
|
||||||
"builtin-concatLists": "language/builtins.html#builtins-concatLists",
|
|
||||||
"builtin-concatStringsSep": "language/builtins.html#builtins-concatStringsSep",
|
|
||||||
"builtin-currentSystem": "language/builtins.html#builtins-currentSystem",
|
|
||||||
"builtin-deepSeq": "language/builtins.html#builtins-deepSeq",
|
|
||||||
"builtin-derivation": "language/builtins.html#builtins-derivation",
|
|
||||||
"builtin-dirOf": "language/builtins.html#builtins-dirOf",
|
|
||||||
"builtin-div": "language/builtins.html#builtins-div",
|
|
||||||
"builtin-elem": "language/builtins.html#builtins-elem",
|
|
||||||
"builtin-elemAt": "language/builtins.html#builtins-elemAt",
|
|
||||||
"builtin-fetchGit": "language/builtins.html#builtins-fetchGit",
|
|
||||||
"builtin-fetchTarball": "language/builtins.html#builtins-fetchTarball",
|
|
||||||
"builtin-fetchurl": "language/builtins.html#builtins-fetchurl",
|
|
||||||
"builtin-filterSource": "language/builtins.html#builtins-filterSource",
|
|
||||||
"builtin-foldl-prime": "language/builtins.html#builtins-foldl-prime",
|
|
||||||
"builtin-fromJSON": "language/builtins.html#builtins-fromJSON",
|
|
||||||
"builtin-functionArgs": "language/builtins.html#builtins-functionArgs",
|
|
||||||
"builtin-genList": "language/builtins.html#builtins-genList",
|
|
||||||
"builtin-getAttr": "language/builtins.html#builtins-getAttr",
|
|
||||||
"builtin-getEnv": "language/builtins.html#builtins-getEnv",
|
|
||||||
"builtin-hasAttr": "language/builtins.html#builtins-hasAttr",
|
|
||||||
"builtin-hashFile": "language/builtins.html#builtins-hashFile",
|
|
||||||
"builtin-hashString": "language/builtins.html#builtins-hashString",
|
|
||||||
"builtin-head": "language/builtins.html#builtins-head",
|
|
||||||
"builtin-import": "language/builtins.html#builtins-import",
|
|
||||||
"builtin-intersectAttrs": "language/builtins.html#builtins-intersectAttrs",
|
|
||||||
"builtin-isAttrs": "language/builtins.html#builtins-isAttrs",
|
|
||||||
"builtin-isBool": "language/builtins.html#builtins-isBool",
|
|
||||||
"builtin-isFloat": "language/builtins.html#builtins-isFloat",
|
|
||||||
"builtin-isFunction": "language/builtins.html#builtins-isFunction",
|
|
||||||
"builtin-isInt": "language/builtins.html#builtins-isInt",
|
|
||||||
"builtin-isList": "language/builtins.html#builtins-isList",
|
|
||||||
"builtin-isNull": "language/builtins.html#builtins-isNull",
|
|
||||||
"builtin-isString": "language/builtins.html#builtins-isString",
|
|
||||||
"builtin-length": "language/builtins.html#builtins-length",
|
|
||||||
"builtin-lessThan": "language/builtins.html#builtins-lessThan",
|
|
||||||
"builtin-listToAttrs": "language/builtins.html#builtins-listToAttrs",
|
|
||||||
"builtin-map": "language/builtins.html#builtins-map",
|
|
||||||
"builtin-match": "language/builtins.html#builtins-match",
|
|
||||||
"builtin-mul": "language/builtins.html#builtins-mul",
|
|
||||||
"builtin-parseDrvName": "language/builtins.html#builtins-parseDrvName",
|
|
||||||
"builtin-path": "language/builtins.html#builtins-path",
|
|
||||||
"builtin-pathExists": "language/builtins.html#builtins-pathExists",
|
|
||||||
"builtin-placeholder": "language/builtins.html#builtins-placeholder",
|
|
||||||
"builtin-readDir": "language/builtins.html#builtins-readDir",
|
|
||||||
"builtin-readFile": "language/builtins.html#builtins-readFile",
|
|
||||||
"builtin-removeAttrs": "language/builtins.html#builtins-removeAttrs",
|
|
||||||
"builtin-replaceStrings": "language/builtins.html#builtins-replaceStrings",
|
|
||||||
"builtin-seq": "language/builtins.html#builtins-seq",
|
|
||||||
"builtin-sort": "language/builtins.html#builtins-sort",
|
|
||||||
"builtin-split": "language/builtins.html#builtins-split",
|
|
||||||
"builtin-splitVersion": "language/builtins.html#builtins-splitVersion",
|
|
||||||
"builtin-stringLength": "language/builtins.html#builtins-stringLength",
|
|
||||||
"builtin-sub": "language/builtins.html#builtins-sub",
|
|
||||||
"builtin-substring": "language/builtins.html#builtins-substring",
|
|
||||||
"builtin-tail": "language/builtins.html#builtins-tail",
|
|
||||||
"builtin-throw": "language/builtins.html#builtins-throw",
|
|
||||||
"builtin-toFile": "language/builtins.html#builtins-toFile",
|
|
||||||
"builtin-toJSON": "language/builtins.html#builtins-toJSON",
|
|
||||||
"builtin-toPath": "language/builtins.html#builtins-toPath",
|
|
||||||
"builtin-toString": "language/builtins.html#builtins-toString",
|
|
||||||
"builtin-toXML": "language/builtins.html#builtins-toXML",
|
|
||||||
"builtin-trace": "language/builtins.html#builtins-trace",
|
|
||||||
"builtin-tryEval": "language/builtins.html#builtins-tryEval",
|
|
||||||
"builtin-typeOf": "language/builtins.html#builtins-typeOf",
|
|
||||||
"ssec-builtins": "language/builtins.html",
|
|
||||||
"attr-system": "language/derivations.html#attr-system",
|
|
||||||
"ssec-derivation": "language/derivations.html",
|
|
||||||
"ch-expression-language": "language/index.html",
|
|
||||||
"sec-constructs": "language/syntax.html",
|
|
||||||
"sect-let-language": "language/syntax.html#let-expressions",
|
|
||||||
"ss-functions": "language/syntax.html#functions",
|
|
||||||
"sec-language-operators": "language/operators.html",
|
|
||||||
"table-operators": "language/operators.html",
|
|
||||||
"ssec-values": "language/types.html",
|
|
||||||
"gloss-closure": "glossary.html#gloss-closure",
|
|
||||||
"gloss-derivation": "glossary.html#gloss-derivation",
|
|
||||||
"gloss-deriver": "glossary.html#gloss-deriver",
|
|
||||||
"gloss-nar": "glossary.html#gloss-nar",
|
|
||||||
"gloss-output-path": "glossary.html#gloss-output-path",
|
|
||||||
"gloss-profile": "glossary.html#gloss-profile",
|
|
||||||
"gloss-reachable": "glossary.html#gloss-reachable",
|
|
||||||
"gloss-reference": "glossary.html#gloss-reference",
|
|
||||||
"gloss-substitute": "glossary.html#gloss-substitute",
|
|
||||||
"gloss-user-env": "glossary.html#gloss-user-env",
|
|
||||||
"gloss-validity": "glossary.html#gloss-validity",
|
|
||||||
"part-glossary": "glossary.html",
|
|
||||||
"sec-building-source": "installation/building-source.html",
|
|
||||||
"ch-env-variables": "installation/env-variables.html",
|
|
||||||
"sec-installer-proxy-settings": "installation/env-variables.html#proxy-environment-variables",
|
|
||||||
"sec-nix-ssl-cert-file": "installation/env-variables.html#nix_ssl_cert_file",
|
|
||||||
"sec-nix-ssl-cert-file-with-nix-daemon-and-macos": "installation/env-variables.html#nix_ssl_cert_file-with-macos-and-the-nix-daemon",
|
|
||||||
"chap-installation": "installation/index.html",
|
|
||||||
"ch-installing-binary": "installation/installing-binary.html",
|
|
||||||
"sect-macos-installation": "installation/installing-binary.html#macos-installation",
|
|
||||||
"sect-macos-installation-change-store-prefix": "installation/installing-binary.html#macos-installation",
|
|
||||||
"sect-macos-installation-encrypted-volume": "installation/installing-binary.html#macos-installation",
|
|
||||||
"sect-macos-installation-recommended-notes": "installation/installing-binary.html#macos-installation",
|
|
||||||
"sect-macos-installation-symlink": "installation/installing-binary.html#macos-installation",
|
|
||||||
"sect-multi-user-installation": "installation/installing-binary.html#multi-user-installation",
|
|
||||||
"sect-nix-install-binary-tarball": "installation/installing-binary.html#installing-from-a-binary-tarball",
|
|
||||||
"sect-nix-install-pinned-version-url": "installation/installing-binary.html#installing-a-pinned-nix-version-from-a-url",
|
|
||||||
"sect-single-user-installation": "installation/installing-binary.html#single-user-installation",
|
|
||||||
"ch-installing-source": "installation/installing-source.html",
|
|
||||||
"ssec-multi-user": "installation/multi-user.html",
|
|
||||||
"ch-nix-security": "installation/nix-security.html",
|
|
||||||
"sec-obtaining-source": "installation/obtaining-source.html",
|
|
||||||
"sec-prerequisites-source": "installation/prerequisites-source.html",
|
|
||||||
"sec-single-user": "installation/single-user.html",
|
|
||||||
"ch-supported-platforms": "installation/supported-platforms.html",
|
|
||||||
"ch-upgrading-nix": "installation/upgrading.html",
|
|
||||||
"ch-about-nix": "introduction.html",
|
|
||||||
"chap-introduction": "introduction.html",
|
|
||||||
"ch-basic-package-mgmt": "package-management/basic-package-mgmt.html",
|
|
||||||
"ssec-binary-cache-substituter": "package-management/binary-cache-substituter.html",
|
|
||||||
"sec-channels": "command-ref/nix-channel.html",
|
|
||||||
"ssec-copy-closure": "command-ref/nix-copy-closure.html",
|
|
||||||
"sec-garbage-collection": "package-management/garbage-collection.html",
|
|
||||||
"ssec-gc-roots": "package-management/garbage-collector-roots.html",
|
|
||||||
"chap-package-management": "package-management/index.html",
|
|
||||||
"sec-profiles": "package-management/profiles.html",
|
|
||||||
"ssec-s3-substituter": "store/types/s3-substituter.html",
|
|
||||||
"ssec-s3-substituter-anonymous-reads": "store/types/s3-substituter.html#anonymous-reads-to-your-s3-compatible-binary-cache",
|
|
||||||
"ssec-s3-substituter-authenticated-reads": "store/types/s3-substituter.html#authenticated-reads-to-your-s3-binary-cache",
|
|
||||||
"ssec-s3-substituter-authenticated-writes": "store/types/s3-substituter.html#authenticated-writes-to-your-s3-compatible-binary-cache",
|
|
||||||
"sec-sharing-packages": "package-management/sharing-packages.html",
|
|
||||||
"ssec-ssh-substituter": "package-management/ssh-substituter.html",
|
|
||||||
"chap-quick-start": "quick-start.html",
|
|
||||||
"sec-relnotes": "release-notes/index.html",
|
|
||||||
"ch-relnotes-0.10.1": "release-notes/rl-0.10.1.html",
|
|
||||||
"ch-relnotes-0.10": "release-notes/rl-0.10.html",
|
|
||||||
"ssec-relnotes-0.11": "release-notes/rl-0.11.html",
|
|
||||||
"ssec-relnotes-0.12": "release-notes/rl-0.12.html",
|
|
||||||
"ssec-relnotes-0.13": "release-notes/rl-0.13.html",
|
|
||||||
"ssec-relnotes-0.14": "release-notes/rl-0.14.html",
|
|
||||||
"ssec-relnotes-0.15": "release-notes/rl-0.15.html",
|
|
||||||
"ssec-relnotes-0.16": "release-notes/rl-0.16.html",
|
|
||||||
"ch-relnotes-0.5": "release-notes/rl-0.5.html",
|
|
||||||
"ch-relnotes-0.6": "release-notes/rl-0.6.html",
|
|
||||||
"ch-relnotes-0.7": "release-notes/rl-0.7.html",
|
|
||||||
"ch-relnotes-0.8.1": "release-notes/rl-0.8.1.html",
|
|
||||||
"ch-relnotes-0.8": "release-notes/rl-0.8.html",
|
|
||||||
"ch-relnotes-0.9.1": "release-notes/rl-0.9.1.html",
|
|
||||||
"ch-relnotes-0.9.2": "release-notes/rl-0.9.2.html",
|
|
||||||
"ch-relnotes-0.9": "release-notes/rl-0.9.html",
|
|
||||||
"ssec-relnotes-1.0": "release-notes/rl-1.0.html",
|
|
||||||
"ssec-relnotes-1.1": "release-notes/rl-1.1.html",
|
|
||||||
"ssec-relnotes-1.10": "release-notes/rl-1.10.html",
|
|
||||||
"ssec-relnotes-1.11.10": "release-notes/rl-1.11.10.html",
|
|
||||||
"ssec-relnotes-1.11": "release-notes/rl-1.11.html",
|
|
||||||
"ssec-relnotes-1.2": "release-notes/rl-1.2.html",
|
|
||||||
"ssec-relnotes-1.3": "release-notes/rl-1.3.html",
|
|
||||||
"ssec-relnotes-1.4": "release-notes/rl-1.4.html",
|
|
||||||
"ssec-relnotes-1.5.1": "release-notes/rl-1.5.1.html",
|
|
||||||
"ssec-relnotes-1.5.2": "release-notes/rl-1.5.2.html",
|
|
||||||
"ssec-relnotes-1.5": "release-notes/rl-1.5.html",
|
|
||||||
"ssec-relnotes-1.6.1": "release-notes/rl-1.6.1.html",
|
|
||||||
"ssec-relnotes-1.6.0": "release-notes/rl-1.6.html",
|
|
||||||
"ssec-relnotes-1.7": "release-notes/rl-1.7.html",
|
|
||||||
"ssec-relnotes-1.8": "release-notes/rl-1.8.html",
|
|
||||||
"ssec-relnotes-1.9": "release-notes/rl-1.9.html",
|
|
||||||
"ssec-relnotes-2.0": "release-notes/rl-2.0.html",
|
|
||||||
"ssec-relnotes-2.1": "release-notes/rl-2.1.html",
|
|
||||||
"ssec-relnotes-2.2": "release-notes/rl-2.2.html",
|
|
||||||
"ssec-relnotes-2.3": "release-notes/rl-2.3.html",
|
|
||||||
},
|
|
||||||
"language/types.html": {
|
|
||||||
"simple-values": "#primitives",
|
|
||||||
"lists": "#list",
|
|
||||||
"strings": "#string",
|
|
||||||
"attribute-sets": "#attribute-set",
|
|
||||||
"type-number": "#type-int",
|
|
||||||
},
|
|
||||||
"language/syntax.html": {
|
|
||||||
"scoping-rules": "scoping.html",
|
|
||||||
"string-literal": "string-literals.html",
|
|
||||||
},
|
|
||||||
"language/derivations.md": {
|
|
||||||
"builder-execution": "store/drv/building.md#builder-execution",
|
|
||||||
},
|
|
||||||
"installation/installing-binary.html": {
|
|
||||||
"linux": "uninstall.html#linux",
|
|
||||||
"macos": "uninstall.html#macos",
|
|
||||||
"uninstalling": "uninstall.html",
|
|
||||||
},
|
|
||||||
"development/building.html": {
|
|
||||||
"nix-with-flakes": "#building-nix-with-flakes",
|
|
||||||
"classic-nix": "#building-nix",
|
|
||||||
"running-tests": "testing.html#running-tests",
|
|
||||||
"unit-tests": "testing.html#unit-tests",
|
|
||||||
"functional-tests": "testing.html#functional-tests",
|
|
||||||
"debugging-failing-functional-tests": "testing.html#debugging-failing-functional-tests",
|
|
||||||
"integration-tests": "testing.html#integration-tests",
|
|
||||||
"installer-tests": "testing.html#installer-tests",
|
|
||||||
"one-time-setup": "testing.html#one-time-setup",
|
|
||||||
"using-the-ci-generated-installer-for-manual-testing": "testing.html#using-the-ci-generated-installer-for-manual-testing",
|
|
||||||
"characterization-testing": "testing.html#characterisation-testing-unit",
|
|
||||||
"add-a-release-note": "contributing.html#add-a-release-note",
|
|
||||||
"add-an-entry": "contributing.html#add-an-entry",
|
|
||||||
"build-process": "contributing.html#build-process",
|
|
||||||
"reverting": "contributing.html#reverting",
|
|
||||||
"branches": "contributing.html#branches",
|
|
||||||
},
|
|
||||||
"glossary.html": {
|
|
||||||
"gloss-local-store": "store/types/local-store.html",
|
|
||||||
"package-attribute-set": "#package",
|
|
||||||
"gloss-chroot-store": "store/types/local-store.html",
|
|
||||||
"gloss-content-addressed-derivation": "#gloss-content-addressing-derivation",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// the following code matches the current page's URL against the set of redirects.
|
|
||||||
//
|
|
||||||
// it is written to minimize the latency between page load and redirect.
|
|
||||||
// therefore we avoid function calls, copying data, and unnecessary loops.
|
|
||||||
// IMPORTANT: we use stateful array operations and their order matters!
|
|
||||||
//
|
|
||||||
// matching URLs is more involved than it should be:
|
|
||||||
//
|
|
||||||
// 1. `document.location.pathname` can have an arbitrary prefix.
|
|
||||||
//
|
|
||||||
// 2. `path_to_root` is set by mdBook. it consists only of `../`s and
|
|
||||||
// determines the depth of `<path>` relative to the prefix:
|
|
||||||
//
|
|
||||||
// `document.location.pathname`
|
|
||||||
// |------------------------------|
|
|
||||||
// /<prefix>/<path>/[<file>[.html]][#<anchor>]
|
|
||||||
// |----|
|
|
||||||
// `path_to_root` has same number of path segments
|
|
||||||
//
|
|
||||||
// source: https://phaiax.github.io/mdBook/format/theme/index-hbs.html#data
|
|
||||||
//
|
|
||||||
// 3. the following paths are equivalent:
|
|
||||||
//
|
|
||||||
// /foo/bar/
|
|
||||||
// /foo/bar/index.html
|
|
||||||
// /foo/bar/index
|
|
||||||
//
|
|
||||||
// 4. the following paths are also equivalent:
|
|
||||||
//
|
|
||||||
// /foo/bar/baz
|
|
||||||
// /foo/bar/baz.html
|
|
||||||
//
|
|
||||||
|
|
||||||
let segments = document.location.pathname.split('/');
|
|
||||||
|
|
||||||
let file = segments.pop();
|
|
||||||
|
|
||||||
// normalize file name
|
|
||||||
if (file === '') { file = "index.html"; }
|
|
||||||
else if (!file.endsWith('.html')) { file = file + '.html'; }
|
|
||||||
|
|
||||||
segments.push(file);
|
|
||||||
|
|
||||||
// use `path_to_root` to discern prefix from path.
|
|
||||||
const depth = path_to_root.split('/').length;
|
|
||||||
|
|
||||||
// remove segments containing prefix. the following works because
|
|
||||||
// 1. the original `document.location.pathname` is absolute,
|
|
||||||
// hence first element of `segments` is always empty.
|
|
||||||
// 2. last element of splitting `path_to_root` is also always empty.
|
|
||||||
// 3. last element of `segments` is the file name.
|
|
||||||
//
|
|
||||||
// visual example:
|
|
||||||
//
|
|
||||||
// '/foo/bar/baz.html'.split('/') -> [ '', 'foo', 'bar', 'baz.html' ]
|
|
||||||
// '../'.split('/') -> [ '..', '' ]
|
|
||||||
//
|
|
||||||
// the following operations will then result in
|
|
||||||
//
|
|
||||||
// path = 'bar/baz.html'
|
|
||||||
//
|
|
||||||
segments.splice(0, segments.length - depth);
|
|
||||||
const path = segments.join('/');
|
|
||||||
|
|
||||||
// anchor starts with the hash character (`#`),
|
|
||||||
// but our redirect declarations don't, so we strip it.
|
|
||||||
// example:
|
|
||||||
// document.location.hash -> '#foo'
|
|
||||||
// document.location.hash.substring(1) -> 'foo'
|
|
||||||
const anchor = document.location.hash.substring(1);
|
|
||||||
|
|
||||||
const redirect = redirects[path];
|
|
||||||
if (redirect) {
|
|
||||||
const target = redirect[anchor];
|
|
||||||
if (target) {
|
|
||||||
document.location.href = target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
// redirect rules for URL fragments (client-side) to prevent link rot.
|
||||||
|
// this must be done on the client side, as web servers do not see the fragment part of the URL.
|
||||||
|
// it will only work with JavaScript enabled in the browser, but this is the best we can do here.
|
||||||
|
// see source/_redirects for path redirects (server-side)
|
||||||
|
|
||||||
|
// redirects are declared as follows:
|
||||||
|
// each entry has as its key a path matching the requested URL path, relative to the mdBook document root.
|
||||||
|
//
|
||||||
|
// IMPORTANT: it must specify the full path with file name and suffix
|
||||||
|
//
|
||||||
|
// each entry is itself a set of key-value pairs, where
|
||||||
|
// - keys are anchors on the matched path.
|
||||||
|
// - values are redirection targets relative to the current path.
|
||||||
|
|
||||||
|
const redirects = @REDIRECTS_JSON@;
|
||||||
|
|
||||||
|
// the following code matches the current page's URL against the set of redirects.
|
||||||
|
//
|
||||||
|
// it is written to minimize the latency between page load and redirect.
|
||||||
|
// therefore we avoid function calls, copying data, and unnecessary loops.
|
||||||
|
// IMPORTANT: we use stateful array operations and their order matters!
|
||||||
|
//
|
||||||
|
// matching URLs is more involved than it should be:
|
||||||
|
//
|
||||||
|
// 1. `document.location.pathname` can have an arbitrary prefix.
|
||||||
|
//
|
||||||
|
// 2. `path_to_root` is set by mdBook. it consists only of `../`s and
|
||||||
|
// determines the depth of `<path>` relative to the prefix:
|
||||||
|
//
|
||||||
|
// `document.location.pathname`
|
||||||
|
// |------------------------------|
|
||||||
|
// /<prefix>/<path>/[<file>[.html]][#<anchor>]
|
||||||
|
// |----|
|
||||||
|
// `path_to_root` has same number of path segments
|
||||||
|
//
|
||||||
|
// source: https://phaiax.github.io/mdBook/format/theme/index-hbs.html#data
|
||||||
|
//
|
||||||
|
// 3. the following paths are equivalent:
|
||||||
|
//
|
||||||
|
// /foo/bar/
|
||||||
|
// /foo/bar/index.html
|
||||||
|
// /foo/bar/index
|
||||||
|
//
|
||||||
|
// 4. the following paths are also equivalent:
|
||||||
|
//
|
||||||
|
// /foo/bar/baz
|
||||||
|
// /foo/bar/baz.html
|
||||||
|
//
|
||||||
|
|
||||||
|
let segments = document.location.pathname.split('/');
|
||||||
|
|
||||||
|
let file = segments.pop();
|
||||||
|
|
||||||
|
// normalize file name
|
||||||
|
if (file === '') { file = "index.html"; }
|
||||||
|
else if (!file.endsWith('.html')) { file = file + '.html'; }
|
||||||
|
|
||||||
|
segments.push(file);
|
||||||
|
|
||||||
|
// use `path_to_root` to discern prefix from path.
|
||||||
|
const depth = path_to_root.split('/').length;
|
||||||
|
|
||||||
|
// remove segments containing prefix. the following works because
|
||||||
|
// 1. the original `document.location.pathname` is absolute,
|
||||||
|
// hence first element of `segments` is always empty.
|
||||||
|
// 2. last element of splitting `path_to_root` is also always empty.
|
||||||
|
// 3. last element of `segments` is the file name.
|
||||||
|
//
|
||||||
|
// visual example:
|
||||||
|
//
|
||||||
|
// '/foo/bar/baz.html'.split('/') -> [ '', 'foo', 'bar', 'baz.html' ]
|
||||||
|
// '../'.split('/') -> [ '..', '' ]
|
||||||
|
//
|
||||||
|
// the following operations will then result in
|
||||||
|
//
|
||||||
|
// path = 'bar/baz.html'
|
||||||
|
//
|
||||||
|
segments.splice(0, segments.length - depth);
|
||||||
|
const path = segments.join('/');
|
||||||
|
|
||||||
|
// anchor starts with the hash character (`#`),
|
||||||
|
// but our redirect declarations don't, so we strip it.
|
||||||
|
// example:
|
||||||
|
// document.location.hash -> '#foo'
|
||||||
|
// document.location.hash.substring(1) -> 'foo'
|
||||||
|
const anchor = document.location.hash.substring(1);
|
||||||
|
|
||||||
|
const redirect = redirects[path];
|
||||||
|
if (redirect) {
|
||||||
|
const target = redirect[anchor];
|
||||||
|
if (target) {
|
||||||
|
document.location.href = target;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,372 @@
|
|||||||
|
{
|
||||||
|
"index.html": {
|
||||||
|
"part-advanced-topics": "advanced-topics/index.html",
|
||||||
|
"chap-tuning-cores-and-jobs": "advanced-topics/cores-vs-jobs.html",
|
||||||
|
"chap-diff-hook": "advanced-topics/diff-hook.html",
|
||||||
|
"check-dirs-are-unregistered": "advanced-topics/diff-hook.html#check-dirs-are-unregistered",
|
||||||
|
"chap-distributed-builds": "command-ref/conf-file.html#conf-builders",
|
||||||
|
"chap-post-build-hook": "advanced-topics/post-build-hook.html",
|
||||||
|
"chap-post-build-hook-caveats": "advanced-topics/post-build-hook.html#implementation-caveats",
|
||||||
|
"chap-writing-nix-expressions": "language/index.html",
|
||||||
|
"part-command-ref": "command-ref/index.html",
|
||||||
|
"conf-allow-import-from-derivation": "command-ref/conf-file.html#conf-allow-import-from-derivation",
|
||||||
|
"conf-allow-new-privileges": "command-ref/conf-file.html#conf-allow-new-privileges",
|
||||||
|
"conf-allowed-uris": "command-ref/conf-file.html#conf-allowed-uris",
|
||||||
|
"conf-allowed-users": "command-ref/conf-file.html#conf-allowed-users",
|
||||||
|
"conf-auto-optimise-store": "command-ref/conf-file.html#conf-auto-optimise-store",
|
||||||
|
"conf-binary-cache-public-keys": "command-ref/conf-file.html#conf-trusted-public-keys",
|
||||||
|
"conf-binary-caches": "command-ref/conf-file.html#conf-substituters",
|
||||||
|
"conf-build-compress-log": "command-ref/conf-file.html#conf-compress-build-log",
|
||||||
|
"conf-build-cores": "command-ref/conf-file.html#conf-cores",
|
||||||
|
"conf-build-extra-chroot-dirs": "command-ref/conf-file.html#conf-sandbox-paths",
|
||||||
|
"conf-build-extra-sandbox-paths": "command-ref/conf-file.html#conf-sandbox-paths",
|
||||||
|
"conf-build-fallback": "command-ref/conf-file.html#conf-fallback",
|
||||||
|
"conf-build-max-jobs": "command-ref/conf-file.html#conf-max-jobs",
|
||||||
|
"conf-build-max-log-size": "command-ref/conf-file.html#conf-max-build-log-size",
|
||||||
|
"conf-build-max-silent-time": "command-ref/conf-file.html#conf-max-silent-time",
|
||||||
|
"conf-build-timeout": "command-ref/conf-file.html#conf-timeout",
|
||||||
|
"conf-build-use-chroot": "command-ref/conf-file.html#conf-sandbox",
|
||||||
|
"conf-build-use-sandbox": "command-ref/conf-file.html#conf-sandbox",
|
||||||
|
"conf-build-use-substitutes": "command-ref/conf-file.html#conf-substitute",
|
||||||
|
"conf-build-users-group": "command-ref/conf-file.html#conf-build-users-group",
|
||||||
|
"conf-builders": "command-ref/conf-file.html#conf-builders",
|
||||||
|
"conf-builders-use-substitutes": "command-ref/conf-file.html#conf-builders-use-substitutes",
|
||||||
|
"conf-compress-build-log": "command-ref/conf-file.html#conf-compress-build-log",
|
||||||
|
"conf-connect-timeout": "command-ref/conf-file.html#conf-connect-timeout",
|
||||||
|
"conf-cores": "command-ref/conf-file.html#conf-cores",
|
||||||
|
"conf-diff-hook": "command-ref/conf-file.html#conf-diff-hook",
|
||||||
|
"conf-env-keep-derivations": "command-ref/conf-file.html#conf-keep-env-derivations",
|
||||||
|
"conf-extra-binary-caches": "command-ref/conf-file.html#conf-substituters",
|
||||||
|
"conf-extra-platforms": "command-ref/conf-file.html#conf-extra-platforms",
|
||||||
|
"conf-extra-sandbox-paths": "command-ref/conf-file.html#conf-sandbox-paths",
|
||||||
|
"conf-extra-substituters": "command-ref/conf-file.html#conf-substituters",
|
||||||
|
"conf-fallback": "command-ref/conf-file.html#conf-fallback",
|
||||||
|
"conf-fsync-metadata": "command-ref/conf-file.html#conf-fsync-metadata",
|
||||||
|
"conf-gc-keep-derivations": "command-ref/conf-file.html#conf-keep-derivations",
|
||||||
|
"conf-gc-keep-outputs": "command-ref/conf-file.html#conf-keep-outputs",
|
||||||
|
"conf-hashed-mirrors": "command-ref/conf-file.html#conf-hashed-mirrors",
|
||||||
|
"conf-http-connections": "command-ref/conf-file.html#conf-http-connections",
|
||||||
|
"conf-keep-build-log": "command-ref/conf-file.html#conf-keep-build-log",
|
||||||
|
"conf-keep-derivations": "command-ref/conf-file.html#conf-keep-derivations",
|
||||||
|
"conf-keep-env-derivations": "command-ref/conf-file.html#conf-keep-env-derivations",
|
||||||
|
"conf-keep-outputs": "command-ref/conf-file.html#conf-keep-outputs",
|
||||||
|
"conf-max-build-log-size": "command-ref/conf-file.html#conf-max-build-log-size",
|
||||||
|
"conf-max-free": "command-ref/conf-file.html#conf-max-free",
|
||||||
|
"conf-max-jobs": "command-ref/conf-file.html#conf-max-jobs",
|
||||||
|
"conf-max-silent-time": "command-ref/conf-file.html#conf-max-silent-time",
|
||||||
|
"conf-min-free": "command-ref/conf-file.html#conf-min-free",
|
||||||
|
"conf-narinfo-cache-negative-ttl": "command-ref/conf-file.html#conf-narinfo-cache-negative-ttl",
|
||||||
|
"conf-narinfo-cache-positive-ttl": "command-ref/conf-file.html#conf-narinfo-cache-positive-ttl",
|
||||||
|
"conf-netrc-file": "command-ref/conf-file.html#conf-netrc-file",
|
||||||
|
"conf-plugin-files": "command-ref/conf-file.html#conf-plugin-files",
|
||||||
|
"conf-post-build-hook": "command-ref/conf-file.html#conf-post-build-hook",
|
||||||
|
"conf-pre-build-hook": "command-ref/conf-file.html#conf-pre-build-hook",
|
||||||
|
"conf-require-sigs": "command-ref/conf-file.html#conf-require-sigs",
|
||||||
|
"conf-restrict-eval": "command-ref/conf-file.html#conf-restrict-eval",
|
||||||
|
"conf-run-diff-hook": "command-ref/conf-file.html#conf-run-diff-hook",
|
||||||
|
"conf-sandbox": "command-ref/conf-file.html#conf-sandbox",
|
||||||
|
"conf-sandbox-dev-shm-size": "command-ref/conf-file.html#conf-sandbox-dev-shm-size",
|
||||||
|
"conf-sandbox-paths": "command-ref/conf-file.html#conf-sandbox-paths",
|
||||||
|
"conf-secret-key-files": "command-ref/conf-file.html#conf-secret-key-files",
|
||||||
|
"conf-show-trace": "command-ref/conf-file.html#conf-show-trace",
|
||||||
|
"conf-stalled-download-timeout": "command-ref/conf-file.html#conf-stalled-download-timeout",
|
||||||
|
"conf-substitute": "command-ref/conf-file.html#conf-substitute",
|
||||||
|
"conf-substituters": "command-ref/conf-file.html#conf-substituters",
|
||||||
|
"conf-system": "command-ref/conf-file.html#conf-system",
|
||||||
|
"conf-system-features": "command-ref/conf-file.html#conf-system-features",
|
||||||
|
"conf-tarball-ttl": "command-ref/conf-file.html#conf-tarball-ttl",
|
||||||
|
"conf-timeout": "command-ref/conf-file.html#conf-timeout",
|
||||||
|
"conf-trace-function-calls": "command-ref/conf-file.html#conf-trace-function-calls",
|
||||||
|
"conf-trusted-binary-caches": "command-ref/conf-file.html#conf-trusted-substituters",
|
||||||
|
"conf-trusted-public-keys": "command-ref/conf-file.html#conf-trusted-public-keys",
|
||||||
|
"conf-trusted-substituters": "command-ref/conf-file.html#conf-trusted-substituters",
|
||||||
|
"conf-trusted-users": "command-ref/conf-file.html#conf-trusted-users",
|
||||||
|
"extra-sandbox-paths": "command-ref/conf-file.html#conf-sandbox-paths",
|
||||||
|
"sec-conf-file": "command-ref/conf-file.html",
|
||||||
|
"env-NIX_PATH": "command-ref/env-common.html#env-NIX_PATH",
|
||||||
|
"env-common": "command-ref/env-common.html",
|
||||||
|
"envar-remote": "command-ref/env-common.html#env-NIX_REMOTE",
|
||||||
|
"sec-common-env": "command-ref/env-common.html",
|
||||||
|
"ch-files": "command-ref/files.html",
|
||||||
|
"ch-main-commands": "command-ref/main-commands.html",
|
||||||
|
"opt-out-link": "command-ref/nix-build.html#opt-out-link",
|
||||||
|
"sec-nix-build": "command-ref/nix-build.html",
|
||||||
|
"sec-nix-channel": "command-ref/nix-channel.html",
|
||||||
|
"sec-nix-collect-garbage": "command-ref/nix-collect-garbage.html",
|
||||||
|
"sec-nix-copy-closure": "command-ref/nix-copy-closure.html",
|
||||||
|
"sec-nix-daemon": "command-ref/nix-daemon.html",
|
||||||
|
"refsec-nix-env-install-examples": "command-ref/nix-env/install.html#examples",
|
||||||
|
"rsec-nix-env-install": "command-ref/nix-env/install.html",
|
||||||
|
"rsec-nix-env-set": "command-ref/nix-env/set.html",
|
||||||
|
"rsec-nix-env-set-flag": "command-ref/nix-env/set-flag.html",
|
||||||
|
"rsec-nix-env-upgrade": "command-ref/nix-env/upgrade.html",
|
||||||
|
"sec-nix-env": "command-ref/nix-env.html",
|
||||||
|
"ssec-version-comparisons": "command-ref/nix-env.html#selectors",
|
||||||
|
"sec-nix-hash": "command-ref/nix-hash.html",
|
||||||
|
"sec-nix-instantiate": "command-ref/nix-instantiate.html",
|
||||||
|
"sec-nix-prefetch-url": "command-ref/nix-prefetch-url.html",
|
||||||
|
"sec-nix-shell": "command-ref/nix-shell.html",
|
||||||
|
"ssec-nix-shell-shebang": "command-ref/nix-shell.html#use-as-a--interpreter",
|
||||||
|
"nixref-queries": "command-ref/nix-store/query.html#queries",
|
||||||
|
"opt-add-root": "command-ref/nix-store/query.html#opt-add-root",
|
||||||
|
"refsec-nix-store-dump": "command-ref/nix-store/dump.html",
|
||||||
|
"refsec-nix-store-export": "command-ref/nix-store/export.html",
|
||||||
|
"refsec-nix-store-import": "command-ref/nix-store/import.html",
|
||||||
|
"refsec-nix-store-query": "command-ref/nix-store/query.html",
|
||||||
|
"refsec-nix-store-verify": "command-ref/nix-store/verify.html",
|
||||||
|
"rsec-nix-store-gc": "command-ref/nix-store/gc.html",
|
||||||
|
"rsec-nix-store-generate-binary-cache-key": "command-ref/nix-store/generate-binary-cache-key.html",
|
||||||
|
"rsec-nix-store-realise": "command-ref/nix-store/realise.html",
|
||||||
|
"rsec-nix-store-serve": "command-ref/nix-store/serve.html",
|
||||||
|
"sec-nix-store": "command-ref/nix-store.html",
|
||||||
|
"opt-I": "command-ref/opt-common.html#opt-I",
|
||||||
|
"opt-attr": "command-ref/opt-common.html#opt-attr",
|
||||||
|
"opt-common": "command-ref/opt-common.html",
|
||||||
|
"opt-cores": "command-ref/opt-common.html#opt-cores",
|
||||||
|
"opt-log-format": "command-ref/opt-common.html#opt-log-format",
|
||||||
|
"opt-max-jobs": "command-ref/opt-common.html#opt-max-jobs",
|
||||||
|
"opt-max-silent-time": "command-ref/opt-common.html#opt-max-silent-time",
|
||||||
|
"opt-timeout": "command-ref/opt-common.html#opt-timeout",
|
||||||
|
"sec-common-options": "command-ref/opt-common.html",
|
||||||
|
"ch-utilities": "command-ref/utilities.html",
|
||||||
|
"chap-hacking": "development/building.html",
|
||||||
|
"adv-attr-allowSubstitutes": "language/advanced-attributes.html#adv-attr-allowSubstitutes",
|
||||||
|
"adv-attr-allowedReferences": "language/advanced-attributes.html#adv-attr-allowedReferences",
|
||||||
|
"adv-attr-allowedRequisites": "language/advanced-attributes.html#adv-attr-allowedRequisites",
|
||||||
|
"adv-attr-disallowedReferences": "language/advanced-attributes.html#adv-attr-disallowedReferences",
|
||||||
|
"adv-attr-disallowedRequisites": "language/advanced-attributes.html#adv-attr-disallowedRequisites",
|
||||||
|
"adv-attr-exportReferencesGraph": "language/advanced-attributes.html#adv-attr-exportReferencesGraph",
|
||||||
|
"adv-attr-impureEnvVars": "language/advanced-attributes.html#adv-attr-impureEnvVars",
|
||||||
|
"adv-attr-outputHash": "language/advanced-attributes.html#adv-attr-outputHash",
|
||||||
|
"adv-attr-outputHashAlgo": "language/advanced-attributes.html#adv-attr-outputHashAlgo",
|
||||||
|
"adv-attr-outputHashMode": "language/advanced-attributes.html#adv-attr-outputHashMode",
|
||||||
|
"adv-attr-passAsFile": "language/advanced-attributes.html#adv-attr-passAsFile",
|
||||||
|
"adv-attr-preferLocalBuild": "language/advanced-attributes.html#adv-attr-preferLocalBuild",
|
||||||
|
"fixed-output-drvs": "language/advanced-attributes.html#adv-attr-outputHash",
|
||||||
|
"sec-advanced-attributes": "language/advanced-attributes.html",
|
||||||
|
"builtin-abort": "language/builtins.html#builtins-abort",
|
||||||
|
"builtin-add": "language/builtins.html#builtins-add",
|
||||||
|
"builtin-all": "language/builtins.html#builtins-all",
|
||||||
|
"builtin-any": "language/builtins.html#builtins-any",
|
||||||
|
"builtin-attrNames": "language/builtins.html#builtins-attrNames",
|
||||||
|
"builtin-attrValues": "language/builtins.html#builtins-attrValues",
|
||||||
|
"builtin-baseNameOf": "language/builtins.html#builtins-baseNameOf",
|
||||||
|
"builtin-bitAnd": "language/builtins.html#builtins-bitAnd",
|
||||||
|
"builtin-bitOr": "language/builtins.html#builtins-bitOr",
|
||||||
|
"builtin-bitXor": "language/builtins.html#builtins-bitXor",
|
||||||
|
"builtin-builtins": "language/builtins.html#builtins-builtins",
|
||||||
|
"builtin-compareVersions": "language/builtins.html#builtins-compareVersions",
|
||||||
|
"builtin-concatLists": "language/builtins.html#builtins-concatLists",
|
||||||
|
"builtin-concatStringsSep": "language/builtins.html#builtins-concatStringsSep",
|
||||||
|
"builtin-currentSystem": "language/builtins.html#builtins-currentSystem",
|
||||||
|
"builtin-deepSeq": "language/builtins.html#builtins-deepSeq",
|
||||||
|
"builtin-derivation": "language/builtins.html#builtins-derivation",
|
||||||
|
"builtin-dirOf": "language/builtins.html#builtins-dirOf",
|
||||||
|
"builtin-div": "language/builtins.html#builtins-div",
|
||||||
|
"builtin-elem": "language/builtins.html#builtins-elem",
|
||||||
|
"builtin-elemAt": "language/builtins.html#builtins-elemAt",
|
||||||
|
"builtin-fetchGit": "language/builtins.html#builtins-fetchGit",
|
||||||
|
"builtin-fetchTarball": "language/builtins.html#builtins-fetchTarball",
|
||||||
|
"builtin-fetchurl": "language/builtins.html#builtins-fetchurl",
|
||||||
|
"builtin-filterSource": "language/builtins.html#builtins-filterSource",
|
||||||
|
"builtin-foldl-prime": "language/builtins.html#builtins-foldl'",
|
||||||
|
"builtin-fromJSON": "language/builtins.html#builtins-fromJSON",
|
||||||
|
"builtin-functionArgs": "language/builtins.html#builtins-functionArgs",
|
||||||
|
"builtin-genList": "language/builtins.html#builtins-genList",
|
||||||
|
"builtin-getAttr": "language/builtins.html#builtins-getAttr",
|
||||||
|
"builtin-getEnv": "language/builtins.html#builtins-getEnv",
|
||||||
|
"builtin-hasAttr": "language/builtins.html#builtins-hasAttr",
|
||||||
|
"builtin-hashFile": "language/builtins.html#builtins-hashFile",
|
||||||
|
"builtin-hashString": "language/builtins.html#builtins-hashString",
|
||||||
|
"builtin-head": "language/builtins.html#builtins-head",
|
||||||
|
"builtin-import": "language/builtins.html#builtins-import",
|
||||||
|
"builtin-intersectAttrs": "language/builtins.html#builtins-intersectAttrs",
|
||||||
|
"builtin-isAttrs": "language/builtins.html#builtins-isAttrs",
|
||||||
|
"builtin-isBool": "language/builtins.html#builtins-isBool",
|
||||||
|
"builtin-isFloat": "language/builtins.html#builtins-isFloat",
|
||||||
|
"builtin-isFunction": "language/builtins.html#builtins-isFunction",
|
||||||
|
"builtin-isInt": "language/builtins.html#builtins-isInt",
|
||||||
|
"builtin-isList": "language/builtins.html#builtins-isList",
|
||||||
|
"builtin-isNull": "language/builtins.html#builtins-isNull",
|
||||||
|
"builtin-isString": "language/builtins.html#builtins-isString",
|
||||||
|
"builtin-length": "language/builtins.html#builtins-length",
|
||||||
|
"builtin-lessThan": "language/builtins.html#builtins-lessThan",
|
||||||
|
"builtin-listToAttrs": "language/builtins.html#builtins-listToAttrs",
|
||||||
|
"builtin-map": "language/builtins.html#builtins-map",
|
||||||
|
"builtin-match": "language/builtins.html#builtins-match",
|
||||||
|
"builtin-mul": "language/builtins.html#builtins-mul",
|
||||||
|
"builtin-parseDrvName": "language/builtins.html#builtins-parseDrvName",
|
||||||
|
"builtin-path": "language/builtins.html#builtins-path",
|
||||||
|
"builtin-pathExists": "language/builtins.html#builtins-pathExists",
|
||||||
|
"builtin-placeholder": "language/builtins.html#builtins-placeholder",
|
||||||
|
"builtin-readDir": "language/builtins.html#builtins-readDir",
|
||||||
|
"builtin-readFile": "language/builtins.html#builtins-readFile",
|
||||||
|
"builtin-removeAttrs": "language/builtins.html#builtins-removeAttrs",
|
||||||
|
"builtin-replaceStrings": "language/builtins.html#builtins-replaceStrings",
|
||||||
|
"builtin-seq": "language/builtins.html#builtins-seq",
|
||||||
|
"builtin-sort": "language/builtins.html#builtins-sort",
|
||||||
|
"builtin-split": "language/builtins.html#builtins-split",
|
||||||
|
"builtin-splitVersion": "language/builtins.html#builtins-splitVersion",
|
||||||
|
"builtin-stringLength": "language/builtins.html#builtins-stringLength",
|
||||||
|
"builtin-sub": "language/builtins.html#builtins-sub",
|
||||||
|
"builtin-substring": "language/builtins.html#builtins-substring",
|
||||||
|
"builtin-tail": "language/builtins.html#builtins-tail",
|
||||||
|
"builtin-throw": "language/builtins.html#builtins-throw",
|
||||||
|
"builtin-toFile": "language/builtins.html#builtins-toFile",
|
||||||
|
"builtin-toJSON": "language/builtins.html#builtins-toJSON",
|
||||||
|
"builtin-toPath": "language/builtins.html#builtins-toPath",
|
||||||
|
"builtin-toString": "language/builtins.html#builtins-toString",
|
||||||
|
"builtin-toXML": "language/builtins.html#builtins-toXML",
|
||||||
|
"builtin-trace": "language/builtins.html#builtins-trace",
|
||||||
|
"builtin-tryEval": "language/builtins.html#builtins-tryEval",
|
||||||
|
"builtin-typeOf": "language/builtins.html#builtins-typeOf",
|
||||||
|
"ssec-builtins": "language/builtins.html",
|
||||||
|
"attr-system": "language/derivations.html#attr-system",
|
||||||
|
"ssec-derivation": "language/derivations.html",
|
||||||
|
"ch-expression-language": "language/index.html",
|
||||||
|
"sec-constructs": "language/syntax.html",
|
||||||
|
"sect-let-language": "language/syntax.html#let-expressions",
|
||||||
|
"ss-functions": "language/syntax.html#functions",
|
||||||
|
"sec-language-operators": "language/operators.html",
|
||||||
|
"table-operators": "language/operators.html",
|
||||||
|
"ssec-values": "language/types.html",
|
||||||
|
"gloss-closure": "glossary.html#gloss-closure",
|
||||||
|
"gloss-derivation": "glossary.html#gloss-derivation",
|
||||||
|
"gloss-deriver": "glossary.html#gloss-deriver",
|
||||||
|
"gloss-nar": "glossary.html#gloss-nar",
|
||||||
|
"gloss-output-path": "glossary.html#gloss-output-path",
|
||||||
|
"gloss-profile": "glossary.html#gloss-profile",
|
||||||
|
"gloss-reachable": "glossary.html#gloss-reachable",
|
||||||
|
"gloss-reference": "glossary.html#gloss-reference",
|
||||||
|
"gloss-substitute": "glossary.html#gloss-substitute",
|
||||||
|
"gloss-user-env": "glossary.html#gloss-user-env",
|
||||||
|
"gloss-validity": "glossary.html#gloss-validity",
|
||||||
|
"part-glossary": "glossary.html",
|
||||||
|
"sec-building-source": "installation/building-source.html",
|
||||||
|
"ch-env-variables": "installation/env-variables.html",
|
||||||
|
"sec-installer-proxy-settings": "installation/env-variables.html#proxy-environment-variables",
|
||||||
|
"sec-nix-ssl-cert-file": "installation/env-variables.html#nix_ssl_cert_file",
|
||||||
|
"sec-nix-ssl-cert-file-with-nix-daemon-and-macos": "installation/env-variables.html#nix_ssl_cert_file",
|
||||||
|
"chap-installation": "installation/index.html",
|
||||||
|
"ch-installing-binary": "installation/installing-binary.html",
|
||||||
|
"sect-macos-installation": "installation/installing-binary.html#macos-installation",
|
||||||
|
"sect-macos-installation-change-store-prefix": "installation/installing-binary.html#macos-installation",
|
||||||
|
"sect-macos-installation-encrypted-volume": "installation/installing-binary.html#macos-installation",
|
||||||
|
"sect-macos-installation-recommended-notes": "installation/installing-binary.html#macos-installation",
|
||||||
|
"sect-macos-installation-symlink": "installation/installing-binary.html#macos-installation",
|
||||||
|
"sect-multi-user-installation": "installation/installing-binary.html#multi-user-installation",
|
||||||
|
"sect-nix-install-binary-tarball": "installation/installing-binary.html#installing-from-a-binary-tarball",
|
||||||
|
"sect-nix-install-pinned-version-url":
|
||||||
|
"installation/installing-binary.html#installing-a-pinned-nix-version-from-a-url",
|
||||||
|
"sect-single-user-installation": "installation/installing-binary.html#single-user-installation",
|
||||||
|
"ch-installing-source": "installation/installing-source.html",
|
||||||
|
"ssec-multi-user": "installation/multi-user.html",
|
||||||
|
"ch-nix-security": "installation/nix-security.html",
|
||||||
|
"sec-obtaining-source": "installation/obtaining-source.html",
|
||||||
|
"sec-prerequisites-source": "installation/prerequisites-source.html",
|
||||||
|
"sec-single-user": "installation/single-user.html",
|
||||||
|
"ch-supported-platforms": "installation/supported-platforms.html",
|
||||||
|
"ch-upgrading-nix": "installation/upgrading.html",
|
||||||
|
"ch-about-nix": "introduction.html",
|
||||||
|
"chap-introduction": "introduction.html",
|
||||||
|
"ch-basic-package-mgmt": "package-management/index.html",
|
||||||
|
"ssec-binary-cache-substituter": "package-management/binary-cache-substituter.html",
|
||||||
|
"sec-channels": "command-ref/nix-channel.html",
|
||||||
|
"ssec-copy-closure": "command-ref/nix-copy-closure.html",
|
||||||
|
"sec-garbage-collection": "package-management/garbage-collection.html",
|
||||||
|
"ssec-gc-roots": "package-management/garbage-collector-roots.html",
|
||||||
|
"chap-package-management": "package-management/index.html",
|
||||||
|
"sec-profiles": "package-management/profiles.html",
|
||||||
|
"ssec-s3-substituter": "store/types/s3-binary-cache-store.html",
|
||||||
|
"ssec-s3-substituter-anonymous-reads":
|
||||||
|
"store/types/s3-binary-cache-store.html#anonymous-reads-to-your-s3-compatible-binary-cache",
|
||||||
|
"ssec-s3-substituter-authenticated-reads":
|
||||||
|
"store/types/s3-binary-cache-store.html#authenticated-reads-to-your-s3-binary-cache",
|
||||||
|
"ssec-s3-substituter-authenticated-writes":
|
||||||
|
"store/types/s3-binary-cache-store.html#authenticated-writes-to-your-s3-compatible-binary-cache",
|
||||||
|
"sec-sharing-packages": "package-management/sharing-packages.html",
|
||||||
|
"ssec-ssh-substituter": "package-management/ssh-substituter.html",
|
||||||
|
"chap-quick-start": "quick-start.html",
|
||||||
|
"sec-relnotes": "release-notes/index.html",
|
||||||
|
"ch-relnotes-0.10.1": "release-notes/rl-0.10.1.html",
|
||||||
|
"ch-relnotes-0.10": "release-notes/rl-0.10.html",
|
||||||
|
"ssec-relnotes-0.11": "release-notes/rl-0.11.html",
|
||||||
|
"ssec-relnotes-0.12": "release-notes/rl-0.12.html",
|
||||||
|
"ssec-relnotes-0.13": "release-notes/rl-0.13.html",
|
||||||
|
"ssec-relnotes-0.14": "release-notes/rl-0.14.html",
|
||||||
|
"ssec-relnotes-0.15": "release-notes/rl-0.15.html",
|
||||||
|
"ssec-relnotes-0.16": "release-notes/rl-0.16.html",
|
||||||
|
"ch-relnotes-0.5": "release-notes/rl-0.5.html",
|
||||||
|
"ch-relnotes-0.6": "release-notes/rl-0.6.html",
|
||||||
|
"ch-relnotes-0.7": "release-notes/rl-0.7.html",
|
||||||
|
"ch-relnotes-0.8.1": "release-notes/rl-0.8.1.html",
|
||||||
|
"ch-relnotes-0.8": "release-notes/rl-0.8.html",
|
||||||
|
"ch-relnotes-0.9.1": "release-notes/rl-0.9.1.html",
|
||||||
|
"ch-relnotes-0.9.2": "release-notes/rl-0.9.2.html",
|
||||||
|
"ch-relnotes-0.9": "release-notes/rl-0.9.html",
|
||||||
|
"ssec-relnotes-1.0": "release-notes/rl-1.0.html",
|
||||||
|
"ssec-relnotes-1.1": "release-notes/rl-1.1.html",
|
||||||
|
"ssec-relnotes-1.10": "release-notes/rl-1.10.html",
|
||||||
|
"ssec-relnotes-1.11.10": "release-notes/rl-1.11.10.html",
|
||||||
|
"ssec-relnotes-1.11": "release-notes/rl-1.11.html",
|
||||||
|
"ssec-relnotes-1.2": "release-notes/rl-1.2.html",
|
||||||
|
"ssec-relnotes-1.3": "release-notes/rl-1.3.html",
|
||||||
|
"ssec-relnotes-1.4": "release-notes/rl-1.4.html",
|
||||||
|
"ssec-relnotes-1.5.1": "release-notes/rl-1.5.html",
|
||||||
|
"ssec-relnotes-1.5.2": "release-notes/rl-1.5.2.html",
|
||||||
|
"ssec-relnotes-1.5": "release-notes/rl-1.5.html",
|
||||||
|
"ssec-relnotes-1.6.1": "release-notes/rl-1.6.1.html",
|
||||||
|
"ssec-relnotes-1.6.0": "release-notes/rl-1.6.html",
|
||||||
|
"ssec-relnotes-1.7": "release-notes/rl-1.7.html",
|
||||||
|
"ssec-relnotes-1.8": "release-notes/rl-1.8.html",
|
||||||
|
"ssec-relnotes-1.9": "release-notes/rl-1.9.html",
|
||||||
|
"ssec-relnotes-2.0": "release-notes/rl-2.0.html",
|
||||||
|
"ssec-relnotes-2.1": "release-notes/rl-2.1.html",
|
||||||
|
"ssec-relnotes-2.2": "release-notes/rl-2.2.html",
|
||||||
|
"ssec-relnotes-2.3": "release-notes/rl-2.3.html"
|
||||||
|
},
|
||||||
|
"language/types.html": {
|
||||||
|
"simple-values": "#primitives",
|
||||||
|
"lists": "#type-list",
|
||||||
|
"strings": "#type-string",
|
||||||
|
"attribute-sets": "#type-attrs",
|
||||||
|
"type-number": "#type-int"
|
||||||
|
},
|
||||||
|
"language/syntax.html": {
|
||||||
|
"scoping-rules": "scope.html",
|
||||||
|
"string-literal": "string-literals.html"
|
||||||
|
},
|
||||||
|
"language/derivations.html": {
|
||||||
|
"builder-execution": "../store/building.html#builder-execution"
|
||||||
|
},
|
||||||
|
"installation/installing-binary.html": {
|
||||||
|
"linux": "uninstall.html#linux",
|
||||||
|
"macos": "uninstall.html#macos",
|
||||||
|
"uninstalling": "uninstall.html"
|
||||||
|
},
|
||||||
|
"development/building.html": {
|
||||||
|
"nix-with-flakes": "#building-nix-with-flakes",
|
||||||
|
"classic-nix": "#building-nix",
|
||||||
|
"running-tests": "testing.html#running-tests",
|
||||||
|
"unit-tests": "testing.html#unit-tests",
|
||||||
|
"functional-tests": "testing.html#functional-tests",
|
||||||
|
"debugging-failing-functional-tests": "testing.html#debugging-failing-functional-tests",
|
||||||
|
"integration-tests": "testing.html#integration-tests",
|
||||||
|
"installer-tests": "testing.html#installer-tests",
|
||||||
|
"one-time-setup": "testing.html#one-time-setup",
|
||||||
|
"using-the-ci-generated-installer-for-manual-testing":
|
||||||
|
"testing.html#using-the-ci-generated-installer-for-manual-testing",
|
||||||
|
"characterization-testing": "testing.html#characterisation-testing-unit",
|
||||||
|
"add-a-release-note": "contributing.html#add-a-release-note",
|
||||||
|
"add-an-entry": "contributing.html#add-an-entry",
|
||||||
|
"build-process": "contributing.html#build-process",
|
||||||
|
"reverting": "contributing.html#reverting",
|
||||||
|
"branches": "contributing.html#branches"
|
||||||
|
},
|
||||||
|
"glossary.html": {
|
||||||
|
"gloss-local-store": "store/types/local-store.html",
|
||||||
|
"package-attribute-set": "#package",
|
||||||
|
"gloss-chroot-store": "store/types/local-store.html",
|
||||||
|
"gloss-content-addressed-derivation": "#gloss-content-addressing-derivation"
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable → Regular
+35
-5
@@ -1,25 +1,55 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Standalone manpage renderer that doesn't require mdbook.
|
||||||
|
# Uses expand-includes.py to preprocess markdown, then lowdown to generate manpages.
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
lowdown_args=
|
lowdown_args=
|
||||||
|
|
||||||
|
# Optional --out-no-smarty flag for compatibility with nix_nested_manpages
|
||||||
if [ "$1" = --out-no-smarty ]; then
|
if [ "$1" = --out-no-smarty ]; then
|
||||||
lowdown_args=--out-no-smarty
|
lowdown_args=--out-no-smarty
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "$#" = 4 ] || {
|
[ "$#" = 7 ] || {
|
||||||
echo "wrong number of args passed" >&2
|
cat >&2 <<EOF
|
||||||
|
Usage: $0 [--out-no-smarty] <title> <section> <source-root> <generated-root> <doc-url> <infile> <outfile>
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
title - Manpage title (e.g., "nix-env --install")
|
||||||
|
section - Manpage section number (1, 5, 8, etc.)
|
||||||
|
source-root - Root directory of markdown sources
|
||||||
|
generated-root - Root directory of generated markdown files
|
||||||
|
doc-url - Base URL for documentation links
|
||||||
|
infile - Input markdown file (relative to build directory)
|
||||||
|
outfile - Output manpage file
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
$0 "nix-store --query" 1 doc/manual/source build/doc/manual/source \\
|
||||||
|
https://nix.dev/manual/nix/latest \\
|
||||||
|
build/doc/manual/source/command-ref/nix-store/query.md nix-store-query.1
|
||||||
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
title="$1"
|
title="$1"
|
||||||
section="$2"
|
section="$2"
|
||||||
infile="$3"
|
source_root="$3"
|
||||||
outfile="$4"
|
generated_root="$4"
|
||||||
|
doc_url="$5"
|
||||||
|
infile="$6"
|
||||||
|
outfile="$7"
|
||||||
|
|
||||||
|
# Expand includes and pipe to lowdown
|
||||||
(
|
(
|
||||||
printf "Title: %s\n\n" "$title"
|
printf "Title: %s\n\n" "$title"
|
||||||
cat "$infile"
|
python3 "$script_dir/expand-includes.py" \
|
||||||
|
--source-root "$source_root" \
|
||||||
|
--generated-root "$generated_root" \
|
||||||
|
--doc-url "$doc_url" \
|
||||||
|
"$infile"
|
||||||
) | lowdown -sT man --nroff-nolinks $lowdown_args -M section="$section" -o "$outfile"
|
) | lowdown -sT man --nroff-nolinks $lowdown_args -M section="$section" -o "$outfile"
|
||||||
@@ -6,33 +6,66 @@ issues: []
|
|||||||
|
|
||||||
JSON formats for store path info and derivations have been updated with new versions and structured fields.
|
JSON formats for store path info and derivations have been updated with new versions and structured fields.
|
||||||
|
|
||||||
## Store Path Info JSON (Version 2)
|
## Store Path Info JSON
|
||||||
|
|
||||||
The store path info JSON format has been updated from version 1 to version 2:
|
`nix path-info --json` now requires a `--json-format` flag to specify the output format version.
|
||||||
|
Using `--json` without `--json-format` is deprecated and will become an error in a future release.
|
||||||
|
For now, it defaults to version 1 with a warning, for a smoother migration.
|
||||||
|
|
||||||
- **Added `version` field**:
|
### Version 1 (`--json-format 1`)
|
||||||
|
|
||||||
All store path info JSON now includes `"version": 2`.
|
This is the legacy format, preserved for backwards compatibility:
|
||||||
|
|
||||||
|
- String-based hash values (e.g., `"narHash": "sha256:FePFYIlM..."`)
|
||||||
|
- String-based content addresses (e.g., `"ca": "fixed:r:sha256:1abc..."`)
|
||||||
|
- Full store paths for map keys and references (e.g., `"/nix/store/abc...-foo"`)
|
||||||
|
- Now includes `"storeDir"` field at the top level
|
||||||
|
|
||||||
|
### Version 2 (`--json-format 2`)
|
||||||
|
|
||||||
|
The new structured format follows the [JSON guidelines](@docroot@/development/json-guideline.md) with the following changes:
|
||||||
|
|
||||||
|
- **Nested structure with top-level metadata**:
|
||||||
|
|
||||||
|
The output is now wrapped in an object with `version`, `storeDir`, and `info` fields:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"storeDir": "/nix/store",
|
||||||
|
"info": { ... }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The map from store bath base names to store object info is nested under the `info` field.
|
||||||
|
|
||||||
|
- **Store path base names instead of full paths**:
|
||||||
|
|
||||||
|
Map keys and references use store path base names (e.g., `"abc...-foo"`) instead of full absolute store paths.
|
||||||
|
Combined with `storeDir`, the full path can be reconstructed.
|
||||||
|
|
||||||
- **Structured `ca` field**:
|
- **Structured `ca` field**:
|
||||||
|
|
||||||
Content address is now a structured JSON object instead of a string:
|
Content address is now a structured JSON object instead of a string:
|
||||||
|
|
||||||
- Old: `"ca": "fixed:r:sha256:1abc..."`
|
- Old: `"ca": "fixed:r:sha256:1abc..."`
|
||||||
- New: `"ca": {"method": "nar", "hash": {"algorithm": "sha256", "format": "base64", "hash": "EMIJ+giQ..."}}`
|
- New: `"ca": {"method": "nar", "hash": "sha256-ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="}`
|
||||||
- Still `null` values for input-addressed store objects
|
- Still `null` values for input-addressed store objects
|
||||||
|
|
||||||
- **Structured hash fields**:
|
The `hash` field uses the [SRI](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) format like other hashes.
|
||||||
|
|
||||||
Hash values (`narHash` and `downloadHash`) are now structured JSON objects instead of strings:
|
|
||||||
|
|
||||||
- Old: `"narHash": "sha256:FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="`
|
|
||||||
- New: `"narHash": {"algorithm": "sha256", "format": "base64", "hash": "FePFYIlM..."}`
|
|
||||||
- Same structure applies to `downloadHash` in NAR info contexts
|
|
||||||
|
|
||||||
Nix currently only produces, and doesn't consume this format.
|
Nix currently only produces, and doesn't consume this format.
|
||||||
|
|
||||||
**Affected command**: `nix path-info --json`
|
Additionally the following field is added to both formats.
|
||||||
|
(The `version` tracks breaking changes, and adding fields to outputted JSON is not a breaking change.)
|
||||||
|
|
||||||
|
- **`version` field**:
|
||||||
|
|
||||||
|
All store path info JSON now includes `"version": <1|2>`.
|
||||||
|
|
||||||
|
- **`storeDir` field**:
|
||||||
|
|
||||||
|
Top-level `"storeDir"` field contains the store directory path (e.g., `"/nix/store"`).
|
||||||
|
|
||||||
## Derivation JSON (Version 4)
|
## Derivation JSON (Version 4)
|
||||||
|
|
||||||
@@ -47,9 +80,9 @@ The derivation JSON format has been updated from version 3 to version 4:
|
|||||||
|
|
||||||
- **Consistent content addresses**:
|
- **Consistent content addresses**:
|
||||||
|
|
||||||
Floating content-addressed outputs now use structured JSON format.
|
Fixed content-addressed outputs now use structured JSON format.
|
||||||
This is the same format as `ca` in in store path info (after the new version).
|
This is the same format as `ca` in store path info (after the new version).
|
||||||
|
|
||||||
Version 3 and earlier formats are *not* accepted when reading.
|
Version 3 and earlier formats are *not* accepted when reading.
|
||||||
|
|
||||||
**Affected command**: `nix derivation`, namely it's `show` and `add` sub-commands.
|
**Affected command**: `nix derivation`, namely its `show` and `add` sub-commands.
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
synopsis: Interrupting REPL commands works more than once
|
||||||
|
issues: [13481]
|
||||||
|
---
|
||||||
|
|
||||||
|
Previously, this only worked once per REPL session; further attempts would be ignored.
|
||||||
|
This issue is now fixed, so REPL commands such as `:b` or `:p` can be canceled consistently.
|
||||||
|
This is a cherry-pick of the change from the [Lix project](https://gerrit.lix.systems/c/lix/+/1097).
|
||||||
@@ -126,10 +126,12 @@
|
|||||||
- [Content Address](protocols/json/content-address.md)
|
- [Content Address](protocols/json/content-address.md)
|
||||||
- [Store Path](protocols/json/store-path.md)
|
- [Store Path](protocols/json/store-path.md)
|
||||||
- [Store Object Info](protocols/json/store-object-info.md)
|
- [Store Object Info](protocols/json/store-object-info.md)
|
||||||
- [Derivation](protocols/json/derivation.md)
|
- [Derivation](protocols/json/derivation/index.md)
|
||||||
|
- [Derivation Options](protocols/json/derivation/options.md)
|
||||||
- [Deriving Path](protocols/json/deriving-path.md)
|
- [Deriving Path](protocols/json/deriving-path.md)
|
||||||
- [Build Trace Entry](protocols/json/build-trace-entry.md)
|
- [Build Trace Entry](protocols/json/build-trace-entry.md)
|
||||||
- [Build Result](protocols/json/build-result.md)
|
- [Build Result](protocols/json/build-result.md)
|
||||||
|
- [Store](protocols/json/store.md)
|
||||||
- [Serving Tarball Flakes](protocols/tarball-fetcher.md)
|
- [Serving Tarball Flakes](protocols/tarball-fetcher.md)
|
||||||
- [Store Path Specification](protocols/store-path.md)
|
- [Store Path Specification](protocols/store-path.md)
|
||||||
- [Nix Archive (NAR) Format](protocols/nix-archive/index.md)
|
- [Nix Archive (NAR) Format](protocols/nix-archive/index.md)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ md5sum`.
|
|||||||
Print the cryptographic hash of the contents of each regular file *path*.
|
Print the cryptographic hash of the contents of each regular file *path*.
|
||||||
That is, instead of computing
|
That is, instead of computing
|
||||||
the hash of the [Nix Archive (NAR)](@docroot@/store/file-system-object/content-address.md#serial-nix-archive) of *path*,
|
the hash of the [Nix Archive (NAR)](@docroot@/store/file-system-object/content-address.md#serial-nix-archive) of *path*,
|
||||||
just [directly hash]((@docroot@/store/file-system-object/content-address.md#serial-flat) *path* as is.
|
just [directly hash](@docroot@/store/file-system-object/content-address.md#serial-flat) *path* as is.
|
||||||
This requires *path* to resolve to a regular file rather than directory.
|
This requires *path* to resolve to a regular file rather than directory.
|
||||||
The result is identical to that produced by the GNU commands
|
The result is identical to that produced by the GNU commands
|
||||||
`md5sum` and `sha1sum`.
|
`md5sum` and `sha1sum`.
|
||||||
|
|||||||
@@ -137,6 +137,12 @@ $ _NIX_TEST_ACCEPT=1 meson test nix-store-tests -v
|
|||||||
will regenerate the "golden master" expected result for the `libnixstore` characterisation tests.
|
will regenerate the "golden master" expected result for the `libnixstore` characterisation tests.
|
||||||
The characterisation tests will mark themselves "skipped" since they regenerated the expected result instead of actually testing anything.
|
The characterisation tests will mark themselves "skipped" since they regenerated the expected result instead of actually testing anything.
|
||||||
|
|
||||||
|
### JSON Schema testing
|
||||||
|
|
||||||
|
In `doc/manual/source/protocols/json/` we have a number of manual pages generated from [JSON Schema](https://json-schema.org/).
|
||||||
|
That JSON schema is tested against the JSON file test data used in [characterisation tests](#characterisation-testing-unit ) for JSON (de)serialization, in `src/json-schema-checks`.
|
||||||
|
Between the JSON (de)serialization testing, and this testing of the same data against the schema, we make sure that the manual, the implementation, and a machine-readable schema are are all in sync.
|
||||||
|
|
||||||
### Unit test support libraries
|
### Unit test support libraries
|
||||||
|
|
||||||
There are headers and code which are not just used to test the library in question, but also downstream libraries.
|
There are headers and code which are not just used to test the library in question, but also downstream libraries.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Some built-ins are also exposed directly in the global scope:
|
|||||||
- [`null`](#builtins-null)
|
- [`null`](#builtins-null)
|
||||||
- [`placeholder`](#builtins-placeholder)
|
- [`placeholder`](#builtins-placeholder)
|
||||||
- [`removeAttrs`](#builtins-removeAttrs)
|
- [`removeAttrs`](#builtins-removeAttrs)
|
||||||
- `scopedImport`
|
- [`scopedImport`](#builtins-scopedImport)
|
||||||
- [`throw`](#builtins-throw)
|
- [`throw`](#builtins-throw)
|
||||||
- [`toString`](#builtins-toString)
|
- [`toString`](#builtins-toString)
|
||||||
- [`true`](#builtins-true)
|
- [`true`](#builtins-true)
|
||||||
|
|||||||
@@ -74,4 +74,48 @@ in f { x = throw "error"; y = throw "error"; }
|
|||||||
=> "ok"
|
=> "ok"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Evaluation order
|
||||||
|
|
||||||
|
The order in which expressions are evaluated is generally unspecified, because it does not affect successful evaluation outcomes.
|
||||||
|
This allows more freedom for the evaluator to evolve and to evaluate efficiently.
|
||||||
|
|
||||||
|
Data dependencies naturally impose some ordering constraints: a value cannot be used before it is computed.
|
||||||
|
Beyond these constraints, the evaluator is free to choose any order.
|
||||||
|
|
||||||
|
The order in which side effects such as [`builtins.trace`](@docroot@/language/builtins.md#builtins-trace) output occurs is not defined, but may be expected to follow data dependencies. <!-- we may want to be more specific about this. -->
|
||||||
|
|
||||||
|
In a lazy language, evaluation order is often opposite to expectations from strict languages.
|
||||||
|
For example, in `let wrap = x: { wrapped = x; }; in wrap (1 + 2)`, the function body produces a result (`{ wrapped = ...; }`) *before* evaluating `x`.
|
||||||
|
|
||||||
|
## Infinite recursion and stack overflow
|
||||||
|
|
||||||
|
During evaluation, two types of errors can occur when expressions reference themselves or call functions too deeply:
|
||||||
|
|
||||||
|
### Infinite recursion
|
||||||
|
|
||||||
|
This error occurs when a value depends on itself through a cycle, making it impossible to compute.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let x = x; in x
|
||||||
|
=> error: infinite recursion encountered
|
||||||
|
```
|
||||||
|
|
||||||
|
Infinite recursion happens at the value level when evaluating an expression requires evaluating the same expression again.
|
||||||
|
|
||||||
|
Despite the name, infinite recursion is cheap to compute and does not involve a stack overflow.
|
||||||
|
The cycle is finite and fairly easy to detect.
|
||||||
|
|
||||||
|
### Stack overflow
|
||||||
|
|
||||||
|
This error occurs when the call depth exceeds the maximum allowed limit.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let f = x: f (x + 1);
|
||||||
|
in f 0
|
||||||
|
=> error: stack overflow; max-call-depth exceeded
|
||||||
|
```
|
||||||
|
|
||||||
|
Stack overflow happens when too many function calls are nested without returning.
|
||||||
|
The maximum call depth is controlled by the [`max-call-depth` setting](@docroot@/command-ref/conf-file.md#conf-max-call-depth).
|
||||||
|
|
||||||
[C API]: @docroot@/c-api.md
|
[C API]: @docroot@/c-api.md
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
| [Greater than or equal to][Comparison] | *expr* `>=` *expr* | none | 10 |
|
| [Greater than or equal to][Comparison] | *expr* `>=` *expr* | none | 10 |
|
||||||
| [Equality] | *expr* `==` *expr* | none | 11 |
|
| [Equality] | *expr* `==` *expr* | none | 11 |
|
||||||
| Inequality | *expr* `!=` *expr* | none | 11 |
|
| Inequality | *expr* `!=` *expr* | none | 11 |
|
||||||
| Logical conjunction (`AND`) | *bool* `&&` *bool* | left | 12 |
|
| [Logical conjunction] (`AND`) | *bool* `&&` *bool* | left | [12](#precedence-and-disjunctive-normal-form) |
|
||||||
| Logical disjunction (`OR`) | *bool* <code>\|\|</code> *bool* | left | 13 |
|
| [Logical disjunction] (`OR`) | *bool* <code>\|\|</code> *bool* | left | [13](#precedence-and-disjunctive-normal-form) |
|
||||||
| [Logical implication] | *bool* `->` *bool* | right | 14 |
|
| [Logical implication] | *bool* `->` *bool* | right | 14 |
|
||||||
| [Pipe operator] (experimental) | *expr* `\|>` *func* | left | 15 |
|
| [Pipe operator] (experimental) | *expr* `\|>` *func* | left | 15 |
|
||||||
| [Pipe operator] (experimental) | *func* `<\|` *expr* | right | 15 |
|
| [Pipe operator] (experimental) | *func* `<\|` *expr* | right | 15 |
|
||||||
@@ -162,6 +162,9 @@ Update [attribute set] *attrset1* with names and values from *attrset2*.
|
|||||||
The returned attribute set will have all of the attributes in *attrset1* and *attrset2*.
|
The returned attribute set will have all of the attributes in *attrset1* and *attrset2*.
|
||||||
If an attribute name is present in both, the attribute value from the latter is taken.
|
If an attribute name is present in both, the attribute value from the latter is taken.
|
||||||
|
|
||||||
|
This operator is [strict](@docroot@/language/evaluation.md#strictness) in both *attrset1* and *attrset2*.
|
||||||
|
That means that both arguments are evaluated to [weak head normal form](@docroot@/language/evaluation.md#values), so the attribute sets themselves are evaluated, but their attribute values are not evaluated.
|
||||||
|
|
||||||
[Update]: #update
|
[Update]: #update
|
||||||
|
|
||||||
## Comparison
|
## Comparison
|
||||||
@@ -185,18 +188,95 @@ All comparison operators are implemented in terms of `<`, and the following equi
|
|||||||
|
|
||||||
## Equality
|
## Equality
|
||||||
|
|
||||||
- [Attribute sets][attribute set] and [lists][list] are compared recursively, and therefore are fully evaluated.
|
- [Attribute sets][attribute set] are compared first by attribute names and then by items until a difference is found.
|
||||||
- Comparison of [functions][function] always returns `false`.
|
- [Lists][list] are compared first by length and then by items until a difference is found.
|
||||||
|
- Comparison of distinct [functions][function] returns `false`, but identical functions may be subject to [value identity optimization](#value-identity-optimization).
|
||||||
- Numbers are type-compatible, see [arithmetic] operators.
|
- Numbers are type-compatible, see [arithmetic] operators.
|
||||||
- Floating point numbers only differ up to a limited precision.
|
- Floating point numbers only differ up to a limited precision.
|
||||||
|
|
||||||
|
The `==` operator is [strict](@docroot@/language/evaluation.md#strictness) in both arguments; when comparing composite types ([attribute sets][attribute set] and [lists][list]), it is partially strict in their contained values: they are evaluated until a difference is found. <!-- this is woefully underspecified, affecting which expressions evaluate correctly; not just "ordering" or error messages. -->
|
||||||
|
|
||||||
|
### Value identity optimization
|
||||||
|
|
||||||
|
Nix performs equality comparisons of nested values by pointer equality or more abstractly, _identity_.
|
||||||
|
Nix semantics ideally do not assign a unique identity to values as they are created, but equality is an exception to this rule.
|
||||||
|
The disputable benefit of this is that it is more efficient, and it allows cyclical structures to be compared, e.g. `let x = { x = x; }; in x == x` evaluates to `true`.
|
||||||
|
However, as a consequence, it makes a function equal to itself when the comparison is made in a list or attribute set, in contradiction to a simple direct comparison.
|
||||||
|
|
||||||
[function]: ./syntax.md#functions
|
[function]: ./syntax.md#functions
|
||||||
|
|
||||||
[Equality]: #equality
|
[Equality]: #equality
|
||||||
|
|
||||||
|
## Logical conjunction
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
|
> *bool1* `&&` *bool2*
|
||||||
|
|
||||||
|
Logical AND. Equivalent to `if` *bool1* `then` *bool2* `else false`.
|
||||||
|
|
||||||
|
This operator is [strict](@docroot@/language/evaluation.md#strictness) in *bool1*, but only evaluates *bool2* if *bool1* is `true`.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> true && false
|
||||||
|
> => false
|
||||||
|
>
|
||||||
|
> false && throw "never evaluated"
|
||||||
|
> => false
|
||||||
|
> ```
|
||||||
|
|
||||||
|
[Logical conjunction]: #logical-conjunction
|
||||||
|
|
||||||
|
## Logical disjunction
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
|
> *bool1* `||` *bool2*
|
||||||
|
|
||||||
|
Logical OR. Equivalent to `if` *bool1* `then true` `else` *bool2*.
|
||||||
|
|
||||||
|
This operator is [strict](@docroot@/language/evaluation.md#strictness) in *bool1*, but only evaluates *bool2* if *bool1* is `false`.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> true || false
|
||||||
|
> => true
|
||||||
|
>
|
||||||
|
> true || throw "never evaluated"
|
||||||
|
> => true
|
||||||
|
> ```
|
||||||
|
|
||||||
|
[Logical disjunction]: #logical-disjunction
|
||||||
|
|
||||||
|
### Precedence and disjunctive normal form
|
||||||
|
|
||||||
|
The precedence of `&&` and `||` aligns with disjunctive normal form.
|
||||||
|
Without parentheses, an expression describes multiple "permissible situations" (connected by `||`), where each situation consists of multiple simultaneous conditions (connected by `&&`).
|
||||||
|
|
||||||
|
For example, `A || B && C || D && E` is parsed as `A || (B && C) || (D && E)`, describing three permissible situations: A holds, or both B and C hold, or both D and E hold.
|
||||||
|
|
||||||
## Logical implication
|
## Logical implication
|
||||||
|
|
||||||
Equivalent to `!`*b1* `||` *b2* (or `if` *b1* `then` *b2* `else true`)
|
> **Syntax**
|
||||||
|
>
|
||||||
|
> *bool1* `->` *bool2*
|
||||||
|
|
||||||
|
Logical implication. Equivalent to `!`*bool1* `||` *bool2* (or `if` *bool1* `then` *bool2* `else true`).
|
||||||
|
|
||||||
|
This operator is [strict](@docroot@/language/evaluation.md#strictness) in *bool1*, but only evaluates *bool2* if *bool1* is `true`.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> true -> false
|
||||||
|
> => false
|
||||||
|
>
|
||||||
|
> false -> throw "never evaluated"
|
||||||
|
> => true
|
||||||
|
> ```
|
||||||
|
|
||||||
[Logical implication]: #logical-implication
|
[Logical implication]: #logical-implication
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{{#include derivation-v4-fixed.md}}
|
|
||||||
|
|
||||||
<!-- need to convert YAML to JSON first
|
|
||||||
## Raw Schema
|
|
||||||
|
|
||||||
[JSON Schema for Derivation v3](schema/derivation-v4.json)
|
|
||||||
-->
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{{#include ../derivation-v4-fixed.md}}
|
||||||
|
|
||||||
|
<!-- need to convert YAML to JSON first
|
||||||
|
## Raw Schema
|
||||||
|
|
||||||
|
[JSON Schema for Derivation v4](schema/derivation-v4.json)
|
||||||
|
-->
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
{{#include ../derivation-options-v1-fixed.md}}
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Input-addressed derivations
|
||||||
|
|
||||||
|
#### Default options
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include ../schema/derivation-options-v1/ia/derivation-options/defaults.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### All options set
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include ../schema/derivation-options-v1/ia/derivation-options/all_set.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Default options (structured attributes)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include ../schema/derivation-options-v1/ia/derivation-options/structuredAttrs_defaults.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### All options set (structured attributes)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include ../schema/derivation-options-v1/ia/derivation-options/structuredAttrs_all_set.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Content-addressed derivations
|
||||||
|
|
||||||
|
#### All options set
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include ../schema/derivation-options-v1/ca/derivation-options/all_set.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### All options set (structured attributes)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include ../schema/derivation-options-v1/ca/derivation-options/structuredAttrs_all_set.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- need to convert YAML to JSON first
|
||||||
|
## Raw Schema
|
||||||
|
|
||||||
|
[JSON Schema for Derivation Options v1](schema/derivation-options-v1.json)
|
||||||
|
-->
|
||||||
@@ -12,7 +12,7 @@ s/\\`/`/g
|
|||||||
# As we have more such relative links, more replacements of this nature
|
# As we have more such relative links, more replacements of this nature
|
||||||
# should appear below.
|
# should appear below.
|
||||||
s^#/\$defs/\(regular\|symlink\|directory\)^In this schema^g
|
s^#/\$defs/\(regular\|symlink\|directory\)^In this schema^g
|
||||||
s^\(./hash-v1.yaml\)\?#/$defs/algorithm^[JSON format for `Hash`](./hash.html#algorithm)^g
|
s^\(./hash-v1.yaml\)\?#/$defs/algorithm^[JSON format for `Hash`](@docroot@/protocols/json/hash.html#algorithm)^g
|
||||||
s^\(./hash-v1.yaml\)^[JSON format for `Hash`](./hash.html)^g
|
s^\(./hash-v1.yaml\)^[JSON format for `Hash`](@docroot@/protocols/json/hash.html)^g
|
||||||
s^\(./content-address-v1.yaml\)\?#/$defs/method^[JSON format for `ContentAddress`](./content-address.html#method)^g
|
s^\(./content-address-v1.yaml\)\?#/$defs/method^[JSON format for `ContentAddress`](@docroot@/protocols/json/content-address.html#method)^g
|
||||||
s^\(./content-address-v1.yaml\)^[JSON format for `ContentAddress`](./content-address.html)^g
|
s^\(./content-address-v1.yaml\)^[JSON format for `ContentAddress`](@docroot@/protocols/json/content-address.html)^g
|
||||||
@@ -2,28 +2,16 @@
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### SHA-256 with Base64 encoding
|
### SHA-256
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{{#include schema/hash-v1/sha256-base64.json}}
|
{{#include schema/hash-v1/sha256.json}}
|
||||||
```
|
```
|
||||||
|
|
||||||
### SHA-256 with Base16 (hexadecimal) encoding
|
### BLAKE3
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{{#include schema/hash-v1/sha256-base16.json}}
|
{{#include schema/hash-v1/blake3.json}}
|
||||||
```
|
|
||||||
|
|
||||||
### SHA-256 with Nix32 encoding
|
|
||||||
|
|
||||||
```json
|
|
||||||
{{#include schema/hash-v1/sha256-nix32.json}}
|
|
||||||
```
|
|
||||||
|
|
||||||
### BLAKE3 with Base64 encoding
|
|
||||||
|
|
||||||
```json
|
|
||||||
{{#include schema/hash-v1/blake3-base64.json}}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- need to convert YAML to JSON first
|
<!-- need to convert YAML to JSON first
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ schemas = [
|
|||||||
'store-path-v1',
|
'store-path-v1',
|
||||||
'store-object-info-v2',
|
'store-object-info-v2',
|
||||||
'derivation-v4',
|
'derivation-v4',
|
||||||
|
'derivation-options-v1',
|
||||||
'deriving-path-v1',
|
'deriving-path-v1',
|
||||||
'build-trace-entry-v1',
|
'build-trace-entry-v1',
|
||||||
'build-result-v1',
|
'build-result-v1',
|
||||||
|
'store-v1',
|
||||||
]
|
]
|
||||||
|
|
||||||
schema_files = files()
|
schema_files = files()
|
||||||
@@ -33,27 +35,27 @@ endforeach
|
|||||||
|
|
||||||
json_schema_generated_files = []
|
json_schema_generated_files = []
|
||||||
|
|
||||||
# Generate markdown documentation from JSON schema
|
|
||||||
# Note: output must be just a filename, not a path
|
|
||||||
gen_file = custom_target(
|
|
||||||
schema_name + '-schema-docs.tmp',
|
|
||||||
command : [
|
|
||||||
json_schema_for_humans,
|
|
||||||
'--config-file',
|
|
||||||
json_schema_config,
|
|
||||||
meson.current_source_dir() / 'schema',
|
|
||||||
meson.current_build_dir(),
|
|
||||||
],
|
|
||||||
input : schema_files + [
|
|
||||||
json_schema_config,
|
|
||||||
],
|
|
||||||
output : schema_outputs,
|
|
||||||
capture : false,
|
|
||||||
build_by_default : true,
|
|
||||||
)
|
|
||||||
|
|
||||||
idx = 0
|
|
||||||
if json_schema_for_humans.found()
|
if json_schema_for_humans.found()
|
||||||
|
# Generate markdown documentation from JSON schema
|
||||||
|
# Note: output must be just a filename, not a path
|
||||||
|
gen_file = custom_target(
|
||||||
|
schema_name + '-schema-docs.tmp',
|
||||||
|
command : [
|
||||||
|
json_schema_for_humans,
|
||||||
|
'--config-file',
|
||||||
|
json_schema_config,
|
||||||
|
meson.current_source_dir() / 'schema',
|
||||||
|
meson.current_build_dir(),
|
||||||
|
],
|
||||||
|
input : schema_files + [
|
||||||
|
json_schema_config,
|
||||||
|
],
|
||||||
|
output : schema_outputs,
|
||||||
|
capture : false,
|
||||||
|
build_by_default : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
idx = 0
|
||||||
foreach schema_name : schemas
|
foreach schema_name : schemas
|
||||||
#schema_file = 'schema' / schema_name + '.yaml'
|
#schema_file = 'schema' / schema_name + '.yaml'
|
||||||
|
|
||||||
|
|||||||
@@ -4,71 +4,97 @@ title: Build Trace Entry
|
|||||||
description: |
|
description: |
|
||||||
A record of a successful build outcome for a specific derivation output.
|
A record of a successful build outcome for a specific derivation output.
|
||||||
|
|
||||||
This schema describes the JSON representation of a [build trace entry](@docroot@/store/build-trace.md) entry.
|
This schema describes the JSON representation of a [build trace entry](@docroot@/store/build-trace.md).
|
||||||
|
|
||||||
> **Warning**
|
> **Warning**
|
||||||
>
|
>
|
||||||
> This JSON format is currently
|
> This JSON format is currently
|
||||||
> [**experimental**](@docroot@/development/experimental-features.md#xp-feature-ca-derivations)
|
> [**experimental**](@docroot@/development/experimental-features.md#xp-feature-ca-derivations)
|
||||||
> and subject to change.
|
> and subject to change.
|
||||||
|
|
||||||
type: object
|
|
||||||
required:
|
required:
|
||||||
- id
|
- id
|
||||||
- outPath
|
- outPath
|
||||||
- dependentRealisations
|
- dependentRealisations
|
||||||
- signatures
|
- signatures
|
||||||
|
allOf:
|
||||||
|
- "$ref": "#/$defs/key"
|
||||||
|
- "$ref": "#/$defs/value"
|
||||||
properties:
|
properties:
|
||||||
id:
|
id: {}
|
||||||
type: string
|
outPath: {}
|
||||||
title: Derivation Output ID
|
dependentRealisations: {}
|
||||||
pattern: "^sha256:[0-9a-f]{64}![a-zA-Z_][a-zA-Z0-9_-]*$"
|
signatures: {}
|
||||||
description: |
|
|
||||||
Unique identifier for the derivation output that was built.
|
|
||||||
|
|
||||||
Format: `{hash-quotient-drv}!{output-name}`
|
|
||||||
|
|
||||||
- **hash-quotient-drv**: SHA-256 [hash of the quotient derivation](@docroot@/store/derivation/outputs/input-address.md#hash-quotient-drv).
|
|
||||||
Begins with `sha256:`.
|
|
||||||
|
|
||||||
- **output-name**: Name of the specific output (e.g., "out", "dev", "doc")
|
|
||||||
|
|
||||||
Example: `"sha256:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad!foo"`
|
|
||||||
|
|
||||||
outPath:
|
|
||||||
"$ref": "store-path-v1.yaml"
|
|
||||||
title: Output Store Path
|
|
||||||
description: |
|
|
||||||
The path to the store object that resulted from building this derivation for the given output name.
|
|
||||||
|
|
||||||
dependentRealisations:
|
|
||||||
type: object
|
|
||||||
title: Underlying Base Build Trace
|
|
||||||
description: |
|
|
||||||
This is for [*derived*](@docroot@/store/build-trace.md#derived) build trace entries to ensure coherence.
|
|
||||||
|
|
||||||
Keys are derivation output IDs (same format as the main `id` field).
|
|
||||||
Values are the store paths that those dependencies resolved to.
|
|
||||||
|
|
||||||
As described in the linked section on derived build trace traces, derived build trace entries must be kept in addition and not instead of the underlying base build entries.
|
|
||||||
This is the set of base build trace entries that this derived build trace is derived from.
|
|
||||||
(The set is also a map since this miniature base build trace must be coherent, mapping each key to a single value.)
|
|
||||||
|
|
||||||
patternProperties:
|
|
||||||
"^sha256:[0-9a-f]{64}![a-zA-Z_][a-zA-Z0-9_-]*$":
|
|
||||||
$ref: "store-path-v1.yaml"
|
|
||||||
title: Dependent Store Path
|
|
||||||
description: Store path that this dependency resolved to during the build
|
|
||||||
additionalProperties: false
|
|
||||||
|
|
||||||
signatures:
|
|
||||||
type: array
|
|
||||||
title: Build Signatures
|
|
||||||
description: |
|
|
||||||
A set of cryptographic signatures attesting to the authenticity of this build trace entry.
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
title: Signature
|
|
||||||
description: A single cryptographic signature
|
|
||||||
|
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
|
|
||||||
|
"$defs":
|
||||||
|
key:
|
||||||
|
title: Build Trace Key
|
||||||
|
description: |
|
||||||
|
A [build trace entry](@docroot@/store/build-trace.md) is a key-value pair.
|
||||||
|
This is the "key" part, refering to a derivation and output.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
title: Derivation Output ID
|
||||||
|
pattern: "^sha256:[0-9a-f]{64}![a-zA-Z_][a-zA-Z0-9_-]*$"
|
||||||
|
description: |
|
||||||
|
Unique identifier for the derivation output that was built.
|
||||||
|
|
||||||
|
Format: `{hash-quotient-drv}!{output-name}`
|
||||||
|
|
||||||
|
- **hash-quotient-drv**: SHA-256 [hash of the quotient derivation](@docroot@/store/derivation/outputs/input-address.md#hash-quotient-drv).
|
||||||
|
Begins with `sha256:`.
|
||||||
|
|
||||||
|
- **output-name**: Name of the specific output (e.g., "out", "dev", "doc")
|
||||||
|
|
||||||
|
Example: `"sha256:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad!foo"`
|
||||||
|
|
||||||
|
value:
|
||||||
|
title: Build Trace Value
|
||||||
|
description: |
|
||||||
|
A [build trace entry](@docroot@/store/build-trace.md) is a key-value pair.
|
||||||
|
This is the "value" part, describing an output.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- outPath
|
||||||
|
- dependentRealisations
|
||||||
|
- signatures
|
||||||
|
properties:
|
||||||
|
outPath:
|
||||||
|
"$ref": "store-path-v1.yaml"
|
||||||
|
title: Output Store Path
|
||||||
|
description: |
|
||||||
|
The path to the store object that resulted from building this derivation for the given output name.
|
||||||
|
|
||||||
|
dependentRealisations:
|
||||||
|
type: object
|
||||||
|
title: Underlying Base Build Trace
|
||||||
|
description: |
|
||||||
|
This is for [*derived*](@docroot@/store/build-trace.md#derived) build trace entries to ensure coherence.
|
||||||
|
|
||||||
|
Keys are derivation output IDs (same format as the main `id` field).
|
||||||
|
Values are the store paths that those dependencies resolved to.
|
||||||
|
|
||||||
|
As described in the linked section on derived build trace traces, derived build trace entries must be kept in addition and not instead of the underlying base build entries.
|
||||||
|
This is the set of base build trace entries that this derived build trace is derived from.
|
||||||
|
(The set is also a map since this miniature base build trace must be coherent, mapping each key to a single value.)
|
||||||
|
|
||||||
|
patternProperties:
|
||||||
|
"^sha256:[0-9a-f]{64}![a-zA-Z_][a-zA-Z0-9_-]*$":
|
||||||
|
"$ref": "store-path-v1.yaml"
|
||||||
|
title: Dependent Store Path
|
||||||
|
description: Store path that this dependency resolved to during the build
|
||||||
|
additionalProperties: false
|
||||||
|
|
||||||
|
signatures:
|
||||||
|
type: array
|
||||||
|
title: Build Signatures
|
||||||
|
description: |
|
||||||
|
A set of cryptographic signatures attesting to the authenticity of this build trace entry.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
title: Signature
|
||||||
|
description: A single cryptographic signature
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../src/libstore-tests/data/derivation
|
||||||
@@ -0,0 +1,242 @@
|
|||||||
|
"$schema": "http://json-schema.org/draft-04/schema"
|
||||||
|
"$id": "https://nix.dev/manual/nix/latest/protocols/json/schema/derivation-options-v1.json"
|
||||||
|
title: Derivation Options
|
||||||
|
description: |
|
||||||
|
JSON representation of Nix's `DerivationOptions` type.
|
||||||
|
|
||||||
|
This schema describes various build-time options and constraints that can be specified for a derivation.
|
||||||
|
|
||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> This JSON format is currently
|
||||||
|
> [**experimental**](@docroot@/development/experimental-features.md#xp-feature-nix-command)
|
||||||
|
> and subject to change.
|
||||||
|
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- outputChecks
|
||||||
|
- unsafeDiscardReferences
|
||||||
|
- passAsFile
|
||||||
|
- exportReferencesGraph
|
||||||
|
- additionalSandboxProfile
|
||||||
|
- noChroot
|
||||||
|
- impureHostDeps
|
||||||
|
- impureEnvVars
|
||||||
|
- allowLocalNetworking
|
||||||
|
- requiredSystemFeatures
|
||||||
|
- preferLocalBuild
|
||||||
|
- allowSubstitutes
|
||||||
|
properties:
|
||||||
|
outputChecks:
|
||||||
|
type: object
|
||||||
|
title: Output Check
|
||||||
|
description: |
|
||||||
|
Constraints on what the derivation's outputs can and cannot reference.
|
||||||
|
Can either apply to all outputs or be specified per output.
|
||||||
|
oneOf:
|
||||||
|
- title: Output Checks For All Outputs
|
||||||
|
description: |
|
||||||
|
Output checks that apply to all outputs of the derivation.
|
||||||
|
required:
|
||||||
|
- forAllOutputs
|
||||||
|
properties:
|
||||||
|
forAllOutputs:
|
||||||
|
"$ref": "#/$defs/outputCheckSpec"
|
||||||
|
additionalProperties: false
|
||||||
|
|
||||||
|
- title: Output Checks Per Output
|
||||||
|
description: |
|
||||||
|
Output checks specified individually for each output.
|
||||||
|
required:
|
||||||
|
- perOutput
|
||||||
|
properties:
|
||||||
|
perOutput:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
"$ref": "#/$defs/outputCheckSpec"
|
||||||
|
additionalProperties: false
|
||||||
|
|
||||||
|
unsafeDiscardReferences:
|
||||||
|
type: object
|
||||||
|
title: Unsafe Discard References
|
||||||
|
description: |
|
||||||
|
A map specifying which references should be unsafely discarded from each output.
|
||||||
|
This is generally not recommended and requires special permissions.
|
||||||
|
additionalProperties:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
passAsFile:
|
||||||
|
type: array
|
||||||
|
title: Pass As File
|
||||||
|
description: |
|
||||||
|
List of environment variable names whose values should be passed as files rather than directly.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
exportReferencesGraph:
|
||||||
|
type: object
|
||||||
|
title: Export References Graph
|
||||||
|
description: |
|
||||||
|
Specify paths whose references graph should be exported to files.
|
||||||
|
additionalProperties:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
"$ref": "deriving-path-v1.yaml"
|
||||||
|
|
||||||
|
additionalSandboxProfile:
|
||||||
|
type: string
|
||||||
|
title: Additional Sandbox Profile
|
||||||
|
description: |
|
||||||
|
Additional sandbox profile directives (macOS specific).
|
||||||
|
|
||||||
|
noChroot:
|
||||||
|
type: boolean
|
||||||
|
title: No Chroot
|
||||||
|
description: |
|
||||||
|
Whether to disable the build sandbox, if allowed.
|
||||||
|
|
||||||
|
impureHostDeps:
|
||||||
|
type: array
|
||||||
|
title: Impure Host Dependencies
|
||||||
|
description: |
|
||||||
|
List of host paths that the build can access.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
impureEnvVars:
|
||||||
|
type: array
|
||||||
|
title: Impure Environment Variables
|
||||||
|
description: |
|
||||||
|
List of environment variable names that should be passed through to the build from the calling environment.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
allowLocalNetworking:
|
||||||
|
type: boolean
|
||||||
|
title: Allow Local Networking
|
||||||
|
description: |
|
||||||
|
Whether the build should have access to local network (macOS specific).
|
||||||
|
|
||||||
|
requiredSystemFeatures:
|
||||||
|
type: array
|
||||||
|
title: Required System Features
|
||||||
|
description: |
|
||||||
|
List of system features required to build this derivation (e.g., "kvm", "nixos-test").
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
preferLocalBuild:
|
||||||
|
type: boolean
|
||||||
|
title: Prefer Local Build
|
||||||
|
description: |
|
||||||
|
Whether this derivation should preferably be built locally rather than its outputs substituted.
|
||||||
|
|
||||||
|
allowSubstitutes:
|
||||||
|
type: boolean
|
||||||
|
title: Allow Substitutes
|
||||||
|
description: |
|
||||||
|
Whether substituting from other stores should be allowed for this derivation's outputs.
|
||||||
|
|
||||||
|
additionalProperties: false
|
||||||
|
|
||||||
|
$defs:
|
||||||
|
|
||||||
|
outputCheckSpec:
|
||||||
|
type: object
|
||||||
|
title: Output Check Specification
|
||||||
|
description: |
|
||||||
|
Constraints on what a specific output can reference.
|
||||||
|
required:
|
||||||
|
- ignoreSelfRefs
|
||||||
|
- maxSize
|
||||||
|
- maxClosureSize
|
||||||
|
- allowedReferences
|
||||||
|
- allowedRequisites
|
||||||
|
- disallowedReferences
|
||||||
|
- disallowedRequisites
|
||||||
|
properties:
|
||||||
|
ignoreSelfRefs:
|
||||||
|
type: boolean
|
||||||
|
title: Ignore Self References
|
||||||
|
description: |
|
||||||
|
Whether references from this output to itself should be ignored when checking references.
|
||||||
|
|
||||||
|
maxSize:
|
||||||
|
type: ["integer", "null"]
|
||||||
|
title: Maximum Size
|
||||||
|
description: |
|
||||||
|
Maximum allowed size of this output in bytes, or null for no limit.
|
||||||
|
minimum: 0
|
||||||
|
|
||||||
|
maxClosureSize:
|
||||||
|
type: ["integer", "null"]
|
||||||
|
title: Maximum Closure Size
|
||||||
|
description: |
|
||||||
|
Maximum allowed size of this output's closure in bytes, or null for no limit.
|
||||||
|
minimum: 0
|
||||||
|
|
||||||
|
allowedReferences:
|
||||||
|
oneOf:
|
||||||
|
- type: array
|
||||||
|
items:
|
||||||
|
"$ref": "#/$defs/drvRef"
|
||||||
|
- type: "null"
|
||||||
|
title: Allowed References
|
||||||
|
description: |
|
||||||
|
If set, the output can only reference paths in this list.
|
||||||
|
If null, no restrictions apply.
|
||||||
|
|
||||||
|
allowedRequisites:
|
||||||
|
oneOf:
|
||||||
|
- type: array
|
||||||
|
items:
|
||||||
|
"$ref": "#/$defs/drvRef"
|
||||||
|
- type: "null"
|
||||||
|
title: Allowed Requisites
|
||||||
|
description: |
|
||||||
|
If set, the output's closure can only contain paths in this list.
|
||||||
|
If null, no restrictions apply.
|
||||||
|
|
||||||
|
disallowedReferences:
|
||||||
|
type: array
|
||||||
|
title: Disallowed References
|
||||||
|
description: |
|
||||||
|
The output must not reference any paths in this list.
|
||||||
|
items:
|
||||||
|
"$ref": "#/$defs/drvRef"
|
||||||
|
|
||||||
|
disallowedRequisites:
|
||||||
|
type: array
|
||||||
|
title: Disallowed Requisites
|
||||||
|
description: |
|
||||||
|
The output's closure must not contain any paths in this list.
|
||||||
|
items:
|
||||||
|
"$ref": "#/$defs/drvRef"
|
||||||
|
additionalProperties: false
|
||||||
|
|
||||||
|
drvRef:
|
||||||
|
# TODO fix bug in checker, should be `oneOf`
|
||||||
|
anyOf:
|
||||||
|
- type: object
|
||||||
|
title: Current derivation Output Reference
|
||||||
|
description: |
|
||||||
|
A reference to a specific output of the current derivation.
|
||||||
|
required:
|
||||||
|
- drvPath
|
||||||
|
- output
|
||||||
|
properties:
|
||||||
|
drvPath:
|
||||||
|
type: string
|
||||||
|
const: "self"
|
||||||
|
title: This derivation
|
||||||
|
description: |
|
||||||
|
Won't be confused for a deriving path
|
||||||
|
output:
|
||||||
|
type: string
|
||||||
|
title: Output Name
|
||||||
|
description: |
|
||||||
|
The name of the output being referenced.
|
||||||
|
additionalProperties: false
|
||||||
|
- "$ref": "deriving-path-v1.yaml"
|
||||||
@@ -4,40 +4,13 @@ title: Hash
|
|||||||
description: |
|
description: |
|
||||||
A cryptographic hash value used throughout Nix for content addressing and integrity verification.
|
A cryptographic hash value used throughout Nix for content addressing and integrity verification.
|
||||||
|
|
||||||
This schema describes the JSON representation of Nix's `Hash` type.
|
This schema describes the JSON representation of Nix's `Hash` type as an [SRI](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) string.
|
||||||
type: object
|
type: string
|
||||||
properties:
|
pattern: "^(blake3|md5|sha1|sha256|sha512)-[A-Za-z0-9+/]+=*$"
|
||||||
algorithm:
|
examples:
|
||||||
"$ref": "#/$defs/algorithm"
|
- "sha256-ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="
|
||||||
format:
|
- "sha512-IEqPxt2oLwoM7XvrjgikFlfBbvRosiioJ5vjMacDwzWW/RXBOxsH+aodO+pXeJygMa2Fx6cd1wNU7GMSOMo0RQ=="
|
||||||
type: string
|
|
||||||
enum:
|
|
||||||
- base64
|
|
||||||
- nix32
|
|
||||||
- base16
|
|
||||||
- sri
|
|
||||||
title: Hash format
|
|
||||||
description: |
|
|
||||||
The encoding format of the hash value.
|
|
||||||
|
|
||||||
- `base64` uses standard Base64 encoding [RFC 4648, section 4](https://datatracker.ietf.org/doc/html/rfc4648#section-4)
|
|
||||||
- `nix32` is Nix-specific base-32 encoding
|
|
||||||
- `base16` is lowercase hexadecimal
|
|
||||||
- `sri` is the [Subresource Integrity format](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
|
|
||||||
hash:
|
|
||||||
type: string
|
|
||||||
title: Hash
|
|
||||||
description: |
|
|
||||||
The encoded hash value, itself.
|
|
||||||
|
|
||||||
It is specified in the format specified by the `format` field.
|
|
||||||
It must be the right length for the hash algorithm specified in the `algorithm` field, also.
|
|
||||||
The hash value does not include any algorithm prefix.
|
|
||||||
required:
|
|
||||||
- algorithm
|
|
||||||
- format
|
|
||||||
- hash
|
|
||||||
additionalProperties: false
|
|
||||||
"$defs":
|
"$defs":
|
||||||
algorithm:
|
algorithm:
|
||||||
type: string
|
type: string
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../../../../../../src/libstore-tests/data/nar-info
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../src/libstore-tests/data/nar-info/json-2
|
||||||
@@ -1 +1 @@
|
|||||||
../../../../../../src/libstore-tests/data/path-info
|
../../../../../../src/libstore-tests/data/path-info/json-2
|
||||||
@@ -46,6 +46,7 @@ $defs:
|
|||||||
- narSize
|
- narSize
|
||||||
- references
|
- references
|
||||||
- ca
|
- ca
|
||||||
|
- storeDir
|
||||||
properties:
|
properties:
|
||||||
version:
|
version:
|
||||||
type: integer
|
type: integer
|
||||||
@@ -63,7 +64,7 @@ $defs:
|
|||||||
- Version 2: Use structured JSON type for `ca`
|
- Version 2: Use structured JSON type for `ca`
|
||||||
|
|
||||||
path:
|
path:
|
||||||
type: string
|
"$ref": "./store-path-v1.yaml"
|
||||||
title: Store Path
|
title: Store Path
|
||||||
description: |
|
description: |
|
||||||
[Store path](@docroot@/store/store-path.md) to the given store object.
|
[Store path](@docroot@/store/store-path.md) to the given store object.
|
||||||
@@ -89,7 +90,7 @@ $defs:
|
|||||||
description: |
|
description: |
|
||||||
An array of [store paths](@docroot@/store/store-path.md), possibly including this one.
|
An array of [store paths](@docroot@/store/store-path.md), possibly including this one.
|
||||||
items:
|
items:
|
||||||
type: string
|
"$ref": "./store-path-v1.yaml"
|
||||||
|
|
||||||
ca:
|
ca:
|
||||||
oneOf:
|
oneOf:
|
||||||
@@ -101,6 +102,12 @@ $defs:
|
|||||||
If the store object is [content-addressed](@docroot@/store/store-object/content-address.md),
|
If the store object is [content-addressed](@docroot@/store/store-object/content-address.md),
|
||||||
this is the content address of this store object's file system object, used to compute its store path.
|
this is the content address of this store object's file system object, used to compute its store path.
|
||||||
Otherwise (i.e. if it is [input-addressed](@docroot@/glossary.md#gloss-input-addressed-store-object)), this is `null`.
|
Otherwise (i.e. if it is [input-addressed](@docroot@/glossary.md#gloss-input-addressed-store-object)), this is `null`.
|
||||||
|
|
||||||
|
storeDir:
|
||||||
|
type: string
|
||||||
|
title: Store Directory
|
||||||
|
description: |
|
||||||
|
The [store directory](@docroot@/store/store-path.md#store-directory) this store object belongs to (e.g. `/nix/store`).
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
|
|
||||||
impure:
|
impure:
|
||||||
@@ -115,6 +122,7 @@ $defs:
|
|||||||
- narSize
|
- narSize
|
||||||
- references
|
- references
|
||||||
- ca
|
- ca
|
||||||
|
- storeDir
|
||||||
# impure
|
# impure
|
||||||
- deriver
|
- deriver
|
||||||
- registrationTime
|
- registrationTime
|
||||||
@@ -127,8 +135,11 @@ $defs:
|
|||||||
narSize: { $ref: "#/$defs/base/properties/narSize" }
|
narSize: { $ref: "#/$defs/base/properties/narSize" }
|
||||||
references: { $ref: "#/$defs/base/properties/references" }
|
references: { $ref: "#/$defs/base/properties/references" }
|
||||||
ca: { $ref: "#/$defs/base/properties/ca" }
|
ca: { $ref: "#/$defs/base/properties/ca" }
|
||||||
|
storeDir: { $ref: "#/$defs/base/properties/storeDir" }
|
||||||
deriver:
|
deriver:
|
||||||
type: ["string", "null"]
|
oneOf:
|
||||||
|
- "$ref": "./store-path-v1.yaml"
|
||||||
|
- type: "null"
|
||||||
title: Deriver
|
title: Deriver
|
||||||
description: |
|
description: |
|
||||||
If known, the path to the [store derivation](@docroot@/glossary.md#gloss-store-derivation) from which this store object was produced.
|
If known, the path to the [store derivation](@docroot@/glossary.md#gloss-store-derivation) from which this store object was produced.
|
||||||
@@ -190,6 +201,7 @@ $defs:
|
|||||||
- narSize
|
- narSize
|
||||||
- references
|
- references
|
||||||
- ca
|
- ca
|
||||||
|
- storeDir
|
||||||
# impure
|
# impure
|
||||||
- deriver
|
- deriver
|
||||||
- registrationTime
|
- registrationTime
|
||||||
@@ -207,6 +219,7 @@ $defs:
|
|||||||
narSize: { $ref: "#/$defs/base/properties/narSize" }
|
narSize: { $ref: "#/$defs/base/properties/narSize" }
|
||||||
references: { $ref: "#/$defs/base/properties/references" }
|
references: { $ref: "#/$defs/base/properties/references" }
|
||||||
ca: { $ref: "#/$defs/base/properties/ca" }
|
ca: { $ref: "#/$defs/base/properties/ca" }
|
||||||
|
storeDir: { $ref: "#/$defs/base/properties/storeDir" }
|
||||||
deriver: { $ref: "#/$defs/impure/properties/deriver" }
|
deriver: { $ref: "#/$defs/impure/properties/deriver" }
|
||||||
registrationTime: { $ref: "#/$defs/impure/properties/registrationTime" }
|
registrationTime: { $ref: "#/$defs/impure/properties/registrationTime" }
|
||||||
ultimate: { $ref: "#/$defs/impure/properties/ultimate" }
|
ultimate: { $ref: "#/$defs/impure/properties/ultimate" }
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../src/libstore-tests/data/dummy-store
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
"$schema": "http://json-schema.org/draft-04/schema"
|
||||||
|
"$id": "https://nix.dev/manual/nix/latest/protocols/json/schema/store-v1.json"
|
||||||
|
title: Store
|
||||||
|
description: |
|
||||||
|
Experimental JSON representation of a Nix [Store](@docroot@/store/index.md).
|
||||||
|
|
||||||
|
This schema describes the JSON serialization of a Nix store.
|
||||||
|
We use it for (de)serializing in-memory "dummy stores" used for testing, but in principle the data represented in this schema could live in any type of store.
|
||||||
|
|
||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> This JSON format is currently
|
||||||
|
> [**experimental**](@docroot@/development/experimental-features.md#xp-feature-nix-command)
|
||||||
|
> and subject to change.
|
||||||
|
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- config
|
||||||
|
- contents
|
||||||
|
- derivations
|
||||||
|
- buildTrace
|
||||||
|
properties:
|
||||||
|
config:
|
||||||
|
"$ref": "#/$defs/storeConfig"
|
||||||
|
|
||||||
|
contents:
|
||||||
|
type: object
|
||||||
|
title: Store Objects
|
||||||
|
description: |
|
||||||
|
Map of [store path](@docroot@/store/store-path.md) base names to [store objects](@docroot@/store/store-object.md).
|
||||||
|
patternProperties:
|
||||||
|
"^[0123456789abcdfghijklmnpqrsvwxyz]{32}-.+$":
|
||||||
|
type: object
|
||||||
|
title: Store Object
|
||||||
|
required:
|
||||||
|
- info
|
||||||
|
- contents
|
||||||
|
properties:
|
||||||
|
info:
|
||||||
|
"$ref": "./store-object-info-v2.yaml#/$defs/impure"
|
||||||
|
title: Store Object Info
|
||||||
|
description: |
|
||||||
|
Metadata about the [store object](@docroot@/store/store-object.md) including hash, size, references, etc.
|
||||||
|
contents:
|
||||||
|
"$ref": "./file-system-object-v1.yaml"
|
||||||
|
title: File System Object Contents
|
||||||
|
description: |
|
||||||
|
The actual [file system object](@docroot@/store/file-system-object.md) contents of this store path.
|
||||||
|
additionalProperties: false
|
||||||
|
additionalProperties: false
|
||||||
|
|
||||||
|
derivations:
|
||||||
|
type: object
|
||||||
|
title: Derivations
|
||||||
|
description: |
|
||||||
|
Map of [store path](@docroot@/store/store-path.md) base names (always ending in `.drv`) to [derivations](@docroot@/store/derivation/index.md).
|
||||||
|
patternProperties:
|
||||||
|
"^[0123456789abcdfghijklmnpqrsvwxyz]{32}-.+\\.drv$":
|
||||||
|
"$ref": "./derivation-v4.yaml"
|
||||||
|
additionalProperties: false
|
||||||
|
|
||||||
|
buildTrace:
|
||||||
|
type: object
|
||||||
|
title: Build Trace
|
||||||
|
description: |
|
||||||
|
Map of output hashes (base64 SHA256) to maps of output names to realisations.
|
||||||
|
Records which outputs have been built and their realisations.
|
||||||
|
See [Build Trace](@docroot@/store/build-trace.md) for more details.
|
||||||
|
patternProperties:
|
||||||
|
"^[A-Za-z0-9+/]{43}=$":
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
"$ref": "./build-trace-entry-v1.yaml#/$defs/value"
|
||||||
|
additionalProperties: false
|
||||||
|
|
||||||
|
"$defs":
|
||||||
|
storeConfig:
|
||||||
|
title: Store Configuration
|
||||||
|
description: |
|
||||||
|
Configuration for the store, including the store directory path.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- store
|
||||||
|
properties:
|
||||||
|
store:
|
||||||
|
type: string
|
||||||
|
title: Store Directory
|
||||||
|
description: |
|
||||||
|
The store directory path (e.g., `/nix/store`).
|
||||||
|
additionalProperties: false
|
||||||
@@ -29,13 +29,13 @@
|
|||||||
### NAR info (minimal)
|
### NAR info (minimal)
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{{#include schema/nar-info-v1/pure.json}}
|
{{#include schema/nar-info-v2/pure.json}}
|
||||||
```
|
```
|
||||||
|
|
||||||
### NAR info (with binary cache fields)
|
### NAR info (with binary cache fields)
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{{#include schema/nar-info-v1/impure.json}}
|
{{#include schema/nar-info-v2/impure.json}}
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- need to convert YAML to JSON first
|
<!-- need to convert YAML to JSON first
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{{#include store-v1-fixed.md}}
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Empty store
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include schema/store-v1/empty.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Store with one file
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include schema/store-v1/one-flat-file.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Store with one derivation
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include schema/store-v1/one-derivation.json}}
|
||||||
|
```
|
||||||
@@ -112,7 +112,7 @@ This release was made possible by the following 45 contributors:
|
|||||||
- Connor Baker [**(@ConnorBaker)**](https://github.com/ConnorBaker)
|
- Connor Baker [**(@ConnorBaker)**](https://github.com/ConnorBaker)
|
||||||
- Cole Helbling [**(@cole-h)**](https://github.com/cole-h)
|
- Cole Helbling [**(@cole-h)**](https://github.com/cole-h)
|
||||||
- Jack Wilsdon [**(@jackwilsdon)**](https://github.com/jackwilsdon)
|
- Jack Wilsdon [**(@jackwilsdon)**](https://github.com/jackwilsdon)
|
||||||
- rekcäH nitraM [**(@dwt)**](https://github.com/dwt)
|
- Martin Häcker [**(@dwt)**](https://github.com/dwt)
|
||||||
- Martin Fischer [**(@not-my-profile)**](https://github.com/not-my-profile)
|
- Martin Fischer [**(@not-my-profile)**](https://github.com/not-my-profile)
|
||||||
- John Ericson [**(@Ericson2314)**](https://github.com/Ericson2314)
|
- John Ericson [**(@Ericson2314)**](https://github.com/Ericson2314)
|
||||||
- Graham Christensen [**(@grahamc)**](https://github.com/grahamc)
|
- Graham Christensen [**(@grahamc)**](https://github.com/grahamc)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
We ultimately want to rectify this issue with all JSON formats to the extent allowed by our stability promises. To start with, we are changing the JSON format for derivations because the `nix derivation` commands are — in addition to being formally unstable — less widely used than other unstable commands.
|
We ultimately want to rectify this issue with all JSON formats to the extent allowed by our stability promises. To start with, we are changing the JSON format for derivations because the `nix derivation` commands are — in addition to being formally unstable — less widely used than other unstable commands.
|
||||||
|
|
||||||
See the documentation on the [JSON format for derivations](@docroot@/protocols/json/derivation.md) for further details.
|
See the documentation on the [JSON format for derivations](@docroot@/protocols/json/derivation/index.md) for further details.
|
||||||
|
|
||||||
- C API: `nix_get_attr_name_byidx`, `nix_get_attr_byidx` take a `nix_value *` instead of `const nix_value *` [#13987](https://github.com/NixOS/nix/pull/13987)
|
- C API: `nix_get_attr_name_byidx`, `nix_get_attr_byidx` take a `nix_value *` instead of `const nix_value *` [#13987](https://github.com/NixOS/nix/pull/13987)
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,11 @@
|
|||||||
|
|
||||||
The [`builder`](./derivation/index.md#builder) is executed as follows:
|
The [`builder`](./derivation/index.md#builder) is executed as follows:
|
||||||
|
|
||||||
- A temporary directory is created under the directory specified by
|
- A temporary directory is created where the build will take place. The
|
||||||
`TMPDIR` (default `/tmp`) where the build will take place. The
|
|
||||||
current directory is changed to this directory.
|
current directory is changed to this directory.
|
||||||
|
|
||||||
|
See the per-store [`build-dir`](@docroot@/store/types/local-store.md#store-local-store-build-dir) setting for more information.
|
||||||
|
|
||||||
- The environment is cleared and set to the derivation attributes, as
|
- The environment is cleared and set to the derivation attributes, as
|
||||||
specified above.
|
specified above.
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ There are two formats, documented separately:
|
|||||||
|
|
||||||
- The legacy ["ATerm" format](@docroot@/protocols/derivation-aterm.md)
|
- The legacy ["ATerm" format](@docroot@/protocols/derivation-aterm.md)
|
||||||
|
|
||||||
- The experimental, currently under development and changing [JSON format](@docroot@/protocols/json/derivation.md)
|
- The experimental, currently under development and changing [JSON format](@docroot@/protocols/json/derivation/index.md)
|
||||||
|
|
||||||
Every derivation has a canonical choice of encoding used to serialize it to a store object.
|
Every derivation has a canonical choice of encoding used to serialize it to a store object.
|
||||||
This ensures that there is a canonical [store path] used to refer to the derivation, as described in [Referencing derivations](#derivation-path).
|
This ensures that there is a canonical [store path] used to refer to the derivation, as described in [Referencing derivations](#derivation-path).
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ def recursive_replace(data: dict[str, t.Any], book_root: Path, search_path: Path
|
|||||||
return data | dict(
|
return data | dict(
|
||||||
sections = [recursive_replace(section, book_root, search_path) for section in sections],
|
sections = [recursive_replace(section, book_root, search_path) for section in sections],
|
||||||
)
|
)
|
||||||
|
case {'items': items}:
|
||||||
|
return data | dict(
|
||||||
|
items = [recursive_replace(item, book_root, search_path) for item in items],
|
||||||
|
)
|
||||||
case {'Chapter': chapter}:
|
case {'Chapter': chapter}:
|
||||||
path_to_chapter = Path(chapter['path'])
|
path_to_chapter = Path(chapter['path'])
|
||||||
chapter_content = chapter['content']
|
chapter_content = chapter['content']
|
||||||
|
|||||||
Generated
+7
-10
@@ -63,18 +63,15 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1761597516,
|
"lastModified": 1763948260,
|
||||||
"narHash": "sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8+ON/0Yy8+a5vsDU=",
|
"narHash": "sha256-zZk7fn2ARAqmLwaYTpxBJmj81KIdz11NiWt7ydHHD/M=",
|
||||||
"owner": "NixOS",
|
"rev": "1c8ba8d3f7634acac4a2094eef7c32ad9106532c",
|
||||||
"repo": "nixpkgs",
|
"type": "tarball",
|
||||||
"rev": "daf6dc47aa4b44791372d6139ab7b25269184d55",
|
"url": "https://releases.nixos.org/nixos/25.05/nixos-25.05.813095.1c8ba8d3f763/nixexprs.tar.xz"
|
||||||
"type": "github"
|
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"type": "tarball",
|
||||||
"ref": "nixos-25.05",
|
"url": "https://channels.nixos.org/nixos-25.05/nixexprs.tar.xz"
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-23-11": {
|
"nixpkgs-23-11": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
description = "The purely functional package manager";
|
description = "The purely functional package manager";
|
||||||
|
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
inputs.nixpkgs.url = "https://channels.nixos.org/nixos-25.05/nixexprs.tar.xz";
|
||||||
|
|
||||||
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
||||||
inputs.nixpkgs-23-11.url = "github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446";
|
inputs.nixpkgs-23-11.url = "github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446";
|
||||||
@@ -369,6 +369,7 @@
|
|||||||
# TODO probably should be `nix-cli`
|
# TODO probably should be `nix-cli`
|
||||||
nix = self.packages.${system}.nix-everything;
|
nix = self.packages.${system}.nix-everything;
|
||||||
nix-manual = nixpkgsFor.${system}.native.nixComponents2.nix-manual;
|
nix-manual = nixpkgsFor.${system}.native.nixComponents2.nix-manual;
|
||||||
|
nix-manual-manpages-only = nixpkgsFor.${system}.native.nixComponents2.nix-manual-manpages-only;
|
||||||
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents2.nix-internal-api-docs;
|
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents2.nix-internal-api-docs;
|
||||||
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents2.nix-external-api-docs;
|
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents2.nix-external-api-docs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
"wh0": null,
|
"wh0": null,
|
||||||
"mupdt": "Matej Urbas",
|
"mupdt": "Matej Urbas",
|
||||||
"momeemt": "Mutsuha Asada",
|
"momeemt": "Mutsuha Asada",
|
||||||
"dwt": "\u202erekc\u00e4H nitraM\u202e",
|
"dwt": "Martin H\u00e4cker",
|
||||||
"aidenfoxivey": "Aiden Fox Ivey",
|
"aidenfoxivey": "Aiden Fox Ivey",
|
||||||
"ilya-bobyr": "Illia Bobyr",
|
"ilya-bobyr": "Illia Bobyr",
|
||||||
"B4dM4n": "Fabian M\u00f6ller",
|
"B4dM4n": "Fabian M\u00f6ller",
|
||||||
|
|||||||
@@ -79,6 +79,8 @@
|
|||||||
# Not supported by nixfmt
|
# Not supported by nixfmt
|
||||||
''^tests/functional/lang/eval-okay-deprecate-cursed-or\.nix$''
|
''^tests/functional/lang/eval-okay-deprecate-cursed-or\.nix$''
|
||||||
''^tests/functional/lang/eval-okay-attrs5\.nix$''
|
''^tests/functional/lang/eval-okay-attrs5\.nix$''
|
||||||
|
''^tests/functional/lang/eval-fail-dynamic-attrs-inherit\.nix$''
|
||||||
|
''^tests/functional/lang/eval-fail-dynamic-attrs-inherit-2\.nix$''
|
||||||
|
|
||||||
# More syntax tests
|
# More syntax tests
|
||||||
# These tests, or parts of them, should have been parse-* test cases.
|
# These tests, or parts of them, should have been parse-* test cases.
|
||||||
|
|||||||
@@ -429,6 +429,15 @@ in
|
|||||||
The manual as would be published on https://nix.dev/reference/nix-manual
|
The manual as would be published on https://nix.dev/reference/nix-manual
|
||||||
*/
|
*/
|
||||||
nix-manual = callPackage ../doc/manual/package.nix { version = fineVersion; };
|
nix-manual = callPackage ../doc/manual/package.nix { version = fineVersion; };
|
||||||
|
|
||||||
|
/**
|
||||||
|
Manpages only (no HTML manual, no mdbook dependency)
|
||||||
|
*/
|
||||||
|
nix-manual-manpages-only = callPackage ../doc/manual/package.nix {
|
||||||
|
version = fineVersion;
|
||||||
|
buildHtmlManual = false;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Doxygen pages for C++ code
|
Doxygen pages for C++ code
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ scope: {
|
|||||||
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgs.buildPackages.bmake ];
|
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgs.buildPackages.bmake ];
|
||||||
postInstall =
|
postInstall =
|
||||||
lib.replaceStrings [ "lowdown.so.1" "lowdown.1.dylib" ] [ "lowdown.so.2" "lowdown.2.dylib" ]
|
lib.replaceStrings [ "lowdown.so.1" "lowdown.1.dylib" ] [ "lowdown.so.2" "lowdown.2.dylib" ]
|
||||||
prevAttrs.postInstall;
|
(prevAttrs.postInstall or "");
|
||||||
});
|
});
|
||||||
|
|
||||||
# TODO: Remove this when https://github.com/NixOS/nixpkgs/pull/442682 is included in a stable release
|
# TODO: Remove this when https://github.com/NixOS/nixpkgs/pull/442682 is included in a stable release
|
||||||
|
|||||||
+2
-1
@@ -63,15 +63,16 @@ let
|
|||||||
"nix-cli"
|
"nix-cli"
|
||||||
"nix-functional-tests"
|
"nix-functional-tests"
|
||||||
"nix-json-schema-checks"
|
"nix-json-schema-checks"
|
||||||
"nix-kaitai-struct-checks"
|
|
||||||
]
|
]
|
||||||
++ lib.optionals enableBindings [
|
++ lib.optionals enableBindings [
|
||||||
"nix-perl-bindings"
|
"nix-perl-bindings"
|
||||||
]
|
]
|
||||||
++ lib.optionals enableDocs [
|
++ lib.optionals enableDocs [
|
||||||
"nix-manual"
|
"nix-manual"
|
||||||
|
"nix-manual-manpages-only"
|
||||||
"nix-internal-api-docs"
|
"nix-internal-api-docs"
|
||||||
"nix-external-api-docs"
|
"nix-external-api-docs"
|
||||||
|
"nix-kaitai-struct-checks"
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
../libstore-tests/data/derivation
|
||||||
@@ -32,10 +32,8 @@ schemas = [
|
|||||||
'stem' : 'hash',
|
'stem' : 'hash',
|
||||||
'schema' : schema_dir / 'hash-v1.yaml',
|
'schema' : schema_dir / 'hash-v1.yaml',
|
||||||
'files' : [
|
'files' : [
|
||||||
'sha256-base64.json',
|
'sha256.json',
|
||||||
'sha256-base16.json',
|
'blake3.json',
|
||||||
'sha256-nix32.json',
|
|
||||||
'blake3-base64.json',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -71,6 +69,18 @@ schemas = [
|
|||||||
'with-signature.json',
|
'with-signature.json',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'stem' : 'derivation-options',
|
||||||
|
'schema' : schema_dir / 'derivation-options-v1.yaml',
|
||||||
|
'files' : [
|
||||||
|
'ia' / 'derivation-options' / 'defaults.json',
|
||||||
|
'ia' / 'derivation-options' / 'all_set.json',
|
||||||
|
'ia' / 'derivation-options' / 'structuredAttrs_defaults.json',
|
||||||
|
'ia' / 'derivation-options' / 'structuredAttrs_all_set.json',
|
||||||
|
'ca' / 'derivation-options' / 'all_set.json',
|
||||||
|
'ca' / 'derivation-options' / 'structuredAttrs_all_set.json',
|
||||||
|
],
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
# Derivation and Derivation output
|
# Derivation and Derivation output
|
||||||
@@ -144,18 +154,18 @@ schemas += [
|
|||||||
'stem' : 'store-object-info',
|
'stem' : 'store-object-info',
|
||||||
'schema' : schema_dir / 'store-object-info-v2.yaml',
|
'schema' : schema_dir / 'store-object-info-v2.yaml',
|
||||||
'files' : [
|
'files' : [
|
||||||
'pure.json',
|
'json-2' / 'pure.json',
|
||||||
'impure.json',
|
'json-2' / 'impure.json',
|
||||||
'empty_pure.json',
|
'json-2' / 'empty_pure.json',
|
||||||
'empty_impure.json',
|
'json-2' / 'empty_impure.json',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'stem' : 'nar-info',
|
'stem' : 'nar-info',
|
||||||
'schema' : schema_dir / 'store-object-info-v2.yaml',
|
'schema' : schema_dir / 'store-object-info-v2.yaml',
|
||||||
'files' : [
|
'files' : [
|
||||||
'pure.json',
|
'json-2' / 'pure.json',
|
||||||
'impure.json',
|
'json-2' / 'impure.json',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -172,30 +182,43 @@ schemas += [
|
|||||||
'stem' : 'store-object-info',
|
'stem' : 'store-object-info',
|
||||||
'schema' : schema_dir / 'store-object-info-v2.yaml#/$defs/base',
|
'schema' : schema_dir / 'store-object-info-v2.yaml#/$defs/base',
|
||||||
'files' : [
|
'files' : [
|
||||||
'pure.json',
|
'json-2' / 'pure.json',
|
||||||
'empty_pure.json',
|
'json-2' / 'empty_pure.json',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'stem' : 'store-object-info',
|
'stem' : 'store-object-info',
|
||||||
'schema' : schema_dir / 'store-object-info-v2.yaml#/$defs/impure',
|
'schema' : schema_dir / 'store-object-info-v2.yaml#/$defs/impure',
|
||||||
'files' : [
|
'files' : [
|
||||||
'impure.json',
|
'json-2' / 'impure.json',
|
||||||
'empty_impure.json',
|
'json-2' / 'empty_impure.json',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'stem' : 'nar-info',
|
'stem' : 'nar-info',
|
||||||
'schema' : schema_dir / 'store-object-info-v2.yaml#/$defs/base',
|
'schema' : schema_dir / 'store-object-info-v2.yaml#/$defs/base',
|
||||||
'files' : [
|
'files' : [
|
||||||
'pure.json',
|
'json-2' / 'pure.json',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'stem' : 'nar-info',
|
'stem' : 'nar-info',
|
||||||
'schema' : schema_dir / 'store-object-info-v2.yaml#/$defs/narInfo',
|
'schema' : schema_dir / 'store-object-info-v2.yaml#/$defs/narInfo',
|
||||||
'files' : [
|
'files' : [
|
||||||
'impure.json',
|
'json-2' / 'impure.json',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
# Dummy store
|
||||||
|
schemas += [
|
||||||
|
{
|
||||||
|
'stem' : 'store',
|
||||||
|
'schema' : schema_dir / 'store-v1.yaml',
|
||||||
|
'files' : [
|
||||||
|
'empty.json',
|
||||||
|
'one-flat-file.json',
|
||||||
|
'one-derivation.json',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ mkMesonDerivation (finalAttrs: {
|
|||||||
../../src/libstore-tests/data/path-info
|
../../src/libstore-tests/data/path-info
|
||||||
../../src/libstore-tests/data/nar-info
|
../../src/libstore-tests/data/nar-info
|
||||||
../../src/libstore-tests/data/build-result
|
../../src/libstore-tests/data/build-result
|
||||||
|
../../src/libstore-tests/data/dummy-store
|
||||||
./.
|
./.
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
../../src/libstore-tests/data/dummy-store
|
||||||
@@ -297,7 +297,7 @@ void MixProfile::updateProfile(const BuiltPaths & buildables)
|
|||||||
|
|
||||||
MixDefaultProfile::MixDefaultProfile()
|
MixDefaultProfile::MixDefaultProfile()
|
||||||
{
|
{
|
||||||
profile = getDefaultProfile();
|
profile = getDefaultProfile().string();
|
||||||
}
|
}
|
||||||
|
|
||||||
MixEnvironment::MixEnvironment()
|
MixEnvironment::MixEnvironment()
|
||||||
@@ -391,7 +391,7 @@ void createOutLinks(const std::filesystem::path & outLink, const BuiltPaths & bu
|
|||||||
auto symlink = outLink;
|
auto symlink = outLink;
|
||||||
if (i)
|
if (i)
|
||||||
symlink += fmt("-%d", i);
|
symlink += fmt("-%d", i);
|
||||||
store.addPermRoot(bo.path, absPath(symlink.string()));
|
store.addPermRoot(bo.path, absPath(symlink).string());
|
||||||
},
|
},
|
||||||
[&](const BuiltPath::Built & bfd) {
|
[&](const BuiltPath::Built & bfd) {
|
||||||
for (auto & output : bfd.outputs) {
|
for (auto & output : bfd.outputs) {
|
||||||
@@ -400,7 +400,7 @@ void createOutLinks(const std::filesystem::path & outLink, const BuiltPaths & bu
|
|||||||
symlink += fmt("-%d", i);
|
symlink += fmt("-%d", i);
|
||||||
if (output.first != "out")
|
if (output.first != "out")
|
||||||
symlink += fmt("-%s", output.first);
|
symlink += fmt("-%s", output.first);
|
||||||
store.addPermRoot(output.second, absPath(symlink.string()));
|
store.addPermRoot(output.second, absPath(symlink).string());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
|||||||
state.parseExprFromString(
|
state.parseExprFromString(
|
||||||
arg.expr,
|
arg.expr,
|
||||||
compatibilitySettings.nixShellShebangArgumentsRelativeToScript
|
compatibilitySettings.nixShellShebangArgumentsRelativeToScript
|
||||||
? state.rootPath(absPath(getCommandBaseDir()))
|
? state.rootPath(absPath(getCommandBaseDir()).string())
|
||||||
: state.rootPath(".")));
|
: state.rootPath(".")));
|
||||||
},
|
},
|
||||||
[&](const AutoArgString & arg) { v->mkString(arg.s, state.mem); },
|
[&](const AutoArgString & arg) { v->mkString(arg.s, state.mem); },
|
||||||
@@ -177,7 +177,7 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
|||||||
return res.finish();
|
return res.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * baseDir)
|
SourcePath lookupFileArg(EvalState & state, std::string_view s, const std::filesystem::path * baseDir)
|
||||||
{
|
{
|
||||||
if (EvalSettings::isPseudoUrl(s)) {
|
if (EvalSettings::isPseudoUrl(s)) {
|
||||||
auto accessor = fetchers::downloadTarball(*state.store, state.fetchSettings, EvalSettings::resolvePseudoUrl(s));
|
auto accessor = fetchers::downloadTarball(*state.store, state.fetchSettings, EvalSettings::resolvePseudoUrl(s));
|
||||||
@@ -197,12 +197,13 @@ SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * bas
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') {
|
else if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') {
|
||||||
Path p(s.substr(1, s.size() - 2));
|
// Should perhaps be a `CanonPath`?
|
||||||
|
std::string p(s.substr(1, s.size() - 2));
|
||||||
return state.findFile(p);
|
return state.findFile(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
return state.rootPath(baseDir ? absPath(s, *baseDir) : absPath(s));
|
return state.rootPath(absPath(std::filesystem::path{s}, baseDir).string());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
@@ -134,7 +134,7 @@ struct MixFlakeOptions : virtual Args, EvalCommand
|
|||||||
|
|
||||||
struct SourceExprCommand : virtual Args, MixFlakeOptions
|
struct SourceExprCommand : virtual Args, MixFlakeOptions
|
||||||
{
|
{
|
||||||
std::optional<Path> file;
|
std::optional<std::filesystem::path> file;
|
||||||
std::optional<std::string> expr;
|
std::optional<std::string> expr;
|
||||||
|
|
||||||
SourceExprCommand();
|
SourceExprCommand();
|
||||||
@@ -310,7 +310,7 @@ static RegisterCommand registerCommand2(std::vector<std::string> && name)
|
|||||||
|
|
||||||
struct MixProfile : virtual StoreCommand
|
struct MixProfile : virtual StoreCommand
|
||||||
{
|
{
|
||||||
std::optional<Path> profile;
|
std::optional<std::filesystem::path> profile;
|
||||||
|
|
||||||
MixProfile();
|
MixProfile();
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,6 @@ private:
|
|||||||
/**
|
/**
|
||||||
* @param baseDir Optional [base directory](https://nix.dev/manual/nix/development/glossary#gloss-base-directory)
|
* @param baseDir Optional [base directory](https://nix.dev/manual/nix/development/glossary#gloss-base-directory)
|
||||||
*/
|
*/
|
||||||
SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * baseDir = nullptr);
|
SourcePath lookupFileArg(EvalState & state, std::string_view s, const std::filesystem::path * baseDir = nullptr);
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
@@ -17,7 +17,7 @@ class AttrCursor;
|
|||||||
struct App
|
struct App
|
||||||
{
|
{
|
||||||
std::vector<DerivedPath> context;
|
std::vector<DerivedPath> context;
|
||||||
Path program;
|
std::filesystem::path program;
|
||||||
// FIXME: add args, sandbox settings, metadata, ...
|
// FIXME: add args, sandbox settings, metadata, ...
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,16 @@ struct AbstractNixRepl
|
|||||||
|
|
||||||
typedef std::vector<std::pair<Value *, std::string>> AnnotatedValues;
|
typedef std::vector<std::pair<Value *, std::string>> AnnotatedValues;
|
||||||
|
|
||||||
using RunNix = void(Path program, const Strings & args, const std::optional<std::string> & input);
|
/**
|
||||||
|
* Run a nix executable
|
||||||
|
*
|
||||||
|
* @todo this is a layer violation
|
||||||
|
*
|
||||||
|
* @param programName Name of the command, e.g. `nix` or `nix-env`.
|
||||||
|
* @param args aguments to the command.
|
||||||
|
*/
|
||||||
|
using RunNix =
|
||||||
|
void(const std::string & programName, const Strings & args, const std::optional<std::string> & input);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param runNix Function to run the nix CLI to support various
|
* @param runNix Function to run the nix CLI to support various
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ std::vector<ref<eval_cache::AttrCursor>> InstallableFlake::getCursors(EvalState
|
|||||||
for (auto & attrPath : attrPaths) {
|
for (auto & attrPath : attrPaths) {
|
||||||
debug("trying flake output attribute '%s'", attrPath);
|
debug("trying flake output attribute '%s'", attrPath);
|
||||||
|
|
||||||
auto attr = root->findAlongAttrPath(parseAttrPath(state, attrPath));
|
auto attr = root->findAlongAttrPath(AttrPath::parse(state, attrPath));
|
||||||
if (attr) {
|
if (attr) {
|
||||||
res.push_back(ref(*attr));
|
res.push_back(ref(*attr));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+14
-14
@@ -132,7 +132,7 @@ MixFlakeOptions::MixFlakeOptions()
|
|||||||
lockFlags.writeLockFile = false;
|
lockFlags.writeLockFile = false;
|
||||||
lockFlags.inputOverrides.insert_or_assign(
|
lockFlags.inputOverrides.insert_or_assign(
|
||||||
flake::parseInputAttrPath(inputAttrPath),
|
flake::parseInputAttrPath(inputAttrPath),
|
||||||
parseFlakeRef(fetchSettings, flakeRef, absPath(getCommandBaseDir()), true));
|
parseFlakeRef(fetchSettings, flakeRef, absPath(getCommandBaseDir()).string(), true));
|
||||||
}},
|
}},
|
||||||
.completer = {[&](AddCompletions & completions, size_t n, std::string_view prefix) {
|
.completer = {[&](AddCompletions & completions, size_t n, std::string_view prefix) {
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
@@ -173,7 +173,7 @@ MixFlakeOptions::MixFlakeOptions()
|
|||||||
auto flake = flake::lockFlake(
|
auto flake = flake::lockFlake(
|
||||||
flakeSettings,
|
flakeSettings,
|
||||||
*evalState,
|
*evalState,
|
||||||
parseFlakeRef(fetchSettings, flakeRef, absPath(getCommandBaseDir())),
|
parseFlakeRef(fetchSettings, flakeRef, absPath(getCommandBaseDir()).string()),
|
||||||
{.writeLockFile = false});
|
{.writeLockFile = false});
|
||||||
for (auto & [inputName, input] : flake.lockFile.root->inputs) {
|
for (auto & [inputName, input] : flake.lockFile.root->inputs) {
|
||||||
auto input2 = flake.lockFile.findInput({inputName}); // resolve 'follows' nodes
|
auto input2 = flake.lockFile.findInput({inputName}); // resolve 'follows' nodes
|
||||||
@@ -263,7 +263,7 @@ void SourceExprCommand::completeInstallable(AddCompletions & completions, std::s
|
|||||||
|
|
||||||
evalSettings.pureEval = false;
|
evalSettings.pureEval = false;
|
||||||
auto state = getEvalState();
|
auto state = getEvalState();
|
||||||
auto e = state->parseExprFromFile(resolveExprPath(lookupFileArg(*state, *file)));
|
auto e = state->parseExprFromFile(resolveExprPath(lookupFileArg(*state, file->string())));
|
||||||
|
|
||||||
Value root;
|
Value root;
|
||||||
state->eval(e, root);
|
state->eval(e, root);
|
||||||
@@ -355,9 +355,9 @@ void completeFlakeRefWithFragment(
|
|||||||
attrPathPrefixes.push_back("");
|
attrPathPrefixes.push_back("");
|
||||||
|
|
||||||
for (auto & attrPathPrefixS : attrPathPrefixes) {
|
for (auto & attrPathPrefixS : attrPathPrefixes) {
|
||||||
auto attrPathPrefix = parseAttrPath(*evalState, attrPathPrefixS);
|
auto attrPathPrefix = AttrPath::parse(*evalState, attrPathPrefixS);
|
||||||
auto attrPathS = attrPathPrefixS + std::string(fragment);
|
auto attrPathS = attrPathPrefixS + std::string(fragment);
|
||||||
auto attrPath = parseAttrPath(*evalState, attrPathS);
|
auto attrPath = AttrPath::parse(*evalState, attrPathS);
|
||||||
|
|
||||||
std::string lastAttr;
|
std::string lastAttr;
|
||||||
if (!attrPath.empty() && !hasSuffix(attrPathS, ".")) {
|
if (!attrPath.empty() && !hasSuffix(attrPathS, ".")) {
|
||||||
@@ -375,9 +375,7 @@ void completeFlakeRefWithFragment(
|
|||||||
/* Strip the attrpath prefix. */
|
/* Strip the attrpath prefix. */
|
||||||
attrPath2.erase(attrPath2.begin(), attrPath2.begin() + attrPathPrefix.size());
|
attrPath2.erase(attrPath2.begin(), attrPath2.begin() + attrPathPrefix.size());
|
||||||
// FIXME: handle names with dots
|
// FIXME: handle names with dots
|
||||||
completions.add(
|
completions.add(flakeRefS + "#" + prefixRoot + attrPath2.to_string(*evalState));
|
||||||
flakeRefS + "#" + prefixRoot
|
|
||||||
+ concatStringsSep(".", evalState->symbols.resolve(attrPath2)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,7 +384,7 @@ void completeFlakeRefWithFragment(
|
|||||||
attrpaths. */
|
attrpaths. */
|
||||||
if (fragment.empty()) {
|
if (fragment.empty()) {
|
||||||
for (auto & attrPath : defaultFlakeAttrPaths) {
|
for (auto & attrPath : defaultFlakeAttrPaths) {
|
||||||
auto attr = root->findAlongAttrPath(parseAttrPath(*evalState, attrPath));
|
auto attr = root->findAlongAttrPath(AttrPath::parse(*evalState, attrPath));
|
||||||
if (!attr)
|
if (!attr)
|
||||||
continue;
|
continue;
|
||||||
completions.add(flakeRefS + "#" + prefixRoot);
|
completions.add(flakeRefS + "#" + prefixRoot);
|
||||||
@@ -465,10 +463,10 @@ Installables SourceExprCommand::parseInstallables(ref<Store> store, std::vector<
|
|||||||
state->eval(e, *vFile);
|
state->eval(e, *vFile);
|
||||||
} else if (file) {
|
} else if (file) {
|
||||||
auto dir = absPath(getCommandBaseDir());
|
auto dir = absPath(getCommandBaseDir());
|
||||||
state->evalFile(lookupFileArg(*state, *file, &dir), *vFile);
|
state->evalFile(lookupFileArg(*state, file->string(), &dir), *vFile);
|
||||||
} else {
|
} else {
|
||||||
Path dir = absPath(getCommandBaseDir());
|
auto dir = absPath(getCommandBaseDir());
|
||||||
auto e = state->parseExprFromString(*expr, state->rootPath(dir));
|
auto e = state->parseExprFromString(*expr, state->rootPath(dir.string()));
|
||||||
state->eval(e, *vFile);
|
state->eval(e, *vFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,7 +799,8 @@ std::vector<FlakeRef> RawInstallablesCommand::getFlakeRefsForCompletion()
|
|||||||
std::vector<FlakeRef> res;
|
std::vector<FlakeRef> res;
|
||||||
res.reserve(rawInstallables.size());
|
res.reserve(rawInstallables.size());
|
||||||
for (const auto & i : rawInstallables)
|
for (const auto & i : rawInstallables)
|
||||||
res.push_back(parseFlakeRefWithFragment(fetchSettings, expandTilde(i), absPath(getCommandBaseDir())).first);
|
res.push_back(
|
||||||
|
parseFlakeRefWithFragment(fetchSettings, expandTilde(i), absPath(getCommandBaseDir()).string()).first);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,7 +819,8 @@ void RawInstallablesCommand::run(ref<Store> store)
|
|||||||
|
|
||||||
std::vector<FlakeRef> InstallableCommand::getFlakeRefsForCompletion()
|
std::vector<FlakeRef> InstallableCommand::getFlakeRefsForCompletion()
|
||||||
{
|
{
|
||||||
return {parseFlakeRefWithFragment(fetchSettings, expandTilde(_installable), absPath(getCommandBaseDir())).first};
|
return {parseFlakeRefWithFragment(fetchSettings, expandTilde(_installable), absPath(getCommandBaseDir()).string())
|
||||||
|
.first};
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallablesCommand::run(ref<Store> store, std::vector<std::string> && rawInstallables)
|
void InstallablesCommand::run(ref<Store> store, std::vector<std::string> && rawInstallables)
|
||||||
|
|||||||
+11
-10
@@ -58,8 +58,7 @@ struct NixRepl : AbstractNixRepl, detail::ReplCompleterMixin, gc
|
|||||||
{
|
{
|
||||||
size_t debugTraceIndex;
|
size_t debugTraceIndex;
|
||||||
|
|
||||||
// Arguments passed to :load, saved so they can be reloaded with :reload
|
std::list<std::filesystem::path> loadedFiles;
|
||||||
Strings loadedFiles;
|
|
||||||
// Arguments passed to :load-flake, saved so they can be reloaded with :reload
|
// Arguments passed to :load-flake, saved so they can be reloaded with :reload
|
||||||
Strings loadedFlakes;
|
Strings loadedFlakes;
|
||||||
std::function<AnnotatedValues()> getValues;
|
std::function<AnnotatedValues()> getValues;
|
||||||
@@ -73,7 +72,7 @@ struct NixRepl : AbstractNixRepl, detail::ReplCompleterMixin, gc
|
|||||||
|
|
||||||
RunNix * runNixPtr;
|
RunNix * runNixPtr;
|
||||||
|
|
||||||
void runNix(Path program, const Strings & args, const std::optional<std::string> & input = {});
|
void runNix(const std::string & program, const Strings & args, const std::optional<std::string> & input = {});
|
||||||
|
|
||||||
std::unique_ptr<ReplInteracter> interacter;
|
std::unique_ptr<ReplInteracter> interacter;
|
||||||
|
|
||||||
@@ -92,7 +91,7 @@ struct NixRepl : AbstractNixRepl, detail::ReplCompleterMixin, gc
|
|||||||
StorePath getDerivationPath(Value & v);
|
StorePath getDerivationPath(Value & v);
|
||||||
ProcessLineResult processLine(std::string line);
|
ProcessLineResult processLine(std::string line);
|
||||||
|
|
||||||
void loadFile(const Path & path);
|
void loadFile(const std::filesystem::path & path);
|
||||||
void loadFlake(const std::string & flakeRef);
|
void loadFlake(const std::string & flakeRef);
|
||||||
void loadFiles();
|
void loadFiles();
|
||||||
void loadFlakes();
|
void loadFlakes();
|
||||||
@@ -143,7 +142,7 @@ NixRepl::NixRepl(
|
|||||||
, getValues(getValues)
|
, getValues(getValues)
|
||||||
, staticEnv(new StaticEnv(nullptr, state->staticBaseEnv))
|
, staticEnv(new StaticEnv(nullptr, state->staticBaseEnv))
|
||||||
, runNixPtr{runNix}
|
, runNixPtr{runNix}
|
||||||
, interacter(make_unique<ReadlineLikeInteracter>(getDataDir() + "/repl-history"))
|
, interacter(make_unique<ReadlineLikeInteracter>((getDataDir() / "repl-history").string()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,7 +538,9 @@ ProcessLineResult NixRepl::processLine(std::string line)
|
|||||||
Value v;
|
Value v;
|
||||||
evalString(arg, v);
|
evalString(arg, v);
|
||||||
StorePath drvPath = getDerivationPath(v);
|
StorePath drvPath = getDerivationPath(v);
|
||||||
Path drvPathRaw = state->store->printStorePath(drvPath);
|
// N.B. This need not be a local / native file path. For
|
||||||
|
// example, we might be using an SSH store to a different OS.
|
||||||
|
std::string drvPathRaw = state->store->printStorePath(drvPath);
|
||||||
|
|
||||||
if (command == ":b" || command == ":bl") {
|
if (command == ":b" || command == ":bl") {
|
||||||
state->store->buildPaths({
|
state->store->buildPaths({
|
||||||
@@ -712,12 +713,12 @@ ProcessLineResult NixRepl::processLine(std::string line)
|
|||||||
return ProcessLineResult::PromptAgain;
|
return ProcessLineResult::PromptAgain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NixRepl::loadFile(const Path & path)
|
void NixRepl::loadFile(const std::filesystem::path & path)
|
||||||
{
|
{
|
||||||
loadedFiles.remove(path);
|
loadedFiles.remove(path);
|
||||||
loadedFiles.push_back(path);
|
loadedFiles.push_back(path);
|
||||||
Value v, v2;
|
Value v, v2;
|
||||||
state->evalFile(lookupFileArg(*state, path), v);
|
state->evalFile(lookupFileArg(*state, path.string()), v);
|
||||||
state->autoCallFunction(*autoArgs, v, v2);
|
state->autoCallFunction(*autoArgs, v, v2);
|
||||||
addAttrsToScope(v2);
|
addAttrsToScope(v2);
|
||||||
}
|
}
|
||||||
@@ -790,7 +791,7 @@ void NixRepl::reloadFilesAndFlakes()
|
|||||||
|
|
||||||
void NixRepl::loadFiles()
|
void NixRepl::loadFiles()
|
||||||
{
|
{
|
||||||
Strings old = loadedFiles;
|
decltype(loadedFiles) old = loadedFiles;
|
||||||
loadedFiles.clear();
|
loadedFiles.clear();
|
||||||
|
|
||||||
for (auto & i : old) {
|
for (auto & i : old) {
|
||||||
@@ -888,7 +889,7 @@ void NixRepl::evalString(std::string s, Value & v)
|
|||||||
state->forceValue(v, v.determinePos(noPos));
|
state->forceValue(v, v.determinePos(noPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NixRepl::runNix(Path program, const Strings & args, const std::optional<std::string> & input)
|
void NixRepl::runNix(const std::string & program, const Strings & args, const std::optional<std::string> & input)
|
||||||
{
|
{
|
||||||
if (runNixPtr)
|
if (runNixPtr)
|
||||||
(*runNixPtr)(program, args, input);
|
(*runNixPtr)(program, args, input);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ static nix::Value & check_value_out(nix_value * value)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline nix_value * new_nix_value(nix::Value * v, nix::EvalMemory & mem)
|
static nix_value * new_nix_value(nix::Value * v, nix::EvalMemory & mem)
|
||||||
{
|
{
|
||||||
nix_value * ret = new (mem.allocBytes(sizeof(nix_value))) nix_value{
|
nix_value * ret = new (mem.allocBytes(sizeof(nix_value))) nix_value{
|
||||||
.value = v,
|
.value = v,
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ TEST_F(nix_api_expr_test, nix_eval_state_lookup_path)
|
|||||||
{
|
{
|
||||||
auto tmpDir = nix::createTempDir();
|
auto tmpDir = nix::createTempDir();
|
||||||
auto delTmpDir = std::make_unique<nix::AutoDelete>(tmpDir, true);
|
auto delTmpDir = std::make_unique<nix::AutoDelete>(tmpDir, true);
|
||||||
auto nixpkgs = tmpDir + "/pkgs";
|
auto nixpkgs = tmpDir / "pkgs";
|
||||||
auto nixos = tmpDir + "/cfg";
|
auto nixos = tmpDir / "cfg";
|
||||||
std::filesystem::create_directories(nixpkgs);
|
std::filesystem::create_directories(nixpkgs);
|
||||||
std::filesystem::create_directories(nixos);
|
std::filesystem::create_directories(nixos);
|
||||||
|
|
||||||
std::string nixpkgsEntry = "nixpkgs=" + nixpkgs;
|
std::string nixpkgsEntry = "nixpkgs=" + nixpkgs.string();
|
||||||
std::string nixosEntry = "nixos-config=" + nixos;
|
std::string nixosEntry = "nixos-config=" + nixos.string();
|
||||||
const char * lookupPath[] = {nixpkgsEntry.c_str(), nixosEntry.c_str(), nullptr};
|
const char * lookupPath[] = {nixpkgsEntry.c_str(), nixosEntry.c_str(), nullptr};
|
||||||
|
|
||||||
auto builder = nix_eval_state_builder_new(ctx, store);
|
auto builder = nix_eval_state_builder_new(ctx, store);
|
||||||
@@ -49,7 +49,7 @@ TEST_F(nix_api_expr_test, nix_eval_state_lookup_path)
|
|||||||
|
|
||||||
auto pathStr = nix_get_path_string(ctx, value);
|
auto pathStr = nix_get_path_string(ctx, value);
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
ASSERT_EQ(0, strcmp(pathStr, nixpkgs.c_str()));
|
ASSERT_EQ(0, strcmp(pathStr, nixpkgs.string().c_str()));
|
||||||
|
|
||||||
nix_gc_decref(nullptr, value);
|
nix_gc_decref(nullptr, value);
|
||||||
}
|
}
|
||||||
@@ -232,22 +232,22 @@ TEST_F(nix_api_expr_test, nix_expr_realise_context)
|
|||||||
nix_realised_string_free(r);
|
nix_realised_string_free(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * SAMPLE_USER_DATA = "whatever";
|
static const char SAMPLE_USER_DATA = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
primop_square(void * user_data, nix_c_context * context, EvalState * state, nix_value ** args, nix_value * ret)
|
primop_square(void * user_data, nix_c_context * context, EvalState * state, nix_value ** args, nix_value * ret)
|
||||||
{
|
{
|
||||||
assert(context);
|
assert(context);
|
||||||
assert(state);
|
assert(state);
|
||||||
assert(user_data == SAMPLE_USER_DATA);
|
assert(user_data == &SAMPLE_USER_DATA);
|
||||||
auto i = nix_get_int(context, args[0]);
|
auto i = nix_get_int(context, args[0]);
|
||||||
nix_init_int(context, ret, i * i);
|
nix_init_int(context, ret, i * i);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(nix_api_expr_test, nix_expr_primop)
|
TEST_F(nix_api_expr_test, nix_expr_primop)
|
||||||
{
|
{
|
||||||
PrimOp * primop =
|
PrimOp * primop = nix_alloc_primop(
|
||||||
nix_alloc_primop(ctx, primop_square, 1, "square", nullptr, "square an integer", (void *) SAMPLE_USER_DATA);
|
ctx, primop_square, 1, "square", nullptr, "square an integer", const_cast<char *>(&SAMPLE_USER_DATA));
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
nix_value * primopValue = nix_alloc_value(ctx, state);
|
nix_value * primopValue = nix_alloc_value(ctx, state);
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
@@ -273,7 +273,7 @@ primop_repeat(void * user_data, nix_c_context * context, EvalState * state, nix_
|
|||||||
{
|
{
|
||||||
assert(context);
|
assert(context);
|
||||||
assert(state);
|
assert(state);
|
||||||
assert(user_data == SAMPLE_USER_DATA);
|
assert(user_data == &SAMPLE_USER_DATA);
|
||||||
|
|
||||||
// Get the string to repeat
|
// Get the string to repeat
|
||||||
std::string s;
|
std::string s;
|
||||||
@@ -295,8 +295,8 @@ primop_repeat(void * user_data, nix_c_context * context, EvalState * state, nix_
|
|||||||
|
|
||||||
TEST_F(nix_api_expr_test, nix_expr_primop_arity_2_multiple_calls)
|
TEST_F(nix_api_expr_test, nix_expr_primop_arity_2_multiple_calls)
|
||||||
{
|
{
|
||||||
PrimOp * primop =
|
PrimOp * primop = nix_alloc_primop(
|
||||||
nix_alloc_primop(ctx, primop_repeat, 2, "repeat", nullptr, "repeat a string", (void *) SAMPLE_USER_DATA);
|
ctx, primop_repeat, 2, "repeat", nullptr, "repeat a string", const_cast<char *>(&SAMPLE_USER_DATA));
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
nix_value * primopValue = nix_alloc_value(ctx, state);
|
nix_value * primopValue = nix_alloc_value(ctx, state);
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
@@ -330,8 +330,8 @@ TEST_F(nix_api_expr_test, nix_expr_primop_arity_2_multiple_calls)
|
|||||||
|
|
||||||
TEST_F(nix_api_expr_test, nix_expr_primop_arity_2_single_call)
|
TEST_F(nix_api_expr_test, nix_expr_primop_arity_2_single_call)
|
||||||
{
|
{
|
||||||
PrimOp * primop =
|
PrimOp * primop = nix_alloc_primop(
|
||||||
nix_alloc_primop(ctx, primop_repeat, 2, "repeat", nullptr, "repeat a string", (void *) SAMPLE_USER_DATA);
|
ctx, primop_repeat, 2, "repeat", nullptr, "repeat a string", const_cast<char *>(&SAMPLE_USER_DATA));
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
nix_value * primopValue = nix_alloc_value(ctx, state);
|
nix_value * primopValue = nix_alloc_value(ctx, state);
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
|
|||||||
@@ -14,12 +14,4 @@
|
|||||||
|
|
||||||
namespace nixC {
|
namespace nixC {
|
||||||
|
|
||||||
TEST_F(nix_api_expr_test, as_nix_value_ptr)
|
|
||||||
{
|
|
||||||
// nix_alloc_value casts nix::Value to nix_value
|
|
||||||
// It should be obvious from the decl that that works, but if it doesn't,
|
|
||||||
// the whole implementation would be utterly broken.
|
|
||||||
ASSERT_EQ(sizeof(nix::Value), sizeof(nix_value));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace nixC
|
} // namespace nixC
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "nix/expr/attr-path.hh"
|
#include "nix/expr/attr-path.hh"
|
||||||
#include "nix/expr/eval-inline.hh"
|
#include "nix/expr/eval-inline.hh"
|
||||||
|
#include "nix/util/strings-inline.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
@@ -30,14 +31,24 @@ static Strings parseAttrPath(std::string_view s)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Symbol> parseAttrPath(EvalState & state, std::string_view s)
|
AttrPath AttrPath::parse(EvalState & state, std::string_view s)
|
||||||
{
|
{
|
||||||
std::vector<Symbol> res;
|
AttrPath res;
|
||||||
for (auto & a : parseAttrPath(s))
|
for (auto & a : parseAttrPath(s))
|
||||||
res.push_back(state.symbols.create(a));
|
res.push_back(state.symbols.create(a));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AttrPath::to_string(EvalState & state) const
|
||||||
|
{
|
||||||
|
return dropEmptyInitThenConcatStringsSep(".", state.symbols.resolve({*this}));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<SymbolStr> AttrPath::resolve(EvalState & state) const
|
||||||
|
{
|
||||||
|
return state.symbols.resolve({*this});
|
||||||
|
}
|
||||||
|
|
||||||
std::pair<Value *, PosIdx>
|
std::pair<Value *, PosIdx>
|
||||||
findAlongAttrPath(EvalState & state, const std::string & attrPath, Bindings & autoArgs, Value & vIn)
|
findAlongAttrPath(EvalState & state, const std::string & attrPath, Bindings & autoArgs, Value & vIn)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ void AttrCursor::fetchCachedValue()
|
|||||||
throw CachedEvalError(parent->first, parent->second);
|
throw CachedEvalError(parent->first, parent->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Symbol> AttrCursor::getAttrPath() const
|
AttrPath AttrCursor::getAttrPath() const
|
||||||
{
|
{
|
||||||
if (parent) {
|
if (parent) {
|
||||||
auto attrPath = parent->first->getAttrPath();
|
auto attrPath = parent->first->getAttrPath();
|
||||||
@@ -374,7 +374,7 @@ std::vector<Symbol> AttrCursor::getAttrPath() const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Symbol> AttrCursor::getAttrPath(Symbol name) const
|
AttrPath AttrCursor::getAttrPath(Symbol name) const
|
||||||
{
|
{
|
||||||
auto attrPath = getAttrPath();
|
auto attrPath = getAttrPath();
|
||||||
attrPath.push_back(name);
|
attrPath.push_back(name);
|
||||||
@@ -383,12 +383,12 @@ std::vector<Symbol> AttrCursor::getAttrPath(Symbol name) const
|
|||||||
|
|
||||||
std::string AttrCursor::getAttrPathStr() const
|
std::string AttrCursor::getAttrPathStr() const
|
||||||
{
|
{
|
||||||
return dropEmptyInitThenConcatStringsSep(".", root->state.symbols.resolve(getAttrPath()));
|
return getAttrPath().to_string(root->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AttrCursor::getAttrPathStr(Symbol name) const
|
std::string AttrCursor::getAttrPathStr(Symbol name) const
|
||||||
{
|
{
|
||||||
return dropEmptyInitThenConcatStringsSep(".", root->state.symbols.resolve(getAttrPath(name)));
|
return getAttrPath(name).to_string(root->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value & AttrCursor::forceValue()
|
Value & AttrCursor::forceValue()
|
||||||
@@ -511,7 +511,7 @@ ref<AttrCursor> AttrCursor::getAttr(std::string_view name)
|
|||||||
return getAttr(root->state.symbols.create(name));
|
return getAttr(root->state.symbols.create(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
OrSuggestions<ref<AttrCursor>> AttrCursor::findAlongAttrPath(const std::vector<Symbol> & attrPath)
|
OrSuggestions<ref<AttrCursor>> AttrCursor::findAlongAttrPath(const AttrPath & attrPath)
|
||||||
{
|
{
|
||||||
auto res = shared_from_this();
|
auto res = shared_from_this();
|
||||||
for (auto & attr : attrPath) {
|
for (auto & attr : attrPath) {
|
||||||
|
|||||||
@@ -60,18 +60,18 @@ EvalSettings::EvalSettings(bool & readOnlyMode, EvalSettings::LookupPathHooks lo
|
|||||||
Strings EvalSettings::getDefaultNixPath()
|
Strings EvalSettings::getDefaultNixPath()
|
||||||
{
|
{
|
||||||
Strings res;
|
Strings res;
|
||||||
auto add = [&](const Path & p, const std::string & s = std::string()) {
|
auto add = [&](const std::filesystem::path & p, const std::string & s = std::string()) {
|
||||||
if (std::filesystem::exists(p)) {
|
if (std::filesystem::exists(p)) {
|
||||||
if (s.empty()) {
|
if (s.empty()) {
|
||||||
res.push_back(p);
|
res.push_back(p.string());
|
||||||
} else {
|
} else {
|
||||||
res.push_back(s + "=" + p);
|
res.push_back(s + "=" + p.string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
add(getNixDefExpr() + "/channels");
|
add(std::filesystem::path{getNixDefExpr()} / "channels");
|
||||||
add(rootChannelsDir() + "/nixpkgs", "nixpkgs");
|
add(rootChannelsDir() / "nixpkgs", "nixpkgs");
|
||||||
add(rootChannelsDir());
|
add(rootChannelsDir());
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -103,9 +103,9 @@ const std::string & EvalSettings::getCurrentSystem() const
|
|||||||
return evalSystem != "" ? evalSystem : settings.thisSystem.get();
|
return evalSystem != "" ? evalSystem : settings.thisSystem.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Path getNixDefExpr()
|
std::filesystem::path getNixDefExpr()
|
||||||
{
|
{
|
||||||
return settings.useXDGBaseDirectories ? getStateDir() + "/defexpr" : getHome() + "/.nix-defexpr";
|
return settings.useXDGBaseDirectories ? getStateDir() / "defexpr" : getHome() / ".nix-defexpr";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
+3
-3
@@ -1368,7 +1368,7 @@ void ExprVar::eval(EvalState & state, Env & env, Value & v)
|
|||||||
v = *v2;
|
v = *v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string showAttrPath(EvalState & state, Env & env, std::span<const AttrName> attrPath)
|
static std::string showAttrSelectionPath(EvalState & state, Env & env, std::span<const AttrName> attrPath)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
@@ -1404,7 +1404,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
|||||||
env,
|
env,
|
||||||
getPos(),
|
getPos(),
|
||||||
"while evaluating the attribute '%1%'",
|
"while evaluating the attribute '%1%'",
|
||||||
showAttrPath(state, env, getAttrPath()))
|
showAttrSelectionPath(state, env, getAttrPath()))
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
||||||
for (auto & i : getAttrPath()) {
|
for (auto & i : getAttrPath()) {
|
||||||
@@ -1445,7 +1445,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
|||||||
auto origin = std::get_if<SourcePath>(&pos2r.origin);
|
auto origin = std::get_if<SourcePath>(&pos2r.origin);
|
||||||
if (!(origin && *origin == state.derivationInternal))
|
if (!(origin && *origin == state.derivationInternal))
|
||||||
state.addErrorTrace(
|
state.addErrorTrace(
|
||||||
e, pos2, "while evaluating the attribute '%1%'", showAttrPath(state, env, getAttrPath()));
|
e, pos2, "while evaluating the attribute '%1%'", showAttrSelectionPath(state, env, getAttrPath()));
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,15 @@ findAlongAttrPath(EvalState & state, const std::string & attrPath, Bindings & au
|
|||||||
*/
|
*/
|
||||||
std::pair<SourcePath, uint32_t> findPackageFilename(EvalState & state, Value & v, std::string what);
|
std::pair<SourcePath, uint32_t> findPackageFilename(EvalState & state, Value & v, std::string what);
|
||||||
|
|
||||||
std::vector<Symbol> parseAttrPath(EvalState & state, std::string_view s);
|
struct AttrPath : std::vector<Symbol>
|
||||||
|
{
|
||||||
|
using std::vector<Symbol>::vector;
|
||||||
|
|
||||||
|
static AttrPath parse(EvalState & state, std::string_view s);
|
||||||
|
|
||||||
|
std::string to_string(EvalState & state) const;
|
||||||
|
|
||||||
|
std::vector<SymbolStr> resolve(EvalState & state) const;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "nix/util/sync.hh"
|
#include "nix/util/sync.hh"
|
||||||
#include "nix/util/hash.hh"
|
#include "nix/util/hash.hh"
|
||||||
#include "nix/expr/eval.hh"
|
#include "nix/expr/eval.hh"
|
||||||
|
#include "nix/expr/attr-path.hh"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
@@ -124,9 +125,9 @@ public:
|
|||||||
Value * value = nullptr,
|
Value * value = nullptr,
|
||||||
std::optional<std::pair<AttrId, AttrValue>> && cachedValue = {});
|
std::optional<std::pair<AttrId, AttrValue>> && cachedValue = {});
|
||||||
|
|
||||||
std::vector<Symbol> getAttrPath() const;
|
AttrPath getAttrPath() const;
|
||||||
|
|
||||||
std::vector<Symbol> getAttrPath(Symbol name) const;
|
AttrPath getAttrPath(Symbol name) const;
|
||||||
|
|
||||||
std::string getAttrPathStr() const;
|
std::string getAttrPathStr() const;
|
||||||
|
|
||||||
@@ -146,7 +147,7 @@ public:
|
|||||||
* Get an attribute along a chain of attrsets. Note that this does
|
* Get an attribute along a chain of attrsets. Note that this does
|
||||||
* not auto-call functors or functions.
|
* not auto-call functors or functions.
|
||||||
*/
|
*/
|
||||||
OrSuggestions<ref<AttrCursor>> findAlongAttrPath(const std::vector<Symbol> & attrPath);
|
OrSuggestions<ref<AttrCursor>> findAlongAttrPath(const AttrPath & attrPath);
|
||||||
|
|
||||||
std::string getString();
|
std::string getString();
|
||||||
|
|
||||||
|
|||||||
@@ -366,6 +366,6 @@ struct EvalSettings : Config
|
|||||||
/**
|
/**
|
||||||
* Conventionally part of the default nix path in impure mode.
|
* Conventionally part of the default nix path in impure mode.
|
||||||
*/
|
*/
|
||||||
Path getNixDefExpr();
|
std::filesystem::path getNixDefExpr();
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
@@ -87,9 +87,9 @@ struct AttrName
|
|||||||
|
|
||||||
static_assert(std::is_trivially_copy_constructible_v<AttrName>);
|
static_assert(std::is_trivially_copy_constructible_v<AttrName>);
|
||||||
|
|
||||||
typedef std::vector<AttrName> AttrPath;
|
typedef std::vector<AttrName> AttrSelectionPath;
|
||||||
|
|
||||||
std::string showAttrPath(const SymbolTable & symbols, std::span<const AttrName> attrPath);
|
std::string showAttrSelectionPath(const SymbolTable & symbols, std::span<const AttrName> attrPath);
|
||||||
|
|
||||||
using UpdateQueue = SmallTemporaryValueVector<conservativeStackReservation>;
|
using UpdateQueue = SmallTemporaryValueVector<conservativeStackReservation>;
|
||||||
|
|
||||||
@@ -438,6 +438,7 @@ struct ExprAttrs : Expr
|
|||||||
std::shared_ptr<const StaticEnv> bindInheritSources(EvalState & es, const std::shared_ptr<const StaticEnv> & env);
|
std::shared_ptr<const StaticEnv> bindInheritSources(EvalState & es, const std::shared_ptr<const StaticEnv> & env);
|
||||||
Env * buildInheritFromEnv(EvalState & state, Env & up);
|
Env * buildInheritFromEnv(EvalState & state, Env & up);
|
||||||
void showBindings(const SymbolTable & symbols, std::ostream & str) const;
|
void showBindings(const SymbolTable & symbols, std::ostream & str) const;
|
||||||
|
void moveDataToAllocator(std::pmr::polymorphic_allocator<char> & alloc);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExprList : Expr
|
struct ExprList : Expr
|
||||||
@@ -622,6 +623,7 @@ struct ExprCall : Expr
|
|||||||
|
|
||||||
virtual void resetCursedOr() override;
|
virtual void resetCursedOr() override;
|
||||||
virtual void warnIfCursedOr(const SymbolTable & symbols, const PosTable & positions) override;
|
virtual void warnIfCursedOr(const SymbolTable & symbols, const PosTable & positions) override;
|
||||||
|
void moveDataToAllocator(std::pmr::polymorphic_allocator<char> & alloc);
|
||||||
COMMON_METHODS
|
COMMON_METHODS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,79 @@ struct ParserLocation
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This represents a string-like parse that possibly has yet to be constructed.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
* "foo"
|
||||||
|
* ${"foo" + "bar"}
|
||||||
|
* "foo.bar"
|
||||||
|
* "foo-${a}"
|
||||||
|
*
|
||||||
|
* Using this type allows us to avoid construction altogether in cases where what we actually need is the string
|
||||||
|
* contents. For example in foo."bar.baz", there is no need to construct an AST node for "bar.baz", but we don't know
|
||||||
|
* that until we bubble the value up during parsing and see that it's a node in an AttrPath.
|
||||||
|
*/
|
||||||
|
class ToBeStringyExpr
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
using Raw = std::variant<std::monostate, std::string_view, Expr *>;
|
||||||
|
Raw raw;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ToBeStringyExpr() = default;
|
||||||
|
|
||||||
|
ToBeStringyExpr(std::string_view v)
|
||||||
|
: raw(v)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ToBeStringyExpr(Expr * expr)
|
||||||
|
: raw(expr)
|
||||||
|
{
|
||||||
|
assert(expr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visits the expression and invokes an overloaded functor object \ref f.
|
||||||
|
* If the underlying Expr has a dynamic type of ExprString the overload taking std::string_view
|
||||||
|
* is invoked.
|
||||||
|
*
|
||||||
|
* Used to consistently handle simple StringExpr ${"string"} as non-dynamic attributes.
|
||||||
|
* @see https://github.com/NixOS/nix/issues/14642
|
||||||
|
*/
|
||||||
|
template<class F>
|
||||||
|
void visit(F && f)
|
||||||
|
{
|
||||||
|
std::visit(
|
||||||
|
overloaded{
|
||||||
|
[&](std::string_view str) { f(str); },
|
||||||
|
[&](Expr * expr) {
|
||||||
|
ExprString * str = dynamic_cast<ExprString *>(expr);
|
||||||
|
if (str)
|
||||||
|
f(str->v.string_view());
|
||||||
|
else
|
||||||
|
f(expr);
|
||||||
|
},
|
||||||
|
[](std::monostate) { unreachable(); }},
|
||||||
|
raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or create an Expr from either an existing Expr or from a string.
|
||||||
|
* Delays the allocation or an AST node in case the parser only cares about string contents.
|
||||||
|
*/
|
||||||
|
Expr * toExpr(Exprs & exprs)
|
||||||
|
{
|
||||||
|
return std::visit(
|
||||||
|
overloaded{
|
||||||
|
[&](std::string_view str) -> Expr * { return exprs.add<ExprString>(exprs.alloc, str); },
|
||||||
|
[&](Expr * expr) { return expr; },
|
||||||
|
[](std::monostate) -> Expr * { unreachable(); }},
|
||||||
|
raw);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct LexerState
|
struct LexerState
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -90,20 +163,25 @@ struct ParserState
|
|||||||
static constexpr Expr::AstSymbols s = StaticEvalSymbols::create().exprSymbols;
|
static constexpr Expr::AstSymbols s = StaticEvalSymbols::create().exprSymbols;
|
||||||
const EvalSettings & settings;
|
const EvalSettings & settings;
|
||||||
|
|
||||||
void dupAttr(const AttrPath & attrPath, const PosIdx pos, const PosIdx prevPos);
|
void dupAttr(const AttrSelectionPath & attrPath, const PosIdx pos, const PosIdx prevPos);
|
||||||
void dupAttr(Symbol attr, const PosIdx pos, const PosIdx prevPos);
|
void dupAttr(Symbol attr, const PosIdx pos, const PosIdx prevPos);
|
||||||
void addAttr(
|
void addAttr(
|
||||||
ExprAttrs * attrs, AttrPath && attrPath, const ParserLocation & loc, Expr * e, const ParserLocation & exprLoc);
|
ExprAttrs * attrs,
|
||||||
void addAttr(ExprAttrs * attrs, AttrPath & attrPath, const Symbol & symbol, ExprAttrs::AttrDef && def);
|
AttrSelectionPath && attrPath,
|
||||||
|
const ParserLocation & loc,
|
||||||
|
Expr * e,
|
||||||
|
const ParserLocation & exprLoc);
|
||||||
|
void addAttr(ExprAttrs * attrs, AttrSelectionPath & attrPath, const Symbol & symbol, ExprAttrs::AttrDef && def);
|
||||||
void validateFormals(FormalsBuilder & formals, PosIdx pos = noPos, Symbol arg = {});
|
void validateFormals(FormalsBuilder & formals, PosIdx pos = noPos, Symbol arg = {});
|
||||||
Expr * stripIndentation(const PosIdx pos, std::span<std::pair<PosIdx, std::variant<Expr *, StringToken>>> es);
|
Expr * stripIndentation(const PosIdx pos, std::span<std::pair<PosIdx, std::variant<Expr *, StringToken>>> es);
|
||||||
PosIdx at(const ParserLocation & loc);
|
PosIdx at(const ParserLocation & loc);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void ParserState::dupAttr(const AttrPath & attrPath, const PosIdx pos, const PosIdx prevPos)
|
inline void ParserState::dupAttr(const AttrSelectionPath & attrPath, const PosIdx pos, const PosIdx prevPos)
|
||||||
{
|
{
|
||||||
throw ParseError(
|
throw ParseError(
|
||||||
{.msg = HintFmt("attribute '%1%' already defined at %2%", showAttrPath(symbols, attrPath), positions[prevPos]),
|
{.msg = HintFmt(
|
||||||
|
"attribute '%1%' already defined at %2%", showAttrSelectionPath(symbols, attrPath), positions[prevPos]),
|
||||||
.pos = positions[pos]});
|
.pos = positions[pos]});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,9 +193,13 @@ inline void ParserState::dupAttr(Symbol attr, const PosIdx pos, const PosIdx pre
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void ParserState::addAttr(
|
inline void ParserState::addAttr(
|
||||||
ExprAttrs * attrs, AttrPath && attrPath, const ParserLocation & loc, Expr * e, const ParserLocation & exprLoc)
|
ExprAttrs * attrs,
|
||||||
|
AttrSelectionPath && attrPath,
|
||||||
|
const ParserLocation & loc,
|
||||||
|
Expr * e,
|
||||||
|
const ParserLocation & exprLoc)
|
||||||
{
|
{
|
||||||
AttrPath::iterator i;
|
AttrSelectionPath::iterator i;
|
||||||
// All attrpaths have at least one attr
|
// All attrpaths have at least one attr
|
||||||
assert(!attrPath.empty());
|
assert(!attrPath.empty());
|
||||||
auto pos = at(loc);
|
auto pos = at(loc);
|
||||||
@@ -163,7 +245,7 @@ inline void ParserState::addAttr(
|
|||||||
* symbol as its last element.
|
* symbol as its last element.
|
||||||
*/
|
*/
|
||||||
inline void
|
inline void
|
||||||
ParserState::addAttr(ExprAttrs * attrs, AttrPath & attrPath, const Symbol & symbol, ExprAttrs::AttrDef && def)
|
ParserState::addAttr(ExprAttrs * attrs, AttrSelectionPath & attrPath, const Symbol & symbol, ExprAttrs::AttrDef && def)
|
||||||
{
|
{
|
||||||
ExprAttrs::AttrDefs::iterator j = attrs->attrs->find(symbol);
|
ExprAttrs::AttrDefs::iterator j = attrs->attrs->find(symbol);
|
||||||
if (j != attrs->attrs->end()) {
|
if (j != attrs->attrs->end()) {
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public:
|
|||||||
return Symbol(*symbols.insert(SymbolStr::Key{store, s, buffer}).first);
|
return Symbol(*symbols.insert(SymbolStr::Key{store, s, buffer}).first);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<SymbolStr> resolve(const std::vector<Symbol> & symbols) const
|
std::vector<SymbolStr> resolve(const std::span<const Symbol> & symbols) const
|
||||||
{
|
{
|
||||||
std::vector<SymbolStr> result;
|
std::vector<SymbolStr> result;
|
||||||
result.reserve(symbols.size());
|
result.reserve(symbols.size());
|
||||||
|
|||||||
+22
-19
@@ -57,7 +57,7 @@ void ExprSelect::show(const SymbolTable & symbols, std::ostream & str) const
|
|||||||
{
|
{
|
||||||
str << "(";
|
str << "(";
|
||||||
e->show(symbols, str);
|
e->show(symbols, str);
|
||||||
str << ")." << showAttrPath(symbols, getAttrPath());
|
str << ")." << showAttrSelectionPath(symbols, getAttrPath());
|
||||||
if (def) {
|
if (def) {
|
||||||
str << " or (";
|
str << " or (";
|
||||||
def->show(symbols, str);
|
def->show(symbols, str);
|
||||||
@@ -69,7 +69,7 @@ void ExprOpHasAttr::show(const SymbolTable & symbols, std::ostream & str) const
|
|||||||
{
|
{
|
||||||
str << "((";
|
str << "((";
|
||||||
e->show(symbols, str);
|
e->show(symbols, str);
|
||||||
str << ") ? " << showAttrPath(symbols, attrPath) << ")";
|
str << ") ? " << showAttrSelectionPath(symbols, attrPath) << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExprAttrs::showBindings(const SymbolTable & symbols, std::ostream & str) const
|
void ExprAttrs::showBindings(const SymbolTable & symbols, std::ostream & str) const
|
||||||
@@ -261,7 +261,7 @@ void ExprPos::show(const SymbolTable & symbols, std::ostream & str) const
|
|||||||
str << "__curPos";
|
str << "__curPos";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string showAttrPath(const SymbolTable & symbols, std::span<const AttrName> attrPath)
|
std::string showAttrSelectionPath(const SymbolTable & symbols, std::span<const AttrName> attrPath)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
@@ -399,18 +399,19 @@ ExprAttrs::bindInheritSources(EvalState & es, const std::shared_ptr<const Static
|
|||||||
return inner;
|
return inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExprAttrs::moveDataToAllocator(std::pmr::polymorphic_allocator<char> & alloc)
|
||||||
|
{
|
||||||
|
AttrDefs newAttrs{std::move(*attrs), alloc};
|
||||||
|
attrs.emplace(std::move(newAttrs), alloc);
|
||||||
|
DynamicAttrDefs newDynamicAttrs{std::move(*dynamicAttrs), alloc};
|
||||||
|
dynamicAttrs.emplace(std::move(newDynamicAttrs), alloc);
|
||||||
|
if (inheritFromExprs)
|
||||||
|
inheritFromExprs = std::make_unique<std::pmr::vector<Expr *>>(std::move(*inheritFromExprs), alloc);
|
||||||
|
}
|
||||||
|
|
||||||
void ExprAttrs::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> & env)
|
void ExprAttrs::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> & env)
|
||||||
{
|
{
|
||||||
// Move storage into the Exprs arena
|
moveDataToAllocator(es.mem.exprs.alloc);
|
||||||
{
|
|
||||||
auto arena = es.mem.exprs.alloc;
|
|
||||||
AttrDefs newAttrs{std::move(*attrs), arena};
|
|
||||||
attrs.emplace(std::move(newAttrs), arena);
|
|
||||||
DynamicAttrDefs newDynamicAttrs{std::move(*dynamicAttrs), arena};
|
|
||||||
dynamicAttrs.emplace(std::move(newDynamicAttrs), arena);
|
|
||||||
if (inheritFromExprs)
|
|
||||||
inheritFromExprs = std::make_unique<std::pmr::vector<Expr *>>(std::move(*inheritFromExprs), arena);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (es.debugRepl)
|
if (es.debugRepl)
|
||||||
es.exprEnvs.insert(std::make_pair(this, env));
|
es.exprEnvs.insert(std::make_pair(this, env));
|
||||||
@@ -484,14 +485,15 @@ void ExprLambda::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv>
|
|||||||
body->bindVars(es, newEnv);
|
body->bindVars(es, newEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExprCall::moveDataToAllocator(std::pmr::polymorphic_allocator<char> & alloc)
|
||||||
|
{
|
||||||
|
std::pmr::vector<Expr *> newArgs{std::move(*args), alloc};
|
||||||
|
args.emplace(std::move(newArgs), alloc);
|
||||||
|
}
|
||||||
|
|
||||||
void ExprCall::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> & env)
|
void ExprCall::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> & env)
|
||||||
{
|
{
|
||||||
// Move storage into the Exprs arena
|
moveDataToAllocator(es.mem.exprs.alloc);
|
||||||
{
|
|
||||||
auto arena = es.mem.exprs.alloc;
|
|
||||||
std::pmr::vector<Expr *> newArgs{std::move(*args), arena};
|
|
||||||
args.emplace(std::move(newArgs), arena);
|
|
||||||
}
|
|
||||||
if (es.debugRepl)
|
if (es.debugRepl)
|
||||||
es.exprEnvs.insert(std::make_pair(this, env));
|
es.exprEnvs.insert(std::make_pair(this, env));
|
||||||
|
|
||||||
@@ -502,6 +504,7 @@ void ExprCall::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> &
|
|||||||
|
|
||||||
void ExprLet::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> & env)
|
void ExprLet::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> & env)
|
||||||
{
|
{
|
||||||
|
attrs->moveDataToAllocator(es.mem.exprs.alloc);
|
||||||
auto newEnv = [&]() -> std::shared_ptr<const StaticEnv> {
|
auto newEnv = [&]() -> std::shared_ptr<const StaticEnv> {
|
||||||
auto newEnv = std::make_shared<StaticEnv>(nullptr, env, attrs->attrs->size());
|
auto newEnv = std::make_shared<StaticEnv>(nullptr, env, attrs->attrs->size());
|
||||||
|
|
||||||
|
|||||||
+20
-25
@@ -138,7 +138,7 @@ static Expr * makeCall(Exprs & exprs, PosIdx pos, Expr * fn, Expr * arg) {
|
|||||||
%type <std::vector<std::pair<PosIdx, Expr *>>> string_parts_interpolated
|
%type <std::vector<std::pair<PosIdx, Expr *>>> string_parts_interpolated
|
||||||
%type <std::vector<std::pair<PosIdx, std::variant<Expr *, StringToken>>>> ind_string_parts
|
%type <std::vector<std::pair<PosIdx, std::variant<Expr *, StringToken>>>> ind_string_parts
|
||||||
%type <Expr *> path_start
|
%type <Expr *> path_start
|
||||||
%type <std::variant<Expr *, std::string_view>> string_parts string_attr
|
%type <ToBeStringyExpr> string_parts string_attr
|
||||||
%type <StringToken> attr
|
%type <StringToken> attr
|
||||||
%token <StringToken> ID
|
%token <StringToken> ID
|
||||||
%token <StringToken> STR IND_STR
|
%token <StringToken> STR IND_STR
|
||||||
@@ -297,12 +297,7 @@ expr_simple
|
|||||||
}
|
}
|
||||||
| INT_LIT { $$ = state->exprs.add<ExprInt>($1); }
|
| INT_LIT { $$ = state->exprs.add<ExprInt>($1); }
|
||||||
| FLOAT_LIT { $$ = state->exprs.add<ExprFloat>($1); }
|
| FLOAT_LIT { $$ = state->exprs.add<ExprFloat>($1); }
|
||||||
| '"' string_parts '"' {
|
| '"' string_parts '"' { $$ = $2.toExpr(state->exprs); }
|
||||||
std::visit(overloaded{
|
|
||||||
[&](std::string_view str) { $$ = state->exprs.add<ExprString>(state->exprs.alloc, str); },
|
|
||||||
[&](Expr * expr) { $$ = expr; }},
|
|
||||||
$2);
|
|
||||||
}
|
|
||||||
| IND_STRING_OPEN ind_string_parts IND_STRING_CLOSE {
|
| IND_STRING_OPEN ind_string_parts IND_STRING_CLOSE {
|
||||||
$$ = state->stripIndentation(CUR_POS, $2);
|
$$ = state->stripIndentation(CUR_POS, $2);
|
||||||
}
|
}
|
||||||
@@ -342,9 +337,9 @@ expr_simple
|
|||||||
;
|
;
|
||||||
|
|
||||||
string_parts
|
string_parts
|
||||||
: STR { $$ = $1; }
|
: STR { $$ = {$1}; }
|
||||||
| string_parts_interpolated { $$ = state->exprs.add<ExprConcatStrings>(state->exprs.alloc, CUR_POS, true, $1); }
|
| string_parts_interpolated { $$ = {state->exprs.add<ExprConcatStrings>(state->exprs.alloc, CUR_POS, true, $1)}; }
|
||||||
| { $$ = std::string_view(); }
|
| { $$ = {std::string_view()}; }
|
||||||
;
|
;
|
||||||
|
|
||||||
string_parts_interpolated
|
string_parts_interpolated
|
||||||
@@ -389,7 +384,7 @@ path_start
|
|||||||
std::string_view($1.p, $1.l)
|
std::string_view($1.p, $1.l)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Path path(getHome() + std::string($1.p + 1, $1.l - 1));
|
Path path(getHome().string() + std::string($1.p + 1, $1.l - 1));
|
||||||
$$ = state->exprs.add<ExprPath>(state->exprs.alloc, ref<SourceAccessor>(state->rootFS), path);
|
$$ = state->exprs.add<ExprPath>(state->exprs.alloc, ref<SourceAccessor>(state->rootFS), path);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@@ -447,15 +442,15 @@ attrs
|
|||||||
: attrs attr { $$ = std::move($1); $$.emplace_back(state->symbols.create($2), state->at(@2)); }
|
: attrs attr { $$ = std::move($1); $$.emplace_back(state->symbols.create($2), state->at(@2)); }
|
||||||
| attrs string_attr
|
| attrs string_attr
|
||||||
{ $$ = std::move($1);
|
{ $$ = std::move($1);
|
||||||
std::visit(overloaded {
|
$2.visit(overloaded{
|
||||||
[&](std::string_view str) { $$.emplace_back(state->symbols.create(str), state->at(@2)); },
|
[&](std::string_view str) { $$.emplace_back(state->symbols.create(str), state->at(@2)); },
|
||||||
[&](Expr * expr) {
|
[&](Expr * expr) {
|
||||||
throw ParseError({
|
throw ParseError({
|
||||||
.msg = HintFmt("dynamic attributes not allowed in inherit"),
|
.msg = HintFmt("dynamic attributes not allowed in inherit"),
|
||||||
.pos = state->positions[state->at(@2)]
|
.pos = state->positions[state->at(@2)]
|
||||||
});
|
});
|
||||||
}
|
}}
|
||||||
}, $2);
|
);
|
||||||
}
|
}
|
||||||
| { }
|
| { }
|
||||||
;
|
;
|
||||||
@@ -464,17 +459,17 @@ attrpath
|
|||||||
: attrpath '.' attr { $$ = std::move($1); $$.emplace_back(state->symbols.create($3)); }
|
: attrpath '.' attr { $$ = std::move($1); $$.emplace_back(state->symbols.create($3)); }
|
||||||
| attrpath '.' string_attr
|
| attrpath '.' string_attr
|
||||||
{ $$ = std::move($1);
|
{ $$ = std::move($1);
|
||||||
std::visit(overloaded {
|
$3.visit(overloaded{
|
||||||
[&](std::string_view str) { $$.emplace_back(state->symbols.create(str)); },
|
[&](std::string_view str) { $$.emplace_back(state->symbols.create(str)); },
|
||||||
[&](Expr * expr) { $$.emplace_back(expr); }
|
[&](Expr * expr) { $$.emplace_back(expr); }}
|
||||||
}, std::move($3));
|
);
|
||||||
}
|
}
|
||||||
| attr { $$.emplace_back(state->symbols.create($1)); }
|
| attr { $$.emplace_back(state->symbols.create($1)); }
|
||||||
| string_attr
|
| string_attr
|
||||||
{ std::visit(overloaded {
|
{ $1.visit(overloaded{
|
||||||
[&](std::string_view str) { $$.emplace_back(state->symbols.create(str)); },
|
[&](std::string_view str) { $$.emplace_back(state->symbols.create(str)); },
|
||||||
[&](Expr * expr) { $$.emplace_back(expr); }
|
[&](Expr * expr) { $$.emplace_back(expr); }}
|
||||||
}, std::move($1));
|
);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -485,7 +480,7 @@ attr
|
|||||||
|
|
||||||
string_attr
|
string_attr
|
||||||
: '"' string_parts '"' { $$ = std::move($2); }
|
: '"' string_parts '"' { $$ = std::move($2); }
|
||||||
| DOLLAR_CURLY expr '}' { $$ = $2; }
|
| DOLLAR_CURLY expr '}' { $$ = {$2}; }
|
||||||
;
|
;
|
||||||
|
|
||||||
list
|
list
|
||||||
|
|||||||
+73
-37
@@ -317,10 +317,51 @@ static void import(EvalState & state, const PosIdx pos, Value & vPath, Value * v
|
|||||||
}
|
}
|
||||||
|
|
||||||
static RegisterPrimOp primop_scopedImport(
|
static RegisterPrimOp primop_scopedImport(
|
||||||
PrimOp{
|
{.name = "scopedImport",
|
||||||
.name = "scopedImport", .arity = 2, .fun = [](EvalState & state, const PosIdx pos, Value ** args, Value & v) {
|
.args = {"scope", "path"},
|
||||||
import(state, pos, *args[1], args[0], v);
|
.doc = R"(
|
||||||
}});
|
Load, parse, and return the Nix expression in the file *path*, with the attributes from *scope* available as variables in the lexical scope of the imported file.
|
||||||
|
|
||||||
|
This function is similar to [`import`](#builtins-import), but allows you to provide additional variables that will be available in the scope of the imported expression.
|
||||||
|
The *scope* argument must be an attribute set; each attribute becomes a variable available in the imported file.
|
||||||
|
Built-in functions and values remain accessible unless shadowed by *scope* attributes.
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
>
|
||||||
|
> Variables from *scope* shadow built-ins with the same name, allowing you to override built-ins for the imported expression.
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
>
|
||||||
|
> Unlike [`import`](#builtins-import), `scopedImport` does not memoize evaluation results.
|
||||||
|
> While the parsing result may be reused, each call produces a distinct value.
|
||||||
|
> This is observable through performance and side effects such as [`builtins.trace`](#builtins-trace).
|
||||||
|
|
||||||
|
The *path* argument must meet the same criteria as an [interpolated expression](@docroot@/language/string-interpolation.md#interpolated-expression).
|
||||||
|
|
||||||
|
If *path* is a directory, the file `default.nix` in that directory is used if it exists.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> Create a file `greet.nix`:
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> # greet.nix
|
||||||
|
> "${greeting}, ${name}!"
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> Import it with additional variables in scope:
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> scopedImport { greeting = "Hello"; name = "World"; } ./greet.nix
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "Hello, World!"
|
||||||
|
|
||||||
|
Evaluation aborts if the file doesn't exist or contains an invalid Nix expression.
|
||||||
|
)",
|
||||||
|
.fun = [](EvalState & state, const PosIdx pos, Value ** args, Value & v) {
|
||||||
|
import(state, pos, *args[1], args[0], v);
|
||||||
|
}});
|
||||||
|
|
||||||
static RegisterPrimOp primop_import(
|
static RegisterPrimOp primop_import(
|
||||||
{.name = "import",
|
{.name = "import",
|
||||||
@@ -1774,28 +1815,7 @@ static void derivationStrictInternal(EvalState & state, std::string_view drvName
|
|||||||
drv.outputs.insert_or_assign(i, DerivationOutput::Deferred{});
|
drv.outputs.insert_or_assign(i, DerivationOutput::Deferred{});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto hashModulo = hashDerivationModulo(*state.store, Derivation(drv), true);
|
drv.fillInOutputPaths(*state.store);
|
||||||
switch (hashModulo.kind) {
|
|
||||||
case DrvHash::Kind::Regular:
|
|
||||||
for (auto & i : outputs) {
|
|
||||||
auto h = get(hashModulo.hashes, i);
|
|
||||||
if (!h)
|
|
||||||
state.error<AssertionError>("derivation produced no hash for output '%s'", i).atPos(v).debugThrow();
|
|
||||||
auto outPath = state.store->makeOutputPath(i, *h, drvName);
|
|
||||||
drv.env[i] = state.store->printStorePath(outPath);
|
|
||||||
drv.outputs.insert_or_assign(
|
|
||||||
i,
|
|
||||||
DerivationOutput::InputAddressed{
|
|
||||||
.path = std::move(outPath),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
;
|
|
||||||
case DrvHash::Kind::Deferred:
|
|
||||||
for (auto & i : outputs) {
|
|
||||||
drv.outputs.insert_or_assign(i, DerivationOutput::Deferred{});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the resulting term into the Nix store directory. */
|
/* Write the resulting term into the Nix store directory. */
|
||||||
@@ -2787,11 +2807,18 @@ static void addPath(
|
|||||||
const NixStringContext & context)
|
const NixStringContext & context)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (path.accessor == state.rootFS && state.store->isInStore(path.path.abs())) {
|
StorePathSet refs;
|
||||||
|
|
||||||
|
if (path.accessor == state.rootFS && state.store->isInStore(path.path.abs()) && !context.empty()) {
|
||||||
// FIXME: handle CA derivation outputs (where path needs to
|
// FIXME: handle CA derivation outputs (where path needs to
|
||||||
// be rewritten to the actual output).
|
// be rewritten to the actual output).
|
||||||
auto rewrites = state.realiseContext(context);
|
auto rewrites = state.realiseContext(context);
|
||||||
path = {path.accessor, CanonPath(rewriteStrings(path.path.abs(), rewrites))};
|
path = {path.accessor, CanonPath(rewriteStrings(path.path.abs(), rewrites))};
|
||||||
|
auto [storePath, subPath] = state.store->toStorePath(path.path.abs());
|
||||||
|
try {
|
||||||
|
refs = state.store->queryPathInfo(storePath)->references;
|
||||||
|
} catch (Error &) { // FIXME: should be InvalidPathError
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PathFilter> filter;
|
std::unique_ptr<PathFilter> filter;
|
||||||
@@ -2804,18 +2831,27 @@ static void addPath(
|
|||||||
std::optional<StorePath> expectedStorePath;
|
std::optional<StorePath> expectedStorePath;
|
||||||
if (expectedHash)
|
if (expectedHash)
|
||||||
expectedStorePath = state.store->makeFixedOutputPathFromCA(
|
expectedStorePath = state.store->makeFixedOutputPathFromCA(
|
||||||
name, ContentAddressWithReferences::fromParts(method, *expectedHash, {}));
|
name, ContentAddressWithReferences::fromParts(method, *expectedHash, {refs}));
|
||||||
|
|
||||||
if (!expectedHash || !state.store->isValidPath(*expectedStorePath)) {
|
if (!expectedHash || !state.store->isValidPath(*expectedStorePath)) {
|
||||||
auto dstPath = fetchToStore(
|
// FIXME: support refs in fetchToStore()?
|
||||||
state.fetchSettings,
|
auto dstPath = refs.empty() ? fetchToStore(
|
||||||
*state.store,
|
state.fetchSettings,
|
||||||
path.resolveSymlinks(),
|
*state.store,
|
||||||
settings.readOnlyMode ? FetchMode::DryRun : FetchMode::Copy,
|
path.resolveSymlinks(),
|
||||||
name,
|
settings.readOnlyMode ? FetchMode::DryRun : FetchMode::Copy,
|
||||||
method,
|
name,
|
||||||
filter.get(),
|
method,
|
||||||
state.repair);
|
filter.get(),
|
||||||
|
state.repair)
|
||||||
|
: state.store->addToStore(
|
||||||
|
name,
|
||||||
|
path.resolveSymlinks(),
|
||||||
|
method,
|
||||||
|
HashAlgorithm::SHA256,
|
||||||
|
refs,
|
||||||
|
filter ? *filter.get() : defaultPathFilter,
|
||||||
|
state.repair);
|
||||||
if (expectedHash && expectedStorePath != dstPath)
|
if (expectedHash && expectedStorePath != dstPath)
|
||||||
state.error<EvalError>("store path mismatch in (possibly filtered) path added from '%s'", path)
|
state.error<EvalError>("store path mismatch in (possibly filtered) path added from '%s'", path)
|
||||||
.atPos(pos)
|
.atPos(pos)
|
||||||
|
|||||||
@@ -151,6 +151,11 @@ static void fetchTree(
|
|||||||
attrs.emplace("exportIgnore", Explicit<bool>{true});
|
attrs.emplace("exportIgnore", Explicit<bool>{true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fetchTree should fetch git repos with shallow = true by default
|
||||||
|
if (type == "git" && !params.isFetchGit && !attrs.contains("shallow")) {
|
||||||
|
attrs.emplace("shallow", Explicit<bool>{true});
|
||||||
|
}
|
||||||
|
|
||||||
if (!params.allowNameArgument)
|
if (!params.allowNameArgument)
|
||||||
if (auto nameIter = attrs.find("name"); nameIter != attrs.end())
|
if (auto nameIter = attrs.find("name"); nameIter != attrs.end())
|
||||||
state.error<EvalError>("argument 'name' isn’t supported in call to '%s'", fetcher)
|
state.error<EvalError>("argument 'name' isn’t supported in call to '%s'", fetcher)
|
||||||
@@ -362,13 +367,10 @@ void prim_fetchFinalTree(EvalState & state, const PosIdx pos, Value ** args, Val
|
|||||||
}
|
}
|
||||||
|
|
||||||
static RegisterPrimOp primop_fetchFinalTree({
|
static RegisterPrimOp primop_fetchFinalTree({
|
||||||
.name = "__fetchFinalTree",
|
.name = "fetchFinalTree",
|
||||||
.args = {"input"},
|
.args = {"input"},
|
||||||
.doc = R"(
|
|
||||||
Like `fetchTree`, but does not return any additional fetcher attributes (like `revCount`).
|
|
||||||
This allows inputs to be substituted if `narHash` is specified.
|
|
||||||
)",
|
|
||||||
.fun = prim_fetchFinalTree,
|
.fun = prim_fetchFinalTree,
|
||||||
|
.internal = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
static void fetch(
|
static void fetch(
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ struct CacheImpl : Cache
|
|||||||
{
|
{
|
||||||
auto state(_state.lock());
|
auto state(_state.lock());
|
||||||
|
|
||||||
auto dbPath = getCacheDir() + "/fetcher-cache-v4.sqlite";
|
auto dbPath = (getCacheDir() / "fetcher-cache-v4.sqlite").string();
|
||||||
createDirs(dirOf(dbPath));
|
createDirs(dirOf(dbPath));
|
||||||
|
|
||||||
state->db = SQLite(dbPath);
|
state->db = SQLite(dbPath);
|
||||||
|
|||||||
@@ -269,10 +269,24 @@ void Input::checkLocks(Input specified, Input & result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto prevLastModified = specified.getLastModified()) {
|
||||||
|
if (result.getLastModified() != prevLastModified)
|
||||||
|
throw Error(
|
||||||
|
"'lastModified' attribute mismatch in input '%s', expected %d, got %d",
|
||||||
|
result.to_string(),
|
||||||
|
*prevLastModified,
|
||||||
|
result.getLastModified().value_or(-1));
|
||||||
|
}
|
||||||
|
|
||||||
if (auto prevRev = specified.getRev()) {
|
if (auto prevRev = specified.getRev()) {
|
||||||
if (result.getRev() != prevRev)
|
if (result.getRev() != prevRev)
|
||||||
throw Error("'rev' attribute mismatch in input '%s', expected %s", result.to_string(), prevRev->gitRev());
|
throw Error("'rev' attribute mismatch in input '%s', expected %s", result.to_string(), prevRev->gitRev());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto prevRevCount = specified.getRevCount()) {
|
||||||
|
if (result.getRevCount() != prevRevCount)
|
||||||
|
throw Error("'revCount' attribute mismatch in input '%s', expected %d", result.to_string(), *prevRevCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<ref<SourceAccessor>, Input> Input::getAccessor(const Settings & settings, Store & store) const
|
std::pair<ref<SourceAccessor>, Input> Input::getAccessor(const Settings & settings, Store & store) const
|
||||||
|
|||||||
@@ -268,10 +268,10 @@ void Fetch::fetch(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Path cacheDir = getCacheDir() + "/git-lfs";
|
std::filesystem::path cacheDir = getCacheDir() / "git-lfs";
|
||||||
std::string key = hashString(HashAlgorithm::SHA256, pointerFilePath.rel()).to_string(HashFormat::Base16, false)
|
std::string key = hashString(HashAlgorithm::SHA256, pointerFilePath.rel()).to_string(HashFormat::Base16, false)
|
||||||
+ "/" + pointer->oid;
|
+ "/" + pointer->oid;
|
||||||
Path cachePath = cacheDir + "/" + key;
|
std::filesystem::path cachePath = cacheDir / key;
|
||||||
if (pathExists(cachePath)) {
|
if (pathExists(cachePath)) {
|
||||||
debug("using cache entry %s -> %s", key, cachePath);
|
debug("using cache entry %s -> %s", key, cachePath);
|
||||||
sink(readFile(cachePath));
|
sink(readFile(cachePath));
|
||||||
@@ -302,8 +302,8 @@ void Fetch::fetch(
|
|||||||
downloadToSink(ourl, authHeader, sink, sha256, size);
|
downloadToSink(ourl, authHeader, sink, sha256, size);
|
||||||
|
|
||||||
debug("creating cache entry %s -> %s", key, cachePath);
|
debug("creating cache entry %s -> %s", key, cachePath);
|
||||||
if (!pathExists(dirOf(cachePath)))
|
if (!pathExists(cachePath.parent_path()))
|
||||||
createDirs(dirOf(cachePath));
|
createDirs(cachePath.parent_path());
|
||||||
writeFile(cachePath, sink.s);
|
writeFile(cachePath, sink.s);
|
||||||
|
|
||||||
debug("%s fetched with git-lfs", pointerFilePath);
|
debug("%s fetched with git-lfs", pointerFilePath);
|
||||||
|
|||||||
+143
-50
@@ -24,6 +24,7 @@
|
|||||||
#include <git2/indexer.h>
|
#include <git2/indexer.h>
|
||||||
#include <git2/object.h>
|
#include <git2/object.h>
|
||||||
#include <git2/odb.h>
|
#include <git2/odb.h>
|
||||||
|
#include <git2/odb_backend.h>
|
||||||
#include <git2/refs.h>
|
#include <git2/refs.h>
|
||||||
#include <git2/remote.h>
|
#include <git2/remote.h>
|
||||||
#include <git2/repository.h>
|
#include <git2/repository.h>
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
#include <git2/status.h>
|
#include <git2/status.h>
|
||||||
#include <git2/submodule.h>
|
#include <git2/submodule.h>
|
||||||
#include <git2/sys/odb_backend.h>
|
#include <git2/sys/odb_backend.h>
|
||||||
|
#include <git2/sys/repository.h>
|
||||||
#include <git2/sys/mempack.h>
|
#include <git2/sys/mempack.h>
|
||||||
#include <git2/tag.h>
|
#include <git2/tag.h>
|
||||||
#include <git2/tree.h>
|
#include <git2/tree.h>
|
||||||
@@ -89,7 +91,7 @@ typedef std::unique_ptr<git_odb, Deleter<git_odb_free>> ObjectDb;
|
|||||||
typedef std::unique_ptr<git_packbuilder, Deleter<git_packbuilder_free>> PackBuilder;
|
typedef std::unique_ptr<git_packbuilder, Deleter<git_packbuilder_free>> PackBuilder;
|
||||||
typedef std::unique_ptr<git_indexer, Deleter<git_indexer_free>> Indexer;
|
typedef std::unique_ptr<git_indexer, Deleter<git_indexer_free>> Indexer;
|
||||||
|
|
||||||
Hash toHash(const git_oid & oid)
|
static Hash toHash(const git_oid & oid)
|
||||||
{
|
{
|
||||||
#ifdef GIT_EXPERIMENTAL_SHA256
|
#ifdef GIT_EXPERIMENTAL_SHA256
|
||||||
assert(oid.type == GIT_OID_SHA1);
|
assert(oid.type == GIT_OID_SHA1);
|
||||||
@@ -108,7 +110,7 @@ static void initLibGit2()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
git_oid hashToOID(const Hash & hash)
|
static git_oid hashToOID(const Hash & hash)
|
||||||
{
|
{
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
if (git_oid_fromstr(&oid, hash.gitRev().c_str()))
|
if (git_oid_fromstr(&oid, hash.gitRev().c_str()))
|
||||||
@@ -116,7 +118,7 @@ git_oid hashToOID(const Hash & hash)
|
|||||||
return oid;
|
return oid;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object lookupObject(git_repository * repo, const git_oid & oid, git_object_t type = GIT_OBJECT_ANY)
|
static Object lookupObject(git_repository * repo, const git_oid & oid, git_object_t type = GIT_OBJECT_ANY)
|
||||||
{
|
{
|
||||||
Object obj;
|
Object obj;
|
||||||
if (git_object_lookup(Setter(obj), repo, &oid, type)) {
|
if (git_object_lookup(Setter(obj), repo, &oid, type)) {
|
||||||
@@ -127,7 +129,7 @@ Object lookupObject(git_repository * repo, const git_oid & oid, git_object_t typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T peelObject(git_object * obj, git_object_t type)
|
static T peelObject(git_object * obj, git_object_t type)
|
||||||
{
|
{
|
||||||
T obj2;
|
T obj2;
|
||||||
if (git_object_peel((git_object **) (typename T::pointer *) Setter(obj2), obj, type)) {
|
if (git_object_peel((git_object **) (typename T::pointer *) Setter(obj2), obj, type)) {
|
||||||
@@ -138,7 +140,7 @@ T peelObject(git_object * obj, git_object_t type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T dupObject(typename T::pointer obj)
|
static T dupObject(typename T::pointer obj)
|
||||||
{
|
{
|
||||||
T obj2;
|
T obj2;
|
||||||
if (git_object_dup((git_object **) (typename T::pointer *) Setter(obj2), (git_object *) obj))
|
if (git_object_dup((git_object **) (typename T::pointer *) Setter(obj2), (git_object *) obj))
|
||||||
@@ -206,11 +208,11 @@ static void initRepoAtomically(std::filesystem::path & path, bool bare)
|
|||||||
if (pathExists(path.string()))
|
if (pathExists(path.string()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Path tmpDir = createTempDir(os_string_to_string(PathViewNG{std::filesystem::path(path).parent_path()}));
|
std::filesystem::path tmpDir = createTempDir(path.parent_path());
|
||||||
AutoDelete delTmpDir(tmpDir, true);
|
AutoDelete delTmpDir(tmpDir, true);
|
||||||
Repository tmpRepo;
|
Repository tmpRepo;
|
||||||
|
|
||||||
if (git_repository_init(Setter(tmpRepo), tmpDir.c_str(), bare))
|
if (git_repository_init(Setter(tmpRepo), tmpDir.string().c_str(), bare))
|
||||||
throw Error("creating Git repository %s: %s", path, git_error_last()->message);
|
throw Error("creating Git repository %s: %s", path, git_error_last()->message);
|
||||||
try {
|
try {
|
||||||
std::filesystem::rename(tmpDir, path);
|
std::filesystem::rename(tmpDir, path);
|
||||||
@@ -245,9 +247,15 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
|||||||
* In-memory object store for efficient batched writing to packfiles.
|
* In-memory object store for efficient batched writing to packfiles.
|
||||||
* Owned by `repo`.
|
* Owned by `repo`.
|
||||||
*/
|
*/
|
||||||
git_odb_backend * mempack_backend;
|
git_odb_backend * mempackBackend = nullptr;
|
||||||
|
|
||||||
GitRepoImpl(std::filesystem::path _path, bool create, bool bare)
|
/**
|
||||||
|
* On-disk packfile object store.
|
||||||
|
* Owned by `repo`.
|
||||||
|
*/
|
||||||
|
git_odb_backend * packBackend = nullptr;
|
||||||
|
|
||||||
|
GitRepoImpl(std::filesystem::path _path, bool create, bool bare, bool packfilesOnly = false)
|
||||||
: path(std::move(_path))
|
: path(std::move(_path))
|
||||||
, bare(bare)
|
, bare(bare)
|
||||||
{
|
{
|
||||||
@@ -258,15 +266,39 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
|||||||
throw Error("opening Git repository %s: %s", path, git_error_last()->message);
|
throw Error("opening Git repository %s: %s", path, git_error_last()->message);
|
||||||
|
|
||||||
ObjectDb odb;
|
ObjectDb odb;
|
||||||
if (git_repository_odb(Setter(odb), repo.get()))
|
if (packfilesOnly) {
|
||||||
throw Error("getting Git object database: %s", git_error_last()->message);
|
/* Create a fresh object database because by default the repo also
|
||||||
|
loose object backends. We are not using any of those for the
|
||||||
|
tarball cache, but libgit2 still does a bunch of unnecessary
|
||||||
|
syscalls that always fail with ENOENT. NOTE: We are only creating
|
||||||
|
a libgit2 object here and not modifying the repo. Think of this as
|
||||||
|
enabling the specific backend.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (git_odb_new(Setter(odb)))
|
||||||
|
throw Error("creating Git object database: %s", git_error_last()->message);
|
||||||
|
|
||||||
|
if (git_odb_backend_pack(&packBackend, (path / "objects").string().c_str()))
|
||||||
|
throw Error("creating pack backend: %s", git_error_last()->message);
|
||||||
|
|
||||||
|
if (git_odb_add_backend(odb.get(), packBackend, 1))
|
||||||
|
throw Error("adding pack backend to Git object database: %s", git_error_last()->message);
|
||||||
|
} else {
|
||||||
|
if (git_repository_odb(Setter(odb), repo.get()))
|
||||||
|
throw Error("getting Git object database: %s", git_error_last()->message);
|
||||||
|
}
|
||||||
|
|
||||||
// mempack_backend will be owned by the repository, so we are not expected to free it ourselves.
|
// mempack_backend will be owned by the repository, so we are not expected to free it ourselves.
|
||||||
if (git_mempack_new(&mempack_backend))
|
if (git_mempack_new(&mempackBackend))
|
||||||
throw Error("creating mempack backend: %s", git_error_last()->message);
|
throw Error("creating mempack backend: %s", git_error_last()->message);
|
||||||
|
|
||||||
if (git_odb_add_backend(odb.get(), mempack_backend, 999))
|
if (git_odb_add_backend(odb.get(), mempackBackend, 999))
|
||||||
throw Error("adding mempack backend to Git object database: %s", git_error_last()->message);
|
throw Error("adding mempack backend to Git object database: %s", git_error_last()->message);
|
||||||
|
|
||||||
|
if (packfilesOnly) {
|
||||||
|
if (git_repository_set_odb(repo.get(), odb.get()))
|
||||||
|
throw Error("setting Git object database: %s", git_error_last()->message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
operator git_repository *()
|
operator git_repository *()
|
||||||
@@ -287,7 +319,7 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
|||||||
git_packbuilder_set_threads(packBuilder.get(), 0 /* autodetect */);
|
git_packbuilder_set_threads(packBuilder.get(), 0 /* autodetect */);
|
||||||
|
|
||||||
packBuilderContext.handleException(
|
packBuilderContext.handleException(
|
||||||
"preparing packfile", git_mempack_write_thin_pack(mempack_backend, packBuilder.get()));
|
"preparing packfile", git_mempack_write_thin_pack(mempackBackend, packBuilder.get()));
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
packBuilderContext.handleException("writing packfile", git_packbuilder_write_buf(&buf, packBuilder.get()));
|
packBuilderContext.handleException("writing packfile", git_packbuilder_write_buf(&buf, packBuilder.get()));
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
@@ -320,7 +352,7 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
|||||||
if (git_indexer_commit(indexer.get(), &stats))
|
if (git_indexer_commit(indexer.get(), &stats))
|
||||||
throw Error("committing git packfile index: %s", git_error_last()->message);
|
throw Error("committing git packfile index: %s", git_error_last()->message);
|
||||||
|
|
||||||
if (git_mempack_reset(mempack_backend))
|
if (git_mempack_reset(mempackBackend))
|
||||||
throw Error("resetting git mempack backend: %s", git_error_last()->message);
|
throw Error("resetting git mempack backend: %s", git_error_last()->message);
|
||||||
|
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
@@ -553,27 +585,6 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
|||||||
|
|
||||||
ref<GitFileSystemObjectSink> getFileSystemObjectSink() override;
|
ref<GitFileSystemObjectSink> getFileSystemObjectSink() override;
|
||||||
|
|
||||||
static int sidebandProgressCallback(const char * str, int len, void * payload)
|
|
||||||
{
|
|
||||||
auto act = (Activity *) payload;
|
|
||||||
act->result(resFetchStatus, trim(std::string_view(str, len)));
|
|
||||||
return getInterrupted() ? -1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int transferProgressCallback(const git_indexer_progress * stats, void * payload)
|
|
||||||
{
|
|
||||||
auto act = (Activity *) payload;
|
|
||||||
act->result(
|
|
||||||
resFetchStatus,
|
|
||||||
fmt("%d/%d objects received, %d/%d deltas indexed, %s",
|
|
||||||
stats->received_objects,
|
|
||||||
stats->total_objects,
|
|
||||||
stats->indexed_deltas,
|
|
||||||
stats->total_deltas,
|
|
||||||
renderSize(stats->received_bytes)));
|
|
||||||
return getInterrupted() ? -1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fetch(const std::string & url, const std::string & refspec, bool shallow) override
|
void fetch(const std::string & url, const std::string & refspec, bool shallow) override
|
||||||
{
|
{
|
||||||
Activity act(*logger, lvlTalkative, actFetchTree, fmt("fetching Git repository '%s'", url));
|
Activity act(*logger, lvlTalkative, actFetchTree, fmt("fetching Git repository '%s'", url));
|
||||||
@@ -701,9 +712,9 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ref<GitRepo> GitRepo::openRepo(const std::filesystem::path & path, bool create, bool bare)
|
ref<GitRepo> GitRepo::openRepo(const std::filesystem::path & path, bool create, bool bare, bool packfilesOnly)
|
||||||
{
|
{
|
||||||
return make_ref<GitRepoImpl>(path, create, bare);
|
return make_ref<GitRepoImpl>(path, create, bare, packfilesOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1052,6 +1063,18 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink
|
|||||||
|
|
||||||
std::vector<PendingDir> pendingDirs;
|
std::vector<PendingDir> pendingDirs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporary buffer used by createRegularFile for storing small file contents.
|
||||||
|
*/
|
||||||
|
std::string regularFileContentsBuffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If repo has a non-null packBackend, this has a copy of the refresh function
|
||||||
|
* from the backend virtual table. This is needed to restore it after we've flushed
|
||||||
|
* the sink. We modify it to avoid unnecessary I/O on non-existent oids.
|
||||||
|
*/
|
||||||
|
decltype(::git_odb_backend::refresh) packfileOdbRefresh = nullptr;
|
||||||
|
|
||||||
void pushBuilder(std::string name)
|
void pushBuilder(std::string name)
|
||||||
{
|
{
|
||||||
const git_tree_entry * entry;
|
const git_tree_entry * entry;
|
||||||
@@ -1077,6 +1100,29 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink
|
|||||||
GitFileSystemObjectSinkImpl(ref<GitRepoImpl> repo)
|
GitFileSystemObjectSinkImpl(ref<GitRepoImpl> repo)
|
||||||
: repo(repo)
|
: repo(repo)
|
||||||
{
|
{
|
||||||
|
/* Monkey-patching the pack backend to only read the pack directory
|
||||||
|
once. Otherwise it will do a readdir for each added oid when it's
|
||||||
|
not found and that translates to ~6 syscalls. Since we are never
|
||||||
|
writing pack files until flushing we can force the odb backend to
|
||||||
|
read the directory just once. It's very convenient that the vtable is
|
||||||
|
semi-public interface and is up for grabs.
|
||||||
|
|
||||||
|
This is purely an optimization for our use-case with a tarball cache.
|
||||||
|
libgit2 calls refresh() if the backend provides it when an oid isn't found.
|
||||||
|
We are only writing objects to a mempack (it has higher priority) and there isn't
|
||||||
|
a realistic use-case where a previously missing object would appear from thin air
|
||||||
|
on the disk (unless another process happens to be unpacking a similar tarball to
|
||||||
|
the cache at the same time, but that's a very unrealistic scenario).
|
||||||
|
*/
|
||||||
|
if (auto * backend = repo->packBackend) {
|
||||||
|
if (backend->refresh(backend)) /* Refresh just once manually. */
|
||||||
|
throw Error("refreshing packfiles: %s", git_error_last()->message);
|
||||||
|
/* Save the function pointer to restore it later in flush() and
|
||||||
|
unset it in the vtable. libgit2 does nothing if it's a nullptr:
|
||||||
|
https://github.com/libgit2/libgit2/blob/58d9363f02f1fa39e46d49b604f27008e75b72f2/src/libgit2/odb.c#L1922
|
||||||
|
*/
|
||||||
|
packfileOdbRefresh = std::exchange(backend->refresh, nullptr);
|
||||||
|
}
|
||||||
pushBuilder("");
|
pushBuilder("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1133,41 +1179,83 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink
|
|||||||
if (!prepareDirs(pathComponents, false))
|
if (!prepareDirs(pathComponents, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
git_writestream * stream = nullptr;
|
using WriteStream = std::unique_ptr<::git_writestream, decltype([](::git_writestream * stream) {
|
||||||
if (git_blob_create_from_stream(&stream, *repo, nullptr))
|
if (stream)
|
||||||
throw Error("creating a blob stream object: %s", git_error_last()->message);
|
stream->free(stream);
|
||||||
|
})>;
|
||||||
|
|
||||||
|
/* Maximum file size that gets buffered in memory before flushing to a WriteStream,
|
||||||
|
that's backed by a temporary objects/streamed_git2_* file. We should avoid that
|
||||||
|
for common cases, since creating (and deleting) a temporary file for each blob
|
||||||
|
is insanely expensive. */
|
||||||
|
static constexpr std::size_t maxBufferSize = 1024 * 1024; /* 1 MiB */
|
||||||
|
|
||||||
struct CRF : CreateRegularFileSink
|
struct CRF : CreateRegularFileSink
|
||||||
{
|
{
|
||||||
const CanonPath & path;
|
const CanonPath & path;
|
||||||
GitFileSystemObjectSinkImpl & back;
|
GitFileSystemObjectSinkImpl & back;
|
||||||
git_writestream * stream;
|
WriteStream stream;
|
||||||
|
std::string & contents;
|
||||||
bool executable = false;
|
bool executable = false;
|
||||||
|
|
||||||
CRF(const CanonPath & path, GitFileSystemObjectSinkImpl & back, git_writestream * stream)
|
CRF(const CanonPath & path, GitFileSystemObjectSinkImpl & back, std::string & regularFileContentsBuffer)
|
||||||
: path(path)
|
: path(path)
|
||||||
, back(back)
|
, back(back)
|
||||||
, stream(stream)
|
, stream(nullptr)
|
||||||
|
, contents(regularFileContentsBuffer)
|
||||||
{
|
{
|
||||||
|
contents.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeToStream(std::string_view data)
|
||||||
|
{
|
||||||
|
/* Lazily create the stream. */
|
||||||
|
if (!stream) {
|
||||||
|
::git_writestream * stream2 = nullptr;
|
||||||
|
if (git_blob_create_from_stream(&stream2, *back.repo, nullptr))
|
||||||
|
throw Error("creating a blob stream object: %s", git_error_last()->message);
|
||||||
|
stream = WriteStream{stream2};
|
||||||
|
assert(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream->write(stream.get(), data.data(), data.size()))
|
||||||
|
throw Error("writing a blob for tarball member '%s': %s", path, git_error_last()->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(std::string_view data) override
|
void operator()(std::string_view data) override
|
||||||
{
|
{
|
||||||
if (stream->write(stream, data.data(), data.size()))
|
/* Already in slow path. Just write to the slow stream. */
|
||||||
throw Error("writing a blob for tarball member '%s': %s", path, git_error_last()->message);
|
if (stream) {
|
||||||
|
writeToStream(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
contents += data;
|
||||||
|
if (contents.size() > maxBufferSize) {
|
||||||
|
writeToStream(contents); /* Will initialize stream. */
|
||||||
|
contents.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void isExecutable() override
|
void isExecutable() override
|
||||||
{
|
{
|
||||||
executable = true;
|
executable = true;
|
||||||
}
|
}
|
||||||
} crf{path, *this, stream};
|
} crf{path, *this, regularFileContentsBuffer};
|
||||||
|
|
||||||
func(crf);
|
func(crf);
|
||||||
|
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
if (git_blob_create_from_stream_commit(&oid, stream))
|
if (crf.stream) {
|
||||||
throw Error("creating a blob object for tarball member '%s': %s", path, git_error_last()->message);
|
/* Call .release(), since git_blob_create_from_stream_commit
|
||||||
|
acquires ownership and frees the stream. */
|
||||||
|
if (git_blob_create_from_stream_commit(&oid, crf.stream.release()))
|
||||||
|
throw Error("creating a blob object for '%s': %s", path, git_error_last()->message);
|
||||||
|
} else {
|
||||||
|
if (git_blob_create_from_buffer(&oid, *repo, crf.contents.data(), crf.contents.size()))
|
||||||
|
throw Error(
|
||||||
|
"creating a blob object for '%s' from in-memory buffer: %s", path, git_error_last()->message);
|
||||||
|
}
|
||||||
|
|
||||||
addToTree(*pathComponents.rbegin(), oid, crf.executable ? GIT_FILEMODE_BLOB_EXECUTABLE : GIT_FILEMODE_BLOB);
|
addToTree(*pathComponents.rbegin(), oid, crf.executable ? GIT_FILEMODE_BLOB_EXECUTABLE : GIT_FILEMODE_BLOB);
|
||||||
}
|
}
|
||||||
@@ -1251,6 +1339,11 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink
|
|||||||
|
|
||||||
auto [oid, _name] = popBuilder();
|
auto [oid, _name] = popBuilder();
|
||||||
|
|
||||||
|
if (auto * backend = repo->packBackend) {
|
||||||
|
/* We are done writing blobs, can restore refresh functionality. */
|
||||||
|
backend->refresh = packfileOdbRefresh;
|
||||||
|
}
|
||||||
|
|
||||||
repo->flush();
|
repo->flush();
|
||||||
|
|
||||||
return toHash(oid);
|
return toHash(oid);
|
||||||
@@ -1335,7 +1428,7 @@ namespace fetchers {
|
|||||||
ref<GitRepo> Settings::getTarballCache() const
|
ref<GitRepo> Settings::getTarballCache() const
|
||||||
{
|
{
|
||||||
static auto repoDir = std::filesystem::path(getCacheDir()) / "tarball-cache";
|
static auto repoDir = std::filesystem::path(getCacheDir()) / "tarball-cache";
|
||||||
return GitRepo::openRepo(repoDir, true, true);
|
return GitRepo::openRepo(repoDir, /*create=*/true, /*bare=*/true, /*packfilesOnly=*/true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace fetchers
|
} // namespace fetchers
|
||||||
|
|||||||
+25
-57
@@ -42,10 +42,10 @@ bool isCacheFileWithinTtl(time_t now, const struct stat & st)
|
|||||||
return st.st_mtime + static_cast<time_t>(settings.tarballTtl) > now;
|
return st.st_mtime + static_cast<time_t>(settings.tarballTtl) > now;
|
||||||
}
|
}
|
||||||
|
|
||||||
Path getCachePath(std::string_view key, bool shallow)
|
std::filesystem::path getCachePath(std::string_view key, bool shallow)
|
||||||
{
|
{
|
||||||
return getCacheDir() + "/gitv3/" + hashString(HashAlgorithm::SHA256, key).to_string(HashFormat::Nix32, false)
|
return getCacheDir() / "gitv3"
|
||||||
+ (shallow ? "-shallow" : "");
|
/ (hashString(HashAlgorithm::SHA256, key).to_string(HashFormat::Nix32, false) + (shallow ? "-shallow" : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the name of the HEAD branch.
|
// Returns the name of the HEAD branch.
|
||||||
@@ -55,13 +55,13 @@ Path getCachePath(std::string_view key, bool shallow)
|
|||||||
//
|
//
|
||||||
// ref: refs/heads/main HEAD
|
// ref: refs/heads/main HEAD
|
||||||
// ...
|
// ...
|
||||||
std::optional<std::string> readHead(const Path & path)
|
std::optional<std::string> readHead(const std::filesystem::path & path)
|
||||||
{
|
{
|
||||||
auto [status, output] = runProgram(
|
auto [status, output] = runProgram(
|
||||||
RunOptions{
|
RunOptions{
|
||||||
.program = "git",
|
.program = "git",
|
||||||
// FIXME: use 'HEAD' to avoid returning all refs
|
// FIXME: use 'HEAD' to avoid returning all refs
|
||||||
.args = {"ls-remote", "--symref", path},
|
.args = {"ls-remote", "--symref", path.string()},
|
||||||
.isInteractive = true,
|
.isInteractive = true,
|
||||||
});
|
});
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
@@ -86,9 +86,9 @@ std::optional<std::string> readHead(const Path & path)
|
|||||||
// Persist the HEAD ref from the remote repo in the local cached repo.
|
// Persist the HEAD ref from the remote repo in the local cached repo.
|
||||||
bool storeCachedHead(const std::string & actualUrl, bool shallow, const std::string & headRef)
|
bool storeCachedHead(const std::string & actualUrl, bool shallow, const std::string & headRef)
|
||||||
{
|
{
|
||||||
Path cacheDir = getCachePath(actualUrl, shallow);
|
std::filesystem::path cacheDir = getCachePath(actualUrl, shallow);
|
||||||
try {
|
try {
|
||||||
runProgram("git", true, {"-C", cacheDir, "--git-dir", ".", "symbolic-ref", "--", "HEAD", headRef});
|
runProgram("git", true, {"-C", cacheDir.string(), "--git-dir", ".", "symbolic-ref", "--", "HEAD", headRef});
|
||||||
} catch (ExecError & e) {
|
} catch (ExecError & e) {
|
||||||
if (
|
if (
|
||||||
#ifndef WIN32 // TODO abstract over exit status handling on Windows
|
#ifndef WIN32 // TODO abstract over exit status handling on Windows
|
||||||
@@ -109,13 +109,13 @@ std::optional<std::string> readHeadCached(const std::string & actualUrl, bool sh
|
|||||||
{
|
{
|
||||||
// Create a cache path to store the branch of the HEAD ref. Append something
|
// Create a cache path to store the branch of the HEAD ref. Append something
|
||||||
// in front of the URL to prevent collision with the repository itself.
|
// in front of the URL to prevent collision with the repository itself.
|
||||||
Path cacheDir = getCachePath(actualUrl, shallow);
|
std::filesystem::path cacheDir = getCachePath(actualUrl, shallow);
|
||||||
Path headRefFile = cacheDir + "/HEAD";
|
std::filesystem::path headRefFile = cacheDir / "HEAD";
|
||||||
|
|
||||||
time_t now = time(0);
|
time_t now = time(0);
|
||||||
struct stat st;
|
struct stat st;
|
||||||
std::optional<std::string> cachedRef;
|
std::optional<std::string> cachedRef;
|
||||||
if (stat(headRefFile.c_str(), &st) == 0) {
|
if (stat(headRefFile.string().c_str(), &st) == 0) {
|
||||||
cachedRef = readHead(cacheDir);
|
cachedRef = readHead(cacheDir);
|
||||||
if (cachedRef != std::nullopt && *cachedRef != gitInitialBranch && isCacheFileWithinTtl(now, st)) {
|
if (cachedRef != std::nullopt && *cachedRef != gitInitialBranch && isCacheFileWithinTtl(now, st)) {
|
||||||
debug("using cached HEAD ref '%s' for repo '%s'", *cachedRef, actualUrl);
|
debug("using cached HEAD ref '%s' for repo '%s'", *cachedRef, actualUrl);
|
||||||
@@ -450,7 +450,7 @@ struct GitInputScheme : InputScheme
|
|||||||
if (input.getRev())
|
if (input.getRev())
|
||||||
throw UnimplementedError("cloning a specific revision is not implemented");
|
throw UnimplementedError("cloning a specific revision is not implemented");
|
||||||
|
|
||||||
args.push_back(destDir);
|
args.push_back(destDir.string());
|
||||||
|
|
||||||
runProgram("git", true, args, {}, true);
|
runProgram("git", true, args, {}, true);
|
||||||
}
|
}
|
||||||
@@ -778,16 +778,6 @@ struct GitInputScheme : InputScheme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Decide whether we can do a shallow clone, which is faster. This is possible if the user explicitly specified
|
|
||||||
* `shallow = true`, or if we already have a `revCount`.
|
|
||||||
*/
|
|
||||||
bool canDoShallow(const Input & input) const
|
|
||||||
{
|
|
||||||
bool shallow = getShallowAttr(input);
|
|
||||||
return shallow || input.getRevCount().has_value();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<ref<SourceAccessor>, Input>
|
std::pair<ref<SourceAccessor>, Input>
|
||||||
getAccessorFromCommit(const Settings & settings, Store & store, RepoInfo & repoInfo, Input && input) const
|
getAccessorFromCommit(const Settings & settings, Store & store, RepoInfo & repoInfo, Input && input) const
|
||||||
{
|
{
|
||||||
@@ -796,7 +786,7 @@ struct GitInputScheme : InputScheme
|
|||||||
auto origRev = input.getRev();
|
auto origRev = input.getRev();
|
||||||
|
|
||||||
auto originalRef = input.getRef();
|
auto originalRef = input.getRef();
|
||||||
bool shallow = canDoShallow(input);
|
bool shallow = getShallowAttr(input);
|
||||||
auto ref = originalRef ? *originalRef : getDefaultRef(repoInfo, shallow);
|
auto ref = originalRef ? *originalRef : getDefaultRef(repoInfo, shallow);
|
||||||
input.attrs.insert_or_assign("ref", ref);
|
input.attrs.insert_or_assign("ref", ref);
|
||||||
|
|
||||||
@@ -807,27 +797,11 @@ struct GitInputScheme : InputScheme
|
|||||||
if (!input.getRev())
|
if (!input.getRev())
|
||||||
input.attrs.insert_or_assign("rev", GitRepo::openRepo(repoDir)->resolveRef(ref).gitRev());
|
input.attrs.insert_or_assign("rev", GitRepo::openRepo(repoDir)->resolveRef(ref).gitRev());
|
||||||
} else {
|
} else {
|
||||||
auto rev = input.getRev();
|
|
||||||
auto repoUrl = std::get<ParsedURL>(repoInfo.location);
|
auto repoUrl = std::get<ParsedURL>(repoInfo.location);
|
||||||
std::filesystem::path cacheDir = getCachePath(repoUrl.to_string(), shallow);
|
std::filesystem::path cacheDir = getCachePath(repoUrl.to_string(), shallow);
|
||||||
repoDir = cacheDir;
|
repoDir = cacheDir;
|
||||||
repoInfo.gitDir = ".";
|
repoInfo.gitDir = ".";
|
||||||
|
|
||||||
/* If shallow = false, but we have a non-shallow repo that already contains the desired rev, then use that
|
|
||||||
* repo instead. */
|
|
||||||
std::filesystem::path cacheDirNonShallow = getCachePath(repoUrl.to_string(), false);
|
|
||||||
if (rev && shallow && pathExists(cacheDirNonShallow)) {
|
|
||||||
auto nonShallowRepo = GitRepo::openRepo(cacheDirNonShallow, true, true);
|
|
||||||
if (nonShallowRepo->hasObject(*rev)) {
|
|
||||||
debug(
|
|
||||||
"using non-shallow cached repo for '%s' since it contains rev '%s'",
|
|
||||||
repoUrl.to_string(),
|
|
||||||
rev->gitRev());
|
|
||||||
repoDir = cacheDirNonShallow;
|
|
||||||
goto have_rev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::filesystem::create_directories(cacheDir.parent_path());
|
std::filesystem::create_directories(cacheDir.parent_path());
|
||||||
PathLocks cacheDirLock({cacheDir.string()});
|
PathLocks cacheDirLock({cacheDir.string()});
|
||||||
|
|
||||||
@@ -843,7 +817,7 @@ struct GitInputScheme : InputScheme
|
|||||||
|
|
||||||
/* If a rev was specified, we need to fetch if it's not in the
|
/* If a rev was specified, we need to fetch if it's not in the
|
||||||
repo. */
|
repo. */
|
||||||
if (rev) {
|
if (auto rev = input.getRev()) {
|
||||||
doFetch = !repo->hasObject(*rev);
|
doFetch = !repo->hasObject(*rev);
|
||||||
} else {
|
} else {
|
||||||
if (getAllRefsAttr(input)) {
|
if (getAllRefsAttr(input)) {
|
||||||
@@ -857,11 +831,12 @@ struct GitInputScheme : InputScheme
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (doFetch) {
|
if (doFetch) {
|
||||||
|
bool shallow = getShallowAttr(input);
|
||||||
try {
|
try {
|
||||||
auto fetchRef = getAllRefsAttr(input) ? "refs/*:refs/*"
|
auto fetchRef = getAllRefsAttr(input) ? "refs/*:refs/*"
|
||||||
: input.getRev() ? input.getRev()->gitRev()
|
: input.getRev() ? input.getRev()->gitRev()
|
||||||
: ref.compare(0, 5, "refs/") == 0 ? fmt("%1%:%1%", ref)
|
: ref.compare(0, 5, "refs/") == 0 ? fmt("%1%:%1%", ref)
|
||||||
: ref == "HEAD" ? ref
|
: ref == "HEAD" ? "HEAD:HEAD"
|
||||||
: fmt("%1%:%1%", "refs/heads/" + ref);
|
: fmt("%1%:%1%", "refs/heads/" + ref);
|
||||||
|
|
||||||
repo->fetch(repoUrl.to_string(), fetchRef, shallow);
|
repo->fetch(repoUrl.to_string(), fetchRef, shallow);
|
||||||
@@ -884,7 +859,7 @@ struct GitInputScheme : InputScheme
|
|||||||
warn("could not update cached head '%s' for '%s'", ref, repoInfo.locationToArg());
|
warn("could not update cached head '%s' for '%s'", ref, repoInfo.locationToArg());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rev) {
|
if (auto rev = input.getRev()) {
|
||||||
if (!repo->hasObject(*rev))
|
if (!repo->hasObject(*rev))
|
||||||
throw Error(
|
throw Error(
|
||||||
"Cannot find Git revision '%s' in ref '%s' of repository '%s'! "
|
"Cannot find Git revision '%s' in ref '%s' of repository '%s'! "
|
||||||
@@ -901,30 +876,23 @@ struct GitInputScheme : InputScheme
|
|||||||
// the remainder
|
// the remainder
|
||||||
}
|
}
|
||||||
|
|
||||||
have_rev:
|
|
||||||
auto repo = GitRepo::openRepo(repoDir);
|
auto repo = GitRepo::openRepo(repoDir);
|
||||||
|
|
||||||
|
auto isShallow = repo->isShallow();
|
||||||
|
|
||||||
|
if (isShallow && !getShallowAttr(input))
|
||||||
|
throw Error(
|
||||||
|
"'%s' is a shallow Git repository, but shallow repositories are only allowed when `shallow = true;` is specified",
|
||||||
|
repoInfo.locationToArg());
|
||||||
|
|
||||||
// FIXME: check whether rev is an ancestor of ref?
|
// FIXME: check whether rev is an ancestor of ref?
|
||||||
|
|
||||||
auto rev = *input.getRev();
|
auto rev = *input.getRev();
|
||||||
|
|
||||||
/* Skip lastModified computation if it's already supplied by the caller.
|
input.attrs.insert_or_assign("lastModified", getLastModified(settings, repoInfo, repoDir, rev));
|
||||||
We don't care if they specify an incorrect value; it doesn't
|
|
||||||
matter for security, unlike narHash. */
|
|
||||||
if (!input.attrs.contains("lastModified"))
|
|
||||||
input.attrs.insert_or_assign("lastModified", getLastModified(settings, repoInfo, repoDir, rev));
|
|
||||||
|
|
||||||
/* Like lastModified, skip revCount if supplied by the caller. */
|
|
||||||
if (!shallow && !input.attrs.contains("revCount")) {
|
|
||||||
auto isShallow = repo->isShallow();
|
|
||||||
|
|
||||||
if (isShallow && !shallow)
|
|
||||||
throw Error(
|
|
||||||
"'%s' is a shallow Git repository, but shallow repositories are only allowed when `shallow = true;` is specified",
|
|
||||||
repoInfo.locationToArg());
|
|
||||||
|
|
||||||
|
if (!getShallowAttr(input))
|
||||||
input.attrs.insert_or_assign("revCount", getRevCount(settings, repoInfo, repoDir, rev));
|
input.attrs.insert_or_assign("revCount", getRevCount(settings, repoInfo, repoDir, rev));
|
||||||
}
|
|
||||||
|
|
||||||
printTalkative("using revision %s of repo '%s'", rev.gitRev(), repoInfo.locationToArg());
|
printTalkative("using revision %s of repo '%s'", rev.gitRev(), repoInfo.locationToArg());
|
||||||
|
|
||||||
|
|||||||
+33
-30
@@ -41,18 +41,16 @@ struct GitArchiveInputScheme : InputScheme
|
|||||||
/* This ignores empty path segments for back-compat. Older versions used a tokenizeString here. */
|
/* This ignores empty path segments for back-compat. Older versions used a tokenizeString here. */
|
||||||
auto path = url.pathSegments(/*skipEmpty=*/true) | std::ranges::to<std::vector<std::string>>();
|
auto path = url.pathSegments(/*skipEmpty=*/true) | std::ranges::to<std::vector<std::string>>();
|
||||||
|
|
||||||
std::optional<Hash> rev;
|
std::optional<std::string> rev;
|
||||||
std::optional<std::string> ref;
|
std::optional<std::string> ref;
|
||||||
std::optional<std::string> host_url;
|
std::optional<std::string> host_url;
|
||||||
|
|
||||||
auto size = path.size();
|
auto size = path.size();
|
||||||
if (size == 3) {
|
if (size == 3) {
|
||||||
if (std::regex_match(path[2], revRegex))
|
if (std::regex_match(path[2], revRegex))
|
||||||
rev = Hash::parseAny(path[2], HashAlgorithm::SHA1);
|
rev = path[2];
|
||||||
else if (isLegalRefName(path[2]))
|
|
||||||
ref = path[2];
|
|
||||||
else
|
else
|
||||||
throw BadURL("in URL '%s', '%s' is not a commit hash or branch/tag name", url, path[2]);
|
ref = path[2];
|
||||||
} else if (size > 3) {
|
} else if (size > 3) {
|
||||||
std::string rs;
|
std::string rs;
|
||||||
for (auto i = std::next(path.begin(), 2); i != path.end(); i++) {
|
for (auto i = std::next(path.begin(), 2); i != path.end(); i++) {
|
||||||
@@ -61,12 +59,7 @@ struct GitArchiveInputScheme : InputScheme
|
|||||||
rs += "/";
|
rs += "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ref = rs;
|
||||||
if (isLegalRefName(rs)) {
|
|
||||||
ref = rs;
|
|
||||||
} else {
|
|
||||||
throw BadURL("in URL '%s', '%s' is not a branch/tag name", url, rs);
|
|
||||||
}
|
|
||||||
} else if (size < 2)
|
} else if (size < 2)
|
||||||
throw BadURL("URL '%s' is invalid", url);
|
throw BadURL("URL '%s' is invalid", url);
|
||||||
|
|
||||||
@@ -74,40 +67,32 @@ struct GitArchiveInputScheme : InputScheme
|
|||||||
if (name == "rev") {
|
if (name == "rev") {
|
||||||
if (rev)
|
if (rev)
|
||||||
throw BadURL("URL '%s' contains multiple commit hashes", url);
|
throw BadURL("URL '%s' contains multiple commit hashes", url);
|
||||||
rev = Hash::parseAny(value, HashAlgorithm::SHA1);
|
rev = value;
|
||||||
} else if (name == "ref") {
|
} else if (name == "ref") {
|
||||||
if (!isLegalRefName(value))
|
|
||||||
throw BadURL("URL '%s' contains an invalid branch/tag name", url);
|
|
||||||
if (ref)
|
if (ref)
|
||||||
throw BadURL("URL '%s' contains multiple branch/tag names", url);
|
throw BadURL("URL '%s' contains multiple branch/tag names", url);
|
||||||
ref = value;
|
ref = value;
|
||||||
} else if (name == "host") {
|
} else if (name == "host")
|
||||||
if (!std::regex_match(value, hostRegex))
|
|
||||||
throw BadURL("URL '%s' contains an invalid instance host", url);
|
|
||||||
host_url = value;
|
host_url = value;
|
||||||
}
|
|
||||||
// FIXME: barf on unsupported attributes
|
// FIXME: barf on unsupported attributes
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ref && rev)
|
Attrs attrs;
|
||||||
throw BadURL("URL '%s' contains both a commit hash and a branch/tag name %s %s", url, *ref, rev->gitRev());
|
attrs.insert_or_assign("type", std::string{schemeName()});
|
||||||
|
attrs.insert_or_assign("owner", path[0]);
|
||||||
Input input{};
|
attrs.insert_or_assign("repo", path[1]);
|
||||||
input.attrs.insert_or_assign("type", std::string{schemeName()});
|
|
||||||
input.attrs.insert_or_assign("owner", path[0]);
|
|
||||||
input.attrs.insert_or_assign("repo", path[1]);
|
|
||||||
if (rev)
|
if (rev)
|
||||||
input.attrs.insert_or_assign("rev", rev->gitRev());
|
attrs.insert_or_assign("rev", *rev);
|
||||||
if (ref)
|
if (ref)
|
||||||
input.attrs.insert_or_assign("ref", *ref);
|
attrs.insert_or_assign("ref", *ref);
|
||||||
if (host_url)
|
if (host_url)
|
||||||
input.attrs.insert_or_assign("host", *host_url);
|
attrs.insert_or_assign("host", *host_url);
|
||||||
|
|
||||||
auto narHash = url.query.find("narHash");
|
auto narHash = url.query.find("narHash");
|
||||||
if (narHash != url.query.end())
|
if (narHash != url.query.end())
|
||||||
input.attrs.insert_or_assign("narHash", narHash->second);
|
attrs.insert_or_assign("narHash", narHash->second);
|
||||||
|
|
||||||
return input;
|
return inputFromAttrs(settings, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<std::string, AttributeInfo> & allowedAttrs() const override
|
const std::map<std::string, AttributeInfo> & allowedAttrs() const override
|
||||||
@@ -154,6 +139,24 @@ struct GitArchiveInputScheme : InputScheme
|
|||||||
getStrAttr(attrs, "owner");
|
getStrAttr(attrs, "owner");
|
||||||
getStrAttr(attrs, "repo");
|
getStrAttr(attrs, "repo");
|
||||||
|
|
||||||
|
auto ref = maybeGetStrAttr(attrs, "ref");
|
||||||
|
auto rev = maybeGetStrAttr(attrs, "rev");
|
||||||
|
if (ref && rev)
|
||||||
|
throw BadURL(
|
||||||
|
"input %s contains both a commit hash ('%s') and a branch/tag name ('%s')",
|
||||||
|
attrsToJSON(attrs),
|
||||||
|
*rev,
|
||||||
|
*ref);
|
||||||
|
|
||||||
|
if (rev)
|
||||||
|
Hash::parseAny(*rev, HashAlgorithm::SHA1);
|
||||||
|
|
||||||
|
if (ref && !isLegalRefName(*ref))
|
||||||
|
throw BadURL("input %s contains an invalid branch/tag name", attrsToJSON(attrs));
|
||||||
|
|
||||||
|
if (auto host = maybeGetStrAttr(attrs, "host"); host && !std::regex_match(*host, hostRegex))
|
||||||
|
throw BadURL("input %s contains an invalid instance host", attrsToJSON(attrs));
|
||||||
|
|
||||||
Input input{};
|
Input input{};
|
||||||
input.attrs = attrs;
|
input.attrs = attrs;
|
||||||
return input;
|
return input;
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ struct GitRepo
|
|||||||
{
|
{
|
||||||
virtual ~GitRepo() {}
|
virtual ~GitRepo() {}
|
||||||
|
|
||||||
static ref<GitRepo> openRepo(const std::filesystem::path & path, bool create = false, bool bare = false);
|
static ref<GitRepo>
|
||||||
|
openRepo(const std::filesystem::path & path, bool create = false, bool bare = false, bool packfilesOnly = false);
|
||||||
|
|
||||||
virtual uint64_t getRevCount(const Hash & rev) = 0;
|
virtual uint64_t getRevCount(const Hash & rev) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ struct Registry
|
|||||||
|
|
||||||
static std::shared_ptr<Registry> read(const Settings & settings, const SourcePath & path, RegistryType type);
|
static std::shared_ptr<Registry> read(const Settings & settings, const SourcePath & path, RegistryType type);
|
||||||
|
|
||||||
void write(const Path & path);
|
void write(const std::filesystem::path & path);
|
||||||
|
|
||||||
void add(const Input & from, const Input & to, const Attrs & extraAttrs);
|
void add(const Input & from, const Input & to, const Attrs & extraAttrs);
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@ typedef std::vector<std::shared_ptr<Registry>> Registries;
|
|||||||
|
|
||||||
std::shared_ptr<Registry> getUserRegistry(const Settings & settings);
|
std::shared_ptr<Registry> getUserRegistry(const Settings & settings);
|
||||||
|
|
||||||
std::shared_ptr<Registry> getCustomRegistry(const Settings & settings, const Path & p);
|
std::shared_ptr<Registry> getCustomRegistry(const Settings & settings, const std::filesystem::path & p);
|
||||||
|
|
||||||
Path getUserRegistryPath();
|
std::filesystem::path getUserRegistryPath();
|
||||||
|
|
||||||
Registries getRegistries(const Settings & settings, Store & store);
|
Registries getRegistries(const Settings & settings, Store & store);
|
||||||
|
|
||||||
|
|||||||
@@ -213,11 +213,11 @@ struct MercurialInputScheme : InputScheme
|
|||||||
runHg({"status", "-R", actualUrl, "--clean", "--modified", "--added", "--no-status", "--print0"}),
|
runHg({"status", "-R", actualUrl, "--clean", "--modified", "--added", "--no-status", "--print0"}),
|
||||||
"\0"s);
|
"\0"s);
|
||||||
|
|
||||||
Path actualPath(absPath(actualUrl));
|
std::filesystem::path actualPath(absPath(actualUrl));
|
||||||
|
|
||||||
PathFilter filter = [&](const Path & p) -> bool {
|
PathFilter filter = [&](const Path & p) -> bool {
|
||||||
assert(hasPrefix(p, actualPath));
|
assert(hasPrefix(p, actualPath.string()));
|
||||||
std::string file(p, actualPath.size() + 1);
|
std::string file(p, actualPath.string().size() + 1);
|
||||||
|
|
||||||
auto st = lstat(p);
|
auto st = lstat(p);
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ struct MercurialInputScheme : InputScheme
|
|||||||
|
|
||||||
auto storePath = store.addToStore(
|
auto storePath = store.addToStore(
|
||||||
input.getName(),
|
input.getName(),
|
||||||
{getFSSourceAccessor(), CanonPath(actualPath)},
|
{getFSSourceAccessor(), CanonPath(actualPath.string())},
|
||||||
ContentAddressMethod::Raw::NixArchive,
|
ContentAddressMethod::Raw::NixArchive,
|
||||||
HashAlgorithm::SHA256,
|
HashAlgorithm::SHA256,
|
||||||
{},
|
{},
|
||||||
@@ -275,35 +275,34 @@ struct MercurialInputScheme : InputScheme
|
|||||||
return makeResult(res->value, res->storePath);
|
return makeResult(res->value, res->storePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Path cacheDir =
|
std::filesystem::path cacheDir =
|
||||||
fmt("%s/hg/%s",
|
getCacheDir() / "hg" / hashString(HashAlgorithm::SHA256, actualUrl).to_string(HashFormat::Nix32, false);
|
||||||
getCacheDir(),
|
|
||||||
hashString(HashAlgorithm::SHA256, actualUrl).to_string(HashFormat::Nix32, false));
|
|
||||||
|
|
||||||
/* If this is a commit hash that we already have, we don't
|
/* If this is a commit hash that we already have, we don't
|
||||||
have to pull again. */
|
have to pull again. */
|
||||||
if (!(input.getRev() && pathExists(cacheDir)
|
if (!(input.getRev() && pathExists(cacheDir)
|
||||||
&& runProgram(hgOptions({"log", "-R", cacheDir, "-r", input.getRev()->gitRev(), "--template", "1"}))
|
&& runProgram(
|
||||||
|
hgOptions({"log", "-R", cacheDir.string(), "-r", input.getRev()->gitRev(), "--template", "1"}))
|
||||||
.second
|
.second
|
||||||
== "1")) {
|
== "1")) {
|
||||||
Activity act(*logger, lvlTalkative, actUnknown, fmt("fetching Mercurial repository '%s'", actualUrl));
|
Activity act(*logger, lvlTalkative, actUnknown, fmt("fetching Mercurial repository '%s'", actualUrl));
|
||||||
|
|
||||||
if (pathExists(cacheDir)) {
|
if (pathExists(cacheDir)) {
|
||||||
try {
|
try {
|
||||||
runHg({"pull", "-R", cacheDir, "--", actualUrl});
|
runHg({"pull", "-R", cacheDir.string(), "--", actualUrl});
|
||||||
} catch (ExecError & e) {
|
} catch (ExecError & e) {
|
||||||
auto transJournal = cacheDir + "/.hg/store/journal";
|
auto transJournal = cacheDir / ".hg" / "store" / "journal";
|
||||||
/* hg throws "abandoned transaction" error only if this file exists */
|
/* hg throws "abandoned transaction" error only if this file exists */
|
||||||
if (pathExists(transJournal)) {
|
if (pathExists(transJournal)) {
|
||||||
runHg({"recover", "-R", cacheDir});
|
runHg({"recover", "-R", cacheDir.string()});
|
||||||
runHg({"pull", "-R", cacheDir, "--", actualUrl});
|
runHg({"pull", "-R", cacheDir.string(), "--", actualUrl});
|
||||||
} else {
|
} else {
|
||||||
throw ExecError(e.status, "'hg pull' %s", statusToString(e.status));
|
throw ExecError(e.status, "'hg pull' %s", statusToString(e.status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createDirs(dirOf(cacheDir));
|
createDirs(dirOf(cacheDir.string()));
|
||||||
runHg({"clone", "--noupdate", "--", actualUrl, cacheDir});
|
runHg({"clone", "--noupdate", "--", actualUrl, cacheDir.string()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +310,7 @@ struct MercurialInputScheme : InputScheme
|
|||||||
auto tokens = tokenizeString<std::vector<std::string>>(runHg(
|
auto tokens = tokenizeString<std::vector<std::string>>(runHg(
|
||||||
{"log",
|
{"log",
|
||||||
"-R",
|
"-R",
|
||||||
cacheDir,
|
cacheDir.string(),
|
||||||
"-r",
|
"-r",
|
||||||
input.getRev() ? input.getRev()->gitRev() : *input.getRef(),
|
input.getRev() ? input.getRev()->gitRev() : *input.getRef(),
|
||||||
"--template",
|
"--template",
|
||||||
@@ -328,14 +327,14 @@ struct MercurialInputScheme : InputScheme
|
|||||||
if (auto res = settings.getCache()->lookupStorePath(revInfoKey(rev), store))
|
if (auto res = settings.getCache()->lookupStorePath(revInfoKey(rev), store))
|
||||||
return makeResult(res->value, res->storePath);
|
return makeResult(res->value, res->storePath);
|
||||||
|
|
||||||
Path tmpDir = createTempDir();
|
std::filesystem::path tmpDir = createTempDir();
|
||||||
AutoDelete delTmpDir(tmpDir, true);
|
AutoDelete delTmpDir(tmpDir, true);
|
||||||
|
|
||||||
runHg({"archive", "-R", cacheDir, "-r", rev.gitRev(), tmpDir});
|
runHg({"archive", "-R", cacheDir.string(), "-r", rev.gitRev(), tmpDir.string()});
|
||||||
|
|
||||||
deletePath(tmpDir + "/.hg_archival.txt");
|
deletePath(tmpDir / ".hg_archival.txt");
|
||||||
|
|
||||||
auto storePath = store.addToStore(name, {getFSSourceAccessor(), CanonPath(tmpDir)});
|
auto storePath = store.addToStore(name, {getFSSourceAccessor(), CanonPath(tmpDir.string())});
|
||||||
|
|
||||||
Attrs infoAttrs({
|
Attrs infoAttrs({
|
||||||
{"revCount", (uint64_t) revCount},
|
{"revCount", (uint64_t) revCount},
|
||||||
|
|||||||
+12
-12
@@ -56,7 +56,7 @@ std::shared_ptr<Registry> Registry::read(const Settings & settings, const Source
|
|||||||
return registry;
|
return registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Registry::write(const Path & path)
|
void Registry::write(const std::filesystem::path & path)
|
||||||
{
|
{
|
||||||
nlohmann::json arr;
|
nlohmann::json arr;
|
||||||
for (auto & entry : entries) {
|
for (auto & entry : entries) {
|
||||||
@@ -74,7 +74,7 @@ void Registry::write(const Path & path)
|
|||||||
json["version"] = 2;
|
json["version"] = 2;
|
||||||
json["flakes"] = std::move(arr);
|
json["flakes"] = std::move(arr);
|
||||||
|
|
||||||
createDirs(dirOf(path));
|
createDirs(path.parent_path());
|
||||||
writeFile(path, json.dump(2));
|
writeFile(path, json.dump(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,38 +90,38 @@ void Registry::remove(const Input & input)
|
|||||||
entries.end());
|
entries.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
static Path getSystemRegistryPath()
|
static std::filesystem::path getSystemRegistryPath()
|
||||||
{
|
{
|
||||||
return settings.nixConfDir + "/registry.json";
|
return settings.nixConfDir / "registry.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::shared_ptr<Registry> getSystemRegistry(const Settings & settings)
|
static std::shared_ptr<Registry> getSystemRegistry(const Settings & settings)
|
||||||
{
|
{
|
||||||
static auto systemRegistry = Registry::read(
|
static auto systemRegistry = Registry::read(
|
||||||
settings,
|
settings,
|
||||||
SourcePath{getFSSourceAccessor(), CanonPath{getSystemRegistryPath()}}.resolveSymlinks(),
|
SourcePath{getFSSourceAccessor(), CanonPath{getSystemRegistryPath().string()}}.resolveSymlinks(),
|
||||||
Registry::System);
|
Registry::System);
|
||||||
return systemRegistry;
|
return systemRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
Path getUserRegistryPath()
|
std::filesystem::path getUserRegistryPath()
|
||||||
{
|
{
|
||||||
return getConfigDir() + "/registry.json";
|
return getConfigDir() / "registry.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Registry> getUserRegistry(const Settings & settings)
|
std::shared_ptr<Registry> getUserRegistry(const Settings & settings)
|
||||||
{
|
{
|
||||||
static auto userRegistry = Registry::read(
|
static auto userRegistry = Registry::read(
|
||||||
settings,
|
settings,
|
||||||
SourcePath{getFSSourceAccessor(), CanonPath{getUserRegistryPath()}}.resolveSymlinks(),
|
SourcePath{getFSSourceAccessor(), CanonPath{getUserRegistryPath().string()}}.resolveSymlinks(),
|
||||||
Registry::User);
|
Registry::User);
|
||||||
return userRegistry;
|
return userRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Registry> getCustomRegistry(const Settings & settings, const Path & p)
|
std::shared_ptr<Registry> getCustomRegistry(const Settings & settings, const std::filesystem::path & p)
|
||||||
{
|
{
|
||||||
static auto customRegistry =
|
static auto customRegistry = Registry::read(
|
||||||
Registry::read(settings, SourcePath{getFSSourceAccessor(), CanonPath{p}}.resolveSymlinks(), Registry::Custom);
|
settings, SourcePath{getFSSourceAccessor(), CanonPath{p.string()}}.resolveSymlinks(), Registry::Custom);
|
||||||
return customRegistry;
|
return customRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ static std::shared_ptr<Registry> getGlobalRegistry(const Settings & settings, St
|
|||||||
if (!isAbsolute(path)) {
|
if (!isAbsolute(path)) {
|
||||||
auto storePath = downloadFile(store, settings, path, "flake-registry.json").storePath;
|
auto storePath = downloadFile(store, settings, path, "flake-registry.json").storePath;
|
||||||
if (auto store2 = dynamic_cast<LocalFSStore *>(&store))
|
if (auto store2 = dynamic_cast<LocalFSStore *>(&store))
|
||||||
store2->addPermRoot(storePath, getCacheDir() + "/flake-registry.json");
|
store2->addPermRoot(storePath, (getCacheDir() / "flake-registry.json").string());
|
||||||
return {store.requireStoreObjectAccessor(storePath)};
|
return {store.requireStoreObjectAccessor(storePath)};
|
||||||
} else {
|
} else {
|
||||||
return SourcePath{getFSSourceAccessor(), CanonPath{path}}.resolveSymlinks();
|
return SourcePath{getFSSourceAccessor(), CanonPath{path}}.resolveSymlinks();
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ TEST_F(nix_api_store_test, nix_api_load_flake)
|
|||||||
auto tmpDir = nix::createTempDir();
|
auto tmpDir = nix::createTempDir();
|
||||||
nix::AutoDelete delTmpDir(tmpDir, true);
|
nix::AutoDelete delTmpDir(tmpDir, true);
|
||||||
|
|
||||||
nix::writeFile(tmpDir + "/flake.nix", R"(
|
nix::writeFile(tmpDir / "flake.nix", R"(
|
||||||
{
|
{
|
||||||
outputs = { ... }: {
|
outputs = { ... }: {
|
||||||
hello = "potato";
|
hello = "potato";
|
||||||
@@ -121,7 +121,8 @@ TEST_F(nix_api_store_test, nix_api_load_flake)
|
|||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
ASSERT_NE(nullptr, parseFlags);
|
ASSERT_NE(nullptr, parseFlags);
|
||||||
|
|
||||||
auto r0 = nix_flake_reference_parse_flags_set_base_directory(ctx, parseFlags, tmpDir.c_str(), tmpDir.size());
|
auto r0 = nix_flake_reference_parse_flags_set_base_directory(
|
||||||
|
ctx, parseFlags, tmpDir.string().c_str(), tmpDir.string().size());
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
ASSERT_EQ(NIX_OK, r0);
|
ASSERT_EQ(NIX_OK, r0);
|
||||||
|
|
||||||
@@ -177,8 +178,8 @@ TEST_F(nix_api_store_test, nix_api_load_flake_with_flags)
|
|||||||
auto tmpDir = nix::createTempDir();
|
auto tmpDir = nix::createTempDir();
|
||||||
nix::AutoDelete delTmpDir(tmpDir, true);
|
nix::AutoDelete delTmpDir(tmpDir, true);
|
||||||
|
|
||||||
nix::createDirs(tmpDir + "/b");
|
nix::createDirs(tmpDir / "b");
|
||||||
nix::writeFile(tmpDir + "/b/flake.nix", R"(
|
nix::writeFile(tmpDir / "b" / "flake.nix", R"(
|
||||||
{
|
{
|
||||||
outputs = { ... }: {
|
outputs = { ... }: {
|
||||||
hello = "BOB";
|
hello = "BOB";
|
||||||
@@ -186,18 +187,18 @@ TEST_F(nix_api_store_test, nix_api_load_flake_with_flags)
|
|||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
nix::createDirs(tmpDir + "/a");
|
nix::createDirs(tmpDir / "a");
|
||||||
nix::writeFile(tmpDir + "/a/flake.nix", R"(
|
nix::writeFile(tmpDir / "a" / "flake.nix", R"(
|
||||||
{
|
{
|
||||||
inputs.b.url = ")" + tmpDir + R"(/b";
|
inputs.b.url = ")" + tmpDir.string() + R"(/b";
|
||||||
outputs = { b, ... }: {
|
outputs = { b, ... }: {
|
||||||
hello = b.hello;
|
hello = b.hello;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
nix::createDirs(tmpDir + "/c");
|
nix::createDirs(tmpDir / "c");
|
||||||
nix::writeFile(tmpDir + "/c/flake.nix", R"(
|
nix::writeFile(tmpDir / "c" / "flake.nix", R"(
|
||||||
{
|
{
|
||||||
outputs = { ... }: {
|
outputs = { ... }: {
|
||||||
hello = "Claire";
|
hello = "Claire";
|
||||||
@@ -230,7 +231,8 @@ TEST_F(nix_api_store_test, nix_api_load_flake_with_flags)
|
|||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
ASSERT_NE(nullptr, parseFlags);
|
ASSERT_NE(nullptr, parseFlags);
|
||||||
|
|
||||||
auto r0 = nix_flake_reference_parse_flags_set_base_directory(ctx, parseFlags, tmpDir.c_str(), tmpDir.size());
|
auto r0 = nix_flake_reference_parse_flags_set_base_directory(
|
||||||
|
ctx, parseFlags, tmpDir.string().c_str(), tmpDir.string().size());
|
||||||
assert_ctx_ok();
|
assert_ctx_ok();
|
||||||
ASSERT_EQ(NIX_OK, r0);
|
ASSERT_EQ(NIX_OK, r0);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ lockFileStr:
|
|||||||
# unlocked trees.
|
# unlocked trees.
|
||||||
overrides:
|
overrides:
|
||||||
|
|
||||||
|
# This is `prim_fetchFinalTree`.
|
||||||
|
fetchTreeFinal:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (builtins) mapAttrs;
|
inherit (builtins) mapAttrs;
|
||||||
|
|
||||||
@@ -49,7 +52,7 @@ let
|
|||||||
else
|
else
|
||||||
# FIXME: remove obsolete node.info.
|
# FIXME: remove obsolete node.info.
|
||||||
# Note: lock file entries are always final.
|
# Note: lock file entries are always final.
|
||||||
builtins.fetchFinalTree (node.info or { } // removeAttrs node.locked [ "dir" ]);
|
fetchTreeFinal (node.info or { } // removeAttrs node.locked [ "dir" ]);
|
||||||
|
|
||||||
subdir = overrides.${key}.dir or node.locked.dir or "";
|
subdir = overrides.${key}.dir or node.locked.dir or "";
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ namespace nix::flake {
|
|||||||
// setting name -> setting value -> allow or ignore.
|
// setting name -> setting value -> allow or ignore.
|
||||||
typedef std::map<std::string, std::map<std::string, bool>> TrustedList;
|
typedef std::map<std::string, std::map<std::string, bool>> TrustedList;
|
||||||
|
|
||||||
Path trustedListPath()
|
std::filesystem::path trustedListPath()
|
||||||
{
|
{
|
||||||
return getDataDir() + "/trusted-settings.json";
|
return getDataDir() / "trusted-settings.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
static TrustedList readTrustedList()
|
static TrustedList readTrustedList()
|
||||||
@@ -48,7 +48,7 @@ static TrustedList readTrustedList()
|
|||||||
static void writeTrustedList(const TrustedList & trustedList)
|
static void writeTrustedList(const TrustedList & trustedList)
|
||||||
{
|
{
|
||||||
auto path = trustedListPath();
|
auto path = trustedListPath();
|
||||||
createDirs(dirOf(path));
|
createDirs(path.parent_path());
|
||||||
writeFile(path, nlohmann::json(trustedList).dump());
|
writeFile(path, nlohmann::json(trustedList).dump());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -968,7 +968,10 @@ void callFlake(EvalState & state, const LockedFlake & lockedFlake, Value & vRes)
|
|||||||
auto vLocks = state.allocValue();
|
auto vLocks = state.allocValue();
|
||||||
vLocks->mkString(lockFileStr, state.mem);
|
vLocks->mkString(lockFileStr, state.mem);
|
||||||
|
|
||||||
Value * args[] = {vLocks, &vOverrides};
|
auto vFetchFinalTree = get(state.internalPrimOps, "fetchFinalTree");
|
||||||
|
assert(vFetchFinalTree);
|
||||||
|
|
||||||
|
Value * args[] = {vLocks, &vOverrides, *vFetchFinalTree};
|
||||||
state.callFunction(*vCallFlake, args, vRes, noPos);
|
state.callFunction(*vCallFlake, args, vRes, noPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ FlakeRef::resolve(const fetchers::Settings & fetchSettings, Store & store, fetch
|
|||||||
FlakeRef parseFlakeRef(
|
FlakeRef parseFlakeRef(
|
||||||
const fetchers::Settings & fetchSettings,
|
const fetchers::Settings & fetchSettings,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::optional<Path> & baseDir,
|
const std::optional<std::filesystem::path> & baseDir,
|
||||||
bool allowMissing,
|
bool allowMissing,
|
||||||
bool isFlake,
|
bool isFlake,
|
||||||
bool preserveRelativePaths)
|
bool preserveRelativePaths)
|
||||||
@@ -101,7 +101,7 @@ fromParsedURL(const fetchers::Settings & fetchSettings, ParsedURL && parsedURL,
|
|||||||
std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
|
std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
|
||||||
const fetchers::Settings & fetchSettings,
|
const fetchers::Settings & fetchSettings,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::optional<Path> & baseDir,
|
const std::optional<std::filesystem::path> & baseDir,
|
||||||
bool allowMissing,
|
bool allowMissing,
|
||||||
bool isFlake,
|
bool isFlake,
|
||||||
bool preserveRelativePaths)
|
bool preserveRelativePaths)
|
||||||
@@ -121,7 +121,7 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
|
|||||||
to 'baseDir'). If so, search upward to the root of the
|
to 'baseDir'). If so, search upward to the root of the
|
||||||
repo (i.e. the directory containing .git). */
|
repo (i.e. the directory containing .git). */
|
||||||
|
|
||||||
path = absPath(path, baseDir, true);
|
path = absPath(path, baseDir->string(), true);
|
||||||
|
|
||||||
if (isFlake) {
|
if (isFlake) {
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ parseFlakeIdRef(const fetchers::Settings & fetchSettings, const std::string & ur
|
|||||||
std::optional<std::pair<FlakeRef, std::string>> parseURLFlakeRef(
|
std::optional<std::pair<FlakeRef, std::string>> parseURLFlakeRef(
|
||||||
const fetchers::Settings & fetchSettings,
|
const fetchers::Settings & fetchSettings,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::optional<Path> & baseDir,
|
const std::optional<std::filesystem::path> & baseDir,
|
||||||
bool isFlake)
|
bool isFlake)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -252,7 +252,7 @@ std::optional<std::pair<FlakeRef, std::string>> parseURLFlakeRef(
|
|||||||
/* Here we know that the path must not contain encoded '/' or NUL bytes. */
|
/* Here we know that the path must not contain encoded '/' or NUL bytes. */
|
||||||
auto path = renderUrlPathEnsureLegal(parsed.path);
|
auto path = renderUrlPathEnsureLegal(parsed.path);
|
||||||
if (!isAbsolute(path))
|
if (!isAbsolute(path))
|
||||||
parsed.path = splitString<std::vector<std::string>>(absPath(path, *baseDir), "/");
|
parsed.path = splitString<std::vector<std::string>>(absPath(path, baseDir->string()), "/");
|
||||||
}
|
}
|
||||||
return fromParsedURL(fetchSettings, std::move(parsed), isFlake);
|
return fromParsedURL(fetchSettings, std::move(parsed), isFlake);
|
||||||
} catch (BadURL &) {
|
} catch (BadURL &) {
|
||||||
@@ -263,7 +263,7 @@ std::optional<std::pair<FlakeRef, std::string>> parseURLFlakeRef(
|
|||||||
std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
|
std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
|
||||||
const fetchers::Settings & fetchSettings,
|
const fetchers::Settings & fetchSettings,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::optional<Path> & baseDir,
|
const std::optional<std::filesystem::path> & baseDir,
|
||||||
bool allowMissing,
|
bool allowMissing,
|
||||||
bool isFlake,
|
bool isFlake,
|
||||||
bool preserveRelativePaths)
|
bool preserveRelativePaths)
|
||||||
@@ -347,7 +347,7 @@ FlakeRef FlakeRef::canonicalize() const
|
|||||||
std::tuple<FlakeRef, std::string, ExtendedOutputsSpec> parseFlakeRefWithFragmentAndExtendedOutputsSpec(
|
std::tuple<FlakeRef, std::string, ExtendedOutputsSpec> parseFlakeRefWithFragmentAndExtendedOutputsSpec(
|
||||||
const fetchers::Settings & fetchSettings,
|
const fetchers::Settings & fetchSettings,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::optional<Path> & baseDir,
|
const std::optional<std::filesystem::path> & baseDir,
|
||||||
bool allowMissing,
|
bool allowMissing,
|
||||||
bool isFlake)
|
bool isFlake)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ struct LockFlags
|
|||||||
/**
|
/**
|
||||||
* The path to a lock file to write to instead of the `flake.lock` file in the top-level flake
|
* The path to a lock file to write to instead of the `flake.lock` file in the top-level flake
|
||||||
*/
|
*/
|
||||||
std::optional<Path> outputLockFilePath;
|
std::optional<std::filesystem::path> outputLockFilePath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flake inputs to be overridden.
|
* Flake inputs to be overridden.
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ std::ostream & operator<<(std::ostream & str, const FlakeRef & flakeRef);
|
|||||||
FlakeRef parseFlakeRef(
|
FlakeRef parseFlakeRef(
|
||||||
const fetchers::Settings & fetchSettings,
|
const fetchers::Settings & fetchSettings,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::optional<Path> & baseDir = {},
|
const std::optional<std::filesystem::path> & baseDir = {},
|
||||||
bool allowMissing = false,
|
bool allowMissing = false,
|
||||||
bool isFlake = true,
|
bool isFlake = true,
|
||||||
bool preserveRelativePaths = false);
|
bool preserveRelativePaths = false);
|
||||||
@@ -106,7 +106,7 @@ FlakeRef parseFlakeRef(
|
|||||||
std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
|
std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
|
||||||
const fetchers::Settings & fetchSettings,
|
const fetchers::Settings & fetchSettings,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::optional<Path> & baseDir = {},
|
const std::optional<std::filesystem::path> & baseDir = {},
|
||||||
bool allowMissing = false,
|
bool allowMissing = false,
|
||||||
bool isFlake = true,
|
bool isFlake = true,
|
||||||
bool preserveRelativePaths = false);
|
bool preserveRelativePaths = false);
|
||||||
@@ -117,7 +117,7 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
|
|||||||
std::tuple<FlakeRef, std::string, ExtendedOutputsSpec> parseFlakeRefWithFragmentAndExtendedOutputsSpec(
|
std::tuple<FlakeRef, std::string, ExtendedOutputsSpec> parseFlakeRefWithFragmentAndExtendedOutputsSpec(
|
||||||
const fetchers::Settings & fetchSettings,
|
const fetchers::Settings & fetchSettings,
|
||||||
const std::string & url,
|
const std::string & url,
|
||||||
const std::optional<Path> & baseDir = {},
|
const std::optional<std::filesystem::path> & baseDir = {},
|
||||||
bool allowMissing = false,
|
bool allowMissing = false,
|
||||||
bool isFlake = true);
|
bool isFlake = true);
|
||||||
|
|
||||||
|
|||||||
Loaded 100 of 346 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user