2024-03-29 21:31:37 +01:00
|
|
|
nix_env_for_docs = {
|
|
|
|
'HOME': '/dummy',
|
|
|
|
'NIX_CONF_DIR': '/dummy',
|
|
|
|
'NIX_SSL_CERT_FILE': '/dummy/no-ca-bundle.crt',
|
|
|
|
'NIX_STATE_DIR': '/dummy',
|
|
|
|
'NIX_CONFIG': 'cores = 0',
|
|
|
|
}
|
|
|
|
|
|
|
|
nix_for_docs = [ nix, '--experimental-features', 'nix-command' ]
|
2024-04-09 05:43:38 +02:00
|
|
|
nix_eval_for_docs_common = nix_for_docs + [
|
2024-03-29 21:31:37 +01:00
|
|
|
'eval',
|
|
|
|
'-I', 'nix/corepkgs=corepkgs',
|
|
|
|
'--store', 'dummy://',
|
|
|
|
'--impure',
|
|
|
|
]
|
2024-04-09 05:43:38 +02:00
|
|
|
nix_eval_for_docs = nix_eval_for_docs_common + '--raw'
|
2024-03-29 21:31:37 +01:00
|
|
|
|
2024-04-08 21:44:40 +02:00
|
|
|
conf_file_json = custom_target(
|
2024-03-29 21:31:37 +01:00
|
|
|
command : nix_for_docs + [ 'show-config', '--json' ],
|
|
|
|
capture : true,
|
|
|
|
output : 'conf-file.json',
|
|
|
|
env : nix_env_for_docs,
|
|
|
|
)
|
|
|
|
|
|
|
|
nix_conf_file_md_body = custom_target(
|
|
|
|
command : nix_eval_for_docs + [
|
|
|
|
'--expr',
|
|
|
|
'(import @INPUT0@).showSettings { inlineHTML = true; } (builtins.fromJSON (builtins.readFile @INPUT1@))',
|
|
|
|
],
|
|
|
|
capture : true,
|
|
|
|
input : [
|
|
|
|
'utils.nix',
|
2024-04-08 21:44:40 +02:00
|
|
|
conf_file_json,
|
2024-03-29 21:31:37 +01:00
|
|
|
],
|
|
|
|
output : 'conf-file.md.body',
|
|
|
|
env : nix_env_for_docs,
|
|
|
|
)
|
|
|
|
|
|
|
|
nix_conf_file_md = custom_target(
|
|
|
|
command : [ 'cat', '@INPUT@' ],
|
|
|
|
capture : true,
|
|
|
|
input : [
|
2024-04-08 21:44:40 +02:00
|
|
|
'src/command-ref/conf-file.md',
|
2024-03-29 21:31:37 +01:00
|
|
|
nix_conf_file_md_body,
|
|
|
|
],
|
|
|
|
output : 'conf-file.md',
|
|
|
|
)
|
|
|
|
|
|
|
|
nix_exp_features_json = custom_target(
|
|
|
|
command : [ nix, '__dump-xp-features' ],
|
|
|
|
capture : true,
|
|
|
|
output : 'xp-features.json',
|
|
|
|
)
|
2024-04-08 21:44:40 +02:00
|
|
|
|
|
|
|
language_json = custom_target(
|
|
|
|
command: [nix, '__dump-language'],
|
|
|
|
output : 'language.json',
|
|
|
|
capture : true,
|
|
|
|
env : nix_env_for_docs,
|
|
|
|
)
|
|
|
|
|
|
|
|
nix3_cli_json = custom_target(
|
|
|
|
command : [ nix, '__dump-cli' ],
|
|
|
|
capture : true,
|
|
|
|
output : 'nix.json',
|
2024-04-10 22:47:04 +02:00
|
|
|
env : nix_env_for_docs,
|
2024-04-08 21:44:40 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
generate_manual_deps = files(
|
|
|
|
'generate-deps.py',
|
|
|
|
)
|
|
|
|
|
|
|
|
# Generates builtins.md and builtin-constants.md.
|
|
|
|
subdir('src/language')
|
|
|
|
# Generates new-cli pages, experimental-features-shortlist.md, and conf-file.md.
|
|
|
|
subdir('src/command-ref')
|
|
|
|
# Generates experimental-feature-descriptions.md.
|
|
|
|
subdir('src/contributing')
|
|
|
|
# Generates rl-next-generated.md.
|
|
|
|
subdir('src/release-notes')
|
|
|
|
|
|
|
|
manual = custom_target(
|
|
|
|
'manual',
|
|
|
|
command : [
|
|
|
|
bash,
|
|
|
|
'-euo', 'pipefail',
|
|
|
|
'-c',
|
|
|
|
'''
|
|
|
|
@0@ @INPUT0@ @CURRENT_SOURCE_DIR@ > @DEPFILE@
|
|
|
|
cd @SOURCE_ROOT@
|
|
|
|
@1@ build doc/manual -d @2@ | { grep -Fv "because fragment resolution isn't implemented" || :; }
|
|
|
|
rm -rf @2@/manual
|
|
|
|
mv @2@/html @2@/manual
|
|
|
|
find @2@/manual -iname meson.build -delete
|
|
|
|
'''.format(
|
|
|
|
python.full_path(),
|
|
|
|
mdbook.full_path(),
|
|
|
|
meson.current_build_dir(),
|
|
|
|
),
|
2024-03-29 21:31:37 +01:00
|
|
|
],
|
|
|
|
input : [
|
2024-04-08 21:44:40 +02:00
|
|
|
generate_manual_deps,
|
|
|
|
'book.toml',
|
|
|
|
'anchors.jq',
|
|
|
|
'custom.css',
|
|
|
|
nix3_cli_files,
|
|
|
|
experimental_features_shortlist_md,
|
|
|
|
experimental_feature_descriptions_md,
|
|
|
|
conf_file_md,
|
|
|
|
builtins_md,
|
|
|
|
builtin_constants_md,
|
|
|
|
rl_next_generated,
|
2024-06-06 22:10:11 +02:00
|
|
|
nix,
|
2024-03-29 21:31:37 +01:00
|
|
|
],
|
2024-04-08 21:44:40 +02:00
|
|
|
output : [
|
|
|
|
'manual',
|
|
|
|
'markdown',
|
|
|
|
],
|
|
|
|
depfile : 'manual.d',
|
|
|
|
env : {
|
|
|
|
'RUST_LOG': 'info',
|
|
|
|
'MDBOOK_SUBSTITUTE_SEARCH': meson.current_build_dir() / 'src',
|
|
|
|
},
|
|
|
|
)
|
|
|
|
manual_html = manual[0]
|
|
|
|
manual_md = manual[1]
|
|
|
|
|
|
|
|
install_subdir(
|
|
|
|
manual_html.full_path(),
|
|
|
|
install_dir : datadir / 'doc/nix',
|
2024-03-29 21:31:37 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
nix_nested_manpages = [
|
|
|
|
[ 'nix-env',
|
|
|
|
[
|
|
|
|
'delete-generations',
|
|
|
|
'install',
|
|
|
|
'list-generations',
|
|
|
|
'query',
|
|
|
|
'rollback',
|
|
|
|
'set-flag',
|
|
|
|
'set',
|
|
|
|
'switch-generation',
|
|
|
|
'switch-profile',
|
|
|
|
'uninstall',
|
|
|
|
'upgrade',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
[ 'nix-store',
|
|
|
|
[
|
|
|
|
'add-fixed',
|
|
|
|
'add',
|
|
|
|
'delete',
|
|
|
|
'dump-db',
|
|
|
|
'dump',
|
|
|
|
'export',
|
|
|
|
'gc',
|
|
|
|
'generate-binary-cache-key',
|
|
|
|
'import',
|
|
|
|
'load-db',
|
|
|
|
'optimise',
|
|
|
|
'print-env',
|
|
|
|
'query',
|
|
|
|
'read-log',
|
|
|
|
'realise',
|
|
|
|
'repair-path',
|
|
|
|
'restore',
|
|
|
|
'serve',
|
|
|
|
'verify',
|
|
|
|
'verify-path',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
]
|
|
|
|
|
|
|
|
foreach command : nix_nested_manpages
|
|
|
|
foreach page : command[1]
|
2024-04-08 21:44:40 +02:00
|
|
|
title = command[0] + ' --' + page
|
|
|
|
section = '1'
|
2024-03-29 21:31:37 +01:00
|
|
|
custom_target(
|
|
|
|
command : [
|
|
|
|
'./render-manpage.sh',
|
2024-03-30 17:38:36 +01:00
|
|
|
'--out-no-smarty',
|
2024-04-08 21:44:40 +02:00
|
|
|
title,
|
|
|
|
section,
|
|
|
|
'@INPUT0@/command-ref' / command[0] / (page + '.md'),
|
|
|
|
'@OUTPUT0@',
|
|
|
|
],
|
|
|
|
input : [
|
|
|
|
manual_md,
|
2024-06-06 22:10:11 +02:00
|
|
|
nix,
|
2024-03-29 21:31:37 +01:00
|
|
|
],
|
|
|
|
output : command[0] + '-' + page + '.1',
|
|
|
|
install : true,
|
|
|
|
install_dir : mandir / 'man1',
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
endforeach
|
|
|
|
|
2024-03-29 23:13:40 +01:00
|
|
|
nix3_manpages = [
|
|
|
|
'nix3-build',
|
|
|
|
'nix3-bundle',
|
2023-11-27 19:41:30 +01:00
|
|
|
'nix3-config',
|
|
|
|
'nix3-config-show',
|
2024-03-29 23:13:40 +01:00
|
|
|
'nix3-copy',
|
|
|
|
'nix3-daemon',
|
|
|
|
'nix3-derivation-add',
|
|
|
|
'nix3-derivation',
|
|
|
|
'nix3-derivation-show',
|
|
|
|
'nix3-develop',
|
|
|
|
'nix3-doctor',
|
|
|
|
'nix3-edit',
|
|
|
|
'nix3-eval',
|
|
|
|
'nix3-flake-archive',
|
|
|
|
'nix3-flake-check',
|
|
|
|
'nix3-flake-clone',
|
|
|
|
'nix3-flake-info',
|
|
|
|
'nix3-flake-init',
|
|
|
|
'nix3-flake-lock',
|
|
|
|
'nix3-flake',
|
|
|
|
'nix3-flake-metadata',
|
|
|
|
'nix3-flake-new',
|
|
|
|
'nix3-flake-prefetch',
|
|
|
|
'nix3-flake-show',
|
|
|
|
'nix3-flake-update',
|
|
|
|
'nix3-fmt',
|
|
|
|
'nix3-hash-file',
|
|
|
|
'nix3-hash',
|
|
|
|
'nix3-hash-path',
|
|
|
|
'nix3-hash-to-base16',
|
|
|
|
'nix3-hash-to-base32',
|
|
|
|
'nix3-hash-to-base64',
|
|
|
|
'nix3-hash-to-sri',
|
|
|
|
'nix3-help',
|
|
|
|
'nix3-help-stores',
|
|
|
|
'nix3-key-convert-secret-to-public',
|
|
|
|
'nix3-key-generate-secret',
|
|
|
|
'nix3-key',
|
|
|
|
'nix3-log',
|
|
|
|
'nix3-nar-cat',
|
|
|
|
'nix3-nar-dump-path',
|
|
|
|
'nix3-nar-ls',
|
|
|
|
'nix3-nar',
|
|
|
|
'nix3-path-info',
|
|
|
|
'nix3-print-dev-env',
|
|
|
|
'nix3-profile-diff-closures',
|
|
|
|
'nix3-profile-history',
|
|
|
|
'nix3-profile-install',
|
|
|
|
'nix3-profile-list',
|
|
|
|
'nix3-profile',
|
|
|
|
'nix3-profile-remove',
|
|
|
|
'nix3-profile-rollback',
|
|
|
|
'nix3-profile-upgrade',
|
|
|
|
'nix3-profile-wipe-history',
|
|
|
|
'nix3-realisation-info',
|
|
|
|
'nix3-realisation',
|
|
|
|
'nix3-registry-add',
|
|
|
|
'nix3-registry-list',
|
|
|
|
'nix3-registry',
|
|
|
|
'nix3-registry-pin',
|
|
|
|
'nix3-registry-remove',
|
|
|
|
'nix3-repl',
|
|
|
|
'nix3-run',
|
|
|
|
'nix3-search',
|
|
|
|
'nix3-shell',
|
|
|
|
'nix3-store-add-file',
|
|
|
|
'nix3-store-add-path',
|
|
|
|
'nix3-store-cat',
|
|
|
|
'nix3-store-copy-log',
|
|
|
|
'nix3-store-copy-sigs',
|
|
|
|
'nix3-store-delete',
|
|
|
|
'nix3-store-diff-closures',
|
|
|
|
'nix3-store-dump-path',
|
|
|
|
'nix3-store-gc',
|
|
|
|
'nix3-store-ls',
|
|
|
|
'nix3-store-make-content-addressed',
|
|
|
|
'nix3-store',
|
|
|
|
'nix3-store-optimise',
|
|
|
|
'nix3-store-path-from-hash-part',
|
|
|
|
'nix3-store-ping',
|
|
|
|
'nix3-store-prefetch-file',
|
|
|
|
'nix3-store-repair',
|
|
|
|
'nix3-store-sign',
|
|
|
|
'nix3-store-verify',
|
|
|
|
'nix3-upgrade-nix',
|
|
|
|
'nix3-why-depends',
|
|
|
|
'nix',
|
|
|
|
]
|
|
|
|
|
|
|
|
foreach page : nix3_manpages
|
2024-04-08 21:44:40 +02:00
|
|
|
section = '1'
|
2024-03-29 23:13:40 +01:00
|
|
|
custom_target(
|
|
|
|
command : [
|
2024-04-08 21:44:40 +02:00
|
|
|
bash,
|
|
|
|
'@INPUT0@',
|
2024-03-29 23:13:40 +01:00
|
|
|
page,
|
2024-04-08 21:44:40 +02:00
|
|
|
section,
|
|
|
|
'@INPUT1@/command-ref/new-cli/@0@.md'.format(page),
|
2024-03-29 23:13:40 +01:00
|
|
|
'@OUTPUT@',
|
|
|
|
],
|
2024-04-08 21:44:40 +02:00
|
|
|
input : [
|
|
|
|
'render-manpage.sh',
|
|
|
|
manual_md,
|
2024-06-06 22:10:11 +02:00
|
|
|
nix,
|
2024-04-08 21:44:40 +02:00
|
|
|
],
|
2024-03-29 23:13:40 +01:00
|
|
|
output : page + '.1',
|
|
|
|
install : true,
|
|
|
|
install_dir : mandir / 'man1',
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
|
2024-03-29 21:31:37 +01:00
|
|
|
nix_manpages = [
|
|
|
|
[ 'nix-env', 1 ],
|
|
|
|
[ 'nix-store', 1 ],
|
|
|
|
[ 'nix-build', 1 ],
|
|
|
|
[ 'nix-shell', 1 ],
|
|
|
|
[ 'nix-instantiate', 1 ],
|
|
|
|
[ 'nix-collect-garbage', 1 ],
|
|
|
|
[ 'nix-prefetch-url', 1 ],
|
|
|
|
[ 'nix-channel', 1 ],
|
|
|
|
[ 'nix-hash', 1 ],
|
|
|
|
[ 'nix-copy-closure', 1 ],
|
2024-04-08 21:44:40 +02:00
|
|
|
[ 'nix.conf', 5, 'conf-file.md' ],
|
2024-03-29 21:31:37 +01:00
|
|
|
[ 'nix-daemon', 8 ],
|
2024-04-08 21:44:40 +02:00
|
|
|
[ 'nix-profiles', 5, 'files/profiles.md' ],
|
2024-03-29 21:31:37 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
foreach entry : nix_manpages
|
2024-04-08 21:44:40 +02:00
|
|
|
title = entry[0]
|
|
|
|
# nix.conf.5 and nix-profiles.5 are based off of conf-file.md and files/profiles.md,
|
|
|
|
# rather than a stem identical to its mdbook source.
|
|
|
|
# Therefore we use an optional third element of this array to override the name pattern
|
|
|
|
md_file = entry.get(2, title + '.md')
|
|
|
|
section = entry[1].to_string()
|
2024-03-29 21:31:37 +01:00
|
|
|
custom_target(
|
|
|
|
command : [
|
2024-04-08 21:44:40 +02:00
|
|
|
bash,
|
2024-03-29 21:31:37 +01:00
|
|
|
'@INPUT0@',
|
2024-04-08 21:44:40 +02:00
|
|
|
title,
|
|
|
|
section,
|
|
|
|
'@INPUT1@/command-ref/@0@'.format(md_file),
|
2024-03-29 21:31:37 +01:00
|
|
|
'@OUTPUT@',
|
|
|
|
],
|
|
|
|
input : [
|
2024-04-08 21:44:40 +02:00
|
|
|
'render-manpage.sh',
|
|
|
|
manual_md,
|
2024-03-29 21:31:37 +01:00
|
|
|
entry.get(3, []),
|
2024-06-06 22:10:11 +02:00
|
|
|
nix,
|
2024-03-29 21:31:37 +01:00
|
|
|
],
|
|
|
|
output : '@0@.@1@'.format(entry[0], entry[1]),
|
|
|
|
install : true,
|
|
|
|
install_dir : mandir / 'man@0@'.format(entry[1]),
|
|
|
|
)
|
|
|
|
endforeach
|