diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 984f9a9ea2d..a5005f8a002 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -1,36 +1,54 @@
---
name: Bug report
-about: Create a report to help us improve
+about: Report unexpected or incorrect behaviour
title: ''
labels: bug
assignees: ''
---
-**Describe the bug**
+## Describe the bug
-A clear and concise description of what the bug is.
+
-**Steps To Reproduce**
+## Steps To Reproduce
-1. Go to '...'
-2. Click on '....'
-3. Scroll down to '....'
-4. See error
+
-A clear and concise description of what you expected to happen.
+## Expected behavior
-**`nix-env --version` output**
+
-**Additional context**
+## Metadata
-Add any other context about the problem here.
+
-**Priorities**
+## Additional context
+
+
+
+## Checklist
+
+
+
+- [ ] checked [latest Nix manual] \([source])
+- [ ] checked [open bug issues and pull requests] for possible duplicates
+
+[latest Nix manual]: https://nixos.org/manual/nix/unstable/
+[source]: https://github.com/NixOS/nix/tree/master/doc/manual/source
+[open bug issues and pull requests]: https://github.com/NixOS/nix/labels/bug
+
+---
Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index 42c658b522f..c75a4695170 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -1,24 +1,39 @@
---
name: Feature request
-about: Suggest an idea for this project
+about: Suggest a new feature
title: ''
labels: feature
assignees: ''
---
-**Is your feature request related to a problem? Please describe.**
-A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+## Is your feature request related to a problem?
-**Describe the solution you'd like**
-A clear and concise description of what you want to happen.
+
-**Describe alternatives you've considered**
-A clear and concise description of any alternative solutions or features you've considered.
+## Proposed solution
-**Additional context**
-Add any other context or screenshots about the feature request here.
+
-**Priorities**
+## Alternative solutions
+
+
+
+## Additional context
+
+
+
+## Checklist
+
+
+
+- [ ] checked [latest Nix manual] \([source])
+- [ ] checked [open feature issues and pull requests] for possible duplicates
+
+[latest Nix manual]: https://nixos.org/manual/nix/unstable/
+[source]: https://github.com/NixOS/nix/tree/master/doc/manual/source
+[open feature issues and pull requests]: https://github.com/NixOS/nix/labels/feature
+
+---
Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
diff --git a/.github/ISSUE_TEMPLATE/installer.md b/.github/ISSUE_TEMPLATE/installer.md
index 3768a49c9a3..ed5e1ce87b9 100644
--- a/.github/ISSUE_TEMPLATE/installer.md
+++ b/.github/ISSUE_TEMPLATE/installer.md
@@ -23,14 +23,25 @@ assignees: ''
Output
-```log
+
-
+```log
```
-## Priorities
+## Checklist
+
+
+
+- [ ] checked [latest Nix manual] \([source])
+- [ ] checked [open installer issues and pull requests] for possible duplicates
+
+[latest Nix manual]: https://nixos.org/manual/nix/unstable/
+[source]: https://github.com/NixOS/nix/tree/master/doc/manual/source
+[open installer issues and pull requests]: https://github.com/NixOS/nix/labels/installer
+
+---
Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
diff --git a/.github/ISSUE_TEMPLATE/missing_documentation.md b/.github/ISSUE_TEMPLATE/missing_documentation.md
index be3f6af9764..6c334b72206 100644
--- a/.github/ISSUE_TEMPLATE/missing_documentation.md
+++ b/.github/ISSUE_TEMPLATE/missing_documentation.md
@@ -23,9 +23,9 @@ assignees: ''
- [ ] checked [open documentation issues and pull requests] for possible duplicates
[latest Nix manual]: https://nixos.org/manual/nix/unstable/
-[source]: https://github.com/NixOS/nix/tree/master/doc/manual/src
+[source]: https://github.com/NixOS/nix/tree/master/doc/manual/source
[open documentation issues and pull requests]: https://github.com/NixOS/nix/labels/documentation
-## Priorities
+---
Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 69da87db727..c6843d86fa7 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -17,10 +17,12 @@ so you understand the process and the expectations.
-->
-# Motivation
+## Motivation
+
-# Context
+## Context
+
@@ -29,7 +31,7 @@ so you understand the process and the expectations.
-# Priorities and Process
+---
Add :+1: to [pull requests you find important](https://github.com/NixOS/nix/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc).
diff --git a/.github/labeler.yml b/.github/labeler.yml
index 0e6fd3e2677..97ca9284d0e 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -1,7 +1,7 @@
"c api":
- changed-files:
- any-glob-to-any-file: "src/lib*-c/**/*"
- - any-glob-to-any-file: "test/unit/**/nix_api_*"
+ - any-glob-to-any-file: "src/*test*/**/nix_api_*"
- any-glob-to-any-file: "doc/external-api/**/*"
"contributor-experience":
@@ -9,7 +9,7 @@
- any-glob-to-any-file: "CONTRIBUTING.md"
- any-glob-to-any-file: ".github/ISSUE_TEMPLATE/*"
- any-glob-to-any-file: ".github/PULL_REQUEST_TEMPLATE.md"
- - any-glob-to-any-file: "doc/manual/src/contributing/**"
+ - any-glob-to-any-file: "doc/manual/source/contributing/**"
"documentation":
- changed-files:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 30272ecf161..9918875d9b0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- - uses: cachix/install-nix-action@V28
+ - uses: cachix/install-nix-action@v30
with:
# The sandbox would otherwise be disabled by default on Darwin
extra_nix_config: "sandbox = true"
@@ -89,7 +89,7 @@ jobs:
with:
fetch-depth: 0
- run: echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
- - uses: cachix/install-nix-action@V28
+ - uses: cachix/install-nix-action@v30
with:
install_url: https://releases.nixos.org/nix/nix-2.20.3/install
- uses: cachix/cachix-action@v15
@@ -112,7 +112,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
- - uses: cachix/install-nix-action@V28
+ - uses: cachix/install-nix-action@v30
with:
install_url: '${{needs.installer.outputs.installerURL}}'
install_options: "--tarball-url-prefix https://${{ env.CACHIX_NAME }}.cachix.org/serve"
@@ -128,7 +128,7 @@ jobs:
- run: exec bash -c "nix-channel --update && nix-env -iA nixpkgs.hello && hello"
docker_push_image:
- needs: [check_secrets, tests]
+ needs: [check_secrets, tests, vm_tests]
permissions:
contents: read
packages: write
@@ -142,7 +142,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- - uses: cachix/install-nix-action@V28
+ - uses: cachix/install-nix-action@v30
with:
install_url: https://releases.nixos.org/nix/nix-2.20.3/install
- run: echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
@@ -194,7 +194,13 @@ jobs:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- - run: nix build -L .#hydraJobs.tests.githubFlakes .#hydraJobs.tests.tarballFlakes .#hydraJobs.tests.functional_user
+ - run: |
+ nix build -L \
+ .#hydraJobs.tests.functional_user \
+ .#hydraJobs.tests.githubFlakes \
+ .#hydraJobs.tests.nix-docker \
+ .#hydraJobs.tests.tarballFlakes \
+ ;
flake_regressions:
needs: vm_tests
@@ -214,4 +220,4 @@ jobs:
path: flake-regressions/tests
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- - run: nix build --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH scripts/flake-regressions.sh
+ - run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH MAX_FLAKES=25 flake-regressions/eval-all.sh
diff --git a/.gitignore b/.gitignore
index a17b627f44a..de1183977b3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,17 +23,17 @@ perl/Makefile.config
/doc/manual/conf-file.json
/doc/manual/language.json
/doc/manual/xp-features.json
-/doc/manual/src/SUMMARY.md
-/doc/manual/src/SUMMARY-rl-next.md
-/doc/manual/src/store/types/*
-!/doc/manual/src/store/types/index.md.in
-/doc/manual/src/command-ref/new-cli
-/doc/manual/src/command-ref/conf-file.md
-/doc/manual/src/command-ref/experimental-features-shortlist.md
-/doc/manual/src/contributing/experimental-feature-descriptions.md
-/doc/manual/src/language/builtins.md
-/doc/manual/src/language/builtin-constants.md
-/doc/manual/src/release-notes/rl-next.md
+/doc/manual/source/SUMMARY.md
+/doc/manual/source/SUMMARY-rl-next.md
+/doc/manual/source/store/types/*
+!/doc/manual/source/store/types/index.md.in
+/doc/manual/source/command-ref/new-cli
+/doc/manual/source/command-ref/conf-file.md
+/doc/manual/source/command-ref/experimental-features-shortlist.md
+/doc/manual/source/contributing/experimental-feature-descriptions.md
+/doc/manual/source/language/builtins.md
+/doc/manual/source/language/builtin-constants.md
+/doc/manual/source/release-notes/rl-next.md
# /scripts/
/scripts/nix-profile.sh
@@ -49,22 +49,22 @@ perl/Makefile.config
/src/libexpr/parser-tab.output
/src/libexpr/nix.tbl
/src/libexpr/tests
-/tests/unit/libexpr/libnixexpr-tests
+/src/libexpr-tests/libnixexpr-tests
# /src/libfetchers
-/tests/unit/libfetchers/libnixfetchers-tests
+/src/libfetchers-tests/libnixfetchers-tests
# /src/libflake
-/tests/unit/libflake/libnixflake-tests
+/src/libflake-tests/libnixflake-tests
# /src/libstore/
*.gen.*
/src/libstore/tests
-/tests/unit/libstore/libnixstore-tests
+/src/libstore-tests/libnixstore-tests
# /src/libutil/
/src/libutil/tests
-/tests/unit/libutil/libnixutil-tests
+/src/libutil-tests/libnixutil-tests
/src/nix/nix
@@ -102,9 +102,6 @@ perl/Makefile.config
/tests/functional/restricted-innocent
/tests/functional/shell
/tests/functional/shell.drv
-/tests/functional/config.nix
-/tests/functional/ca/config.nix
-/tests/functional/dyn-drv/config.nix
/tests/functional/repl-result-out
/tests/functional/debugger-test-out
/tests/functional/test-libstoreconsumer/test-libstoreconsumer
diff --git a/.version b/.version
index 5c18f9195b5..7a25c70f90c 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-2.25.0
+2.26.0
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 56508df342f..ad867896269 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -79,7 +79,7 @@ Check out the [security policy](https://github.com/NixOS/nix/security/policy).
- Functional tests – [`tests/functional/**.sh`](./tests/functional)
- Unit tests – [`src/*/tests`](./src/)
- Integration tests – [`tests/nixos/*`](./tests/nixos)
- - [ ] User documentation in the [manual](./doc/manual/src)
+ - [ ] User documentation in the [manual](./doc/manual/source)
- [ ] API documentation in header files
- [ ] Code and comments are self-explanatory
- [ ] Commit message explains **why** the change was made
@@ -90,7 +90,7 @@ Check out the [security policy](https://github.com/NixOS/nix/security/policy).
## Making changes to the Nix manual
The Nix reference manual is hosted on https://nixos.org/manual/nix.
-The underlying source files are located in [`doc/manual/src`](./doc/manual/src).
+The underlying source files are located in [`doc/manual/source`](./doc/manual/source).
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).
diff --git a/HACKING.md b/HACKING.md
index d3576d60dcf..02971da3ea5 120000
--- a/HACKING.md
+++ b/HACKING.md
@@ -1 +1 @@
-doc/manual/src/development/building.md
\ No newline at end of file
+doc/manual/source/development/building.md
\ No newline at end of file
diff --git a/Makefile b/Makefile
deleted file mode 100644
index dbf510a3e9c..00000000000
--- a/Makefile
+++ /dev/null
@@ -1,128 +0,0 @@
-# External build directory support
-
-include mk/build-dir.mk
-
--include $(buildprefix)Makefile.config
-clean-files += $(buildprefix)Makefile.config
-
-# List makefiles
-
-include mk/platform.mk
-
-ifeq ($(ENABLE_BUILD), yes)
-makefiles = \
- mk/precompiled-headers.mk \
- local.mk \
- src/libutil/local.mk \
- src/libstore/local.mk \
- src/libfetchers/local.mk \
- src/libmain/local.mk \
- src/libexpr/local.mk \
- src/libflake/local.mk \
- src/libcmd/local.mk \
- src/nix/local.mk \
- src/libutil-c/local.mk \
- src/libstore-c/local.mk \
- src/libexpr-c/local.mk
-
-ifdef HOST_UNIX
-makefiles += \
- scripts/local.mk \
- maintainers/local.mk \
- misc/bash/local.mk \
- misc/fish/local.mk \
- misc/zsh/local.mk \
- misc/systemd/local.mk \
- misc/launchd/local.mk \
- misc/upstart/local.mk
-endif
-endif
-
-ifeq ($(ENABLE_UNIT_TESTS), yes)
-makefiles += \
- tests/unit/libutil/local.mk \
- tests/unit/libutil-support/local.mk \
- tests/unit/libstore/local.mk \
- tests/unit/libstore-support/local.mk \
- tests/unit/libfetchers/local.mk \
- tests/unit/libexpr/local.mk \
- tests/unit/libexpr-support/local.mk \
- tests/unit/libflake/local.mk
-endif
-
-ifeq ($(ENABLE_FUNCTIONAL_TESTS), yes)
-ifdef HOST_UNIX
-makefiles += \
- tests/functional/local.mk \
- tests/functional/flakes/local.mk \
- tests/functional/ca/local.mk \
- tests/functional/git-hashing/local.mk \
- tests/functional/dyn-drv/local.mk \
- tests/functional/local-overlay-store/local.mk \
- tests/functional/test-libstoreconsumer/local.mk \
- tests/functional/plugins/local.mk
-endif
-endif
-
-# Some makefiles require access to built programs and must be included late.
-makefiles-late =
-
-ifeq ($(ENABLE_DOC_GEN), yes)
-makefiles-late += doc/manual/local.mk
-endif
-
-# Miscellaneous global Flags
-
-OPTIMIZE = 1
-
-ifeq ($(OPTIMIZE), 1)
- GLOBAL_CXXFLAGS += -O3 $(CXXLTO)
- GLOBAL_LDFLAGS += $(CXXLTO)
-else
- GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE
- unexport NIX_HARDENING_ENABLE
-endif
-
-ifdef HOST_WINDOWS
- # Windows DLLs are stricter about symbol visibility than Unix shared
- # objects --- see https://gcc.gnu.org/wiki/Visibility for details.
- # This is a temporary sledgehammer to export everything like on Unix,
- # and not detail with this yet.
- #
- # TODO do not do this, and instead do fine-grained export annotations.
- GLOBAL_LDFLAGS += -Wl,--export-all-symbols
-endif
-
-GLOBAL_CXXFLAGS += -g -Wall -Wdeprecated-copy -Wignored-qualifiers -Wimplicit-fallthrough -Werror=unused-result -Werror=suggest-override -include $(buildprefix)config.h -std=c++2a -I src
-
-# Include the main lib, causing rules to be defined
-
-include mk/lib.mk
-
-# Fallback stub rules for better UX when things are disabled
-#
-# These must be defined after `mk/lib.mk`. Otherwise the first rule
-# incorrectly becomes the default target.
-
-ifneq ($(ENABLE_UNIT_TESTS), yes)
-.PHONY: check
-check:
- @echo "Unit tests are disabled. Configure without '--disable-unit-tests', or avoid calling 'make check'."
- @exit 1
-endif
-
-ifneq ($(ENABLE_FUNCTIONAL_TESTS), yes)
-.PHONY: installcheck
-installcheck:
- @echo "Functional tests are disabled. Configure without '--disable-functional-tests', or avoid calling 'make installcheck'."
- @exit 1
-endif
-
-# Documentation fallback stub rules.
-
-ifneq ($(ENABLE_DOC_GEN), yes)
-.PHONY: manual-html manpages
-manual-html manpages:
- @echo "Generated docs are disabled. Configure without '--disable-doc-gen', or avoid calling 'make manpages' and 'make manual-html'."
- @exit 1
-endif
diff --git a/Makefile.config.in b/Makefile.config.in
deleted file mode 100644
index 3100d207365..00000000000
--- a/Makefile.config.in
+++ /dev/null
@@ -1,54 +0,0 @@
-AR = @AR@
-BDW_GC_LIBS = @BDW_GC_LIBS@
-BOOST_LDFLAGS = @BOOST_LDFLAGS@
-BUILD_SHARED_LIBS = @BUILD_SHARED_LIBS@
-CC = @CC@
-CFLAGS = @CFLAGS@
-CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
-CXXLTO = @CXXLTO@
-EDITLINE_LIBS = @EDITLINE_LIBS@
-ENABLE_BUILD = @ENABLE_BUILD@
-ENABLE_DOC_GEN = @ENABLE_DOC_GEN@
-ENABLE_FUNCTIONAL_TESTS = @ENABLE_FUNCTIONAL_TESTS@
-ENABLE_S3 = @ENABLE_S3@
-ENABLE_UNIT_TESTS = @ENABLE_UNIT_TESTS@
-GTEST_LIBS = @GTEST_LIBS@
-HAVE_LIBCPUID = @HAVE_LIBCPUID@
-HAVE_SECCOMP = @HAVE_SECCOMP@
-HOST_OS = @host_os@
-INSTALL_UNIT_TESTS = @INSTALL_UNIT_TESTS@
-LDFLAGS = @LDFLAGS@
-LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@
-LIBBROTLI_LIBS = @LIBBROTLI_LIBS@
-LIBCURL_LIBS = @LIBCURL_LIBS@
-LIBGIT2_LIBS = @LIBGIT2_LIBS@
-LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@
-LOWDOWN_LIBS = @LOWDOWN_LIBS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-SHELL = @bash@
-SODIUM_LIBS = @SODIUM_LIBS@
-SQLITE3_LIBS = @SQLITE3_LIBS@
-bash = @bash@
-bindir = @bindir@
-checkbindir = @checkbindir@
-checklibdir = @checklibdir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-embedded_sandbox_shell = @embedded_sandbox_shell@
-exec_prefix = @exec_prefix@
-includedir = @includedir@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localstatedir = @localstatedir@
-lsof = @lsof@
-mandir = @mandir@
-pkglibdir = $(libdir)/$(PACKAGE_NAME)
-prefix = @prefix@
-sandbox_shell = @sandbox_shell@
-storedir = @storedir@
-sysconfdir = @sysconfdir@
-system = @system@
diff --git a/build-utils-meson/common/meson.build b/build-utils-meson/common/meson.build
new file mode 100644
index 00000000000..f0322183e8a
--- /dev/null
+++ b/build-utils-meson/common/meson.build
@@ -0,0 +1,22 @@
+# This is only conditional to work around
+# https://github.com/mesonbuild/meson/issues/13293. It should be
+# unconditional.
+if not (host_machine.system() == 'windows' and cxx.get_id() == 'gcc')
+ deps_private += dependency('threads')
+endif
+
+add_project_arguments(
+ '-Wdeprecated-copy',
+ '-Werror=suggest-override',
+ '-Werror=switch',
+ '-Werror=switch-enum',
+ '-Werror=unused-result',
+ '-Wignored-qualifiers',
+ '-Wimplicit-fallthrough',
+ '-Wno-deprecated-declarations',
+ language : 'cpp',
+)
+
+if get_option('buildtype') not in ['debug']
+ add_project_arguments('-O3', language : 'cpp')
+endif
diff --git a/build-utils-meson/diagnostics/meson.build b/build-utils-meson/diagnostics/meson.build
deleted file mode 100644
index 30eedfc13f8..00000000000
--- a/build-utils-meson/diagnostics/meson.build
+++ /dev/null
@@ -1,11 +0,0 @@
-add_project_arguments(
- '-Wdeprecated-copy',
- '-Werror=suggest-override',
- '-Werror=switch',
- '-Werror=switch-enum',
- '-Werror=unused-result',
- '-Wignored-qualifiers',
- '-Wimplicit-fallthrough',
- '-Wno-deprecated-declarations',
- language : 'cpp',
-)
diff --git a/build-utils-meson/libatomic/meson.build b/build-utils-meson/libatomic/meson.build
new file mode 100644
index 00000000000..d16d2381764
--- /dev/null
+++ b/build-utils-meson/libatomic/meson.build
@@ -0,0 +1,8 @@
+
+# Check if -latomic is needed
+# This is needed for std::atomic on some platforms
+# We did not manage to test this reliably on all platforms, so we hardcode
+# it for now.
+if host_machine.cpu_family() == 'arm'
+ deps_other += cxx.find_library('atomic')
+endif
diff --git a/build-utils-meson/threads/meson.build b/build-utils-meson/threads/meson.build
deleted file mode 100644
index 294160de130..00000000000
--- a/build-utils-meson/threads/meson.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# This is only conditional to work around
-# https://github.com/mesonbuild/meson/issues/13293. It should be
-# unconditional.
-if not (host_machine.system() == 'windows' and cxx.get_id() == 'gcc')
- deps_private += dependency('threads')
-endif
diff --git a/build-utils-meson/windows-version/meson.build b/build-utils-meson/windows-version/meson.build
new file mode 100644
index 00000000000..3a008e5df94
--- /dev/null
+++ b/build-utils-meson/windows-version/meson.build
@@ -0,0 +1,6 @@
+if host_machine.system() == 'windows'
+ # https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170
+ # #define _WIN32_WINNT_WIN8 0x0602
+ # We currently don't use any API which requires higher than this.
+ add_project_arguments([ '-D_WIN32_WINNT=0x0602' ], language: 'cpp')
+endif
diff --git a/config/install-sh b/config/install-sh
deleted file mode 100755
index 377bb8687ff..00000000000
--- a/config/install-sh
+++ /dev/null
@@ -1,527 +0,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2011-11-20.07; # UTC
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# 'make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-
-nl='
-'
-IFS=" "" $nl"
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit=${DOITPROG-}
-if test -z "$doit"; then
- doit_exec=exec
-else
- doit_exec=$doit
-fi
-
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
-
-chgrpprog=${CHGRPPROG-chgrp}
-chmodprog=${CHMODPROG-chmod}
-chownprog=${CHOWNPROG-chown}
-cmpprog=${CMPPROG-cmp}
-cpprog=${CPPROG-cp}
-mkdirprog=${MKDIRPROG-mkdir}
-mvprog=${MVPROG-mv}
-rmprog=${RMPROG-rm}
-stripprog=${STRIPPROG-strip}
-
-posix_glob='?'
-initialize_posix_glob='
- test "$posix_glob" != "?" || {
- if (set -f) 2>/dev/null; then
- posix_glob=
- else
- posix_glob=:
- fi
- }
-'
-
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chgrpcmd=
-chmodcmd=$chmodprog
-chowncmd=
-mvcmd=$mvprog
-rmcmd="$rmprog -f"
-stripcmd=
-
-src=
-dst=
-dir_arg=
-dst_arg=
-
-copy_on_change=false
-no_target_directory=
-
-usage="\
-Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
- or: $0 [OPTION]... SRCFILES... DIRECTORY
- or: $0 [OPTION]... -t DIRECTORY SRCFILES...
- or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
- --help display this help and exit.
- --version display version info and exit.
-
- -c (ignored)
- -C install only if different (preserve the last data modification time)
- -d create directories instead of installing files.
- -g GROUP $chgrpprog installed files to GROUP.
- -m MODE $chmodprog installed files to MODE.
- -o USER $chownprog installed files to USER.
- -s $stripprog installed files.
- -t DIRECTORY install into DIRECTORY.
- -T report an error if DSTFILE is a directory.
-
-Environment variables override the default commands:
- CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
- RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
- case $1 in
- -c) ;;
-
- -C) copy_on_change=true;;
-
- -d) dir_arg=true;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift;;
-
- --help) echo "$usage"; exit $?;;
-
- -m) mode=$2
- case $mode in
- *' '* | *' '* | *'
-'* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
-
- -o) chowncmd="$chownprog $2"
- shift;;
-
- -s) stripcmd=$stripprog;;
-
- -t) dst_arg=$2
- # Protect names problematic for 'test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
- shift;;
-
- -T) no_target_directory=true;;
-
- --version) echo "$0 $scriptversion"; exit $?;;
-
- --) shift
- break;;
-
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
-
- *) break;;
- esac
- shift
-done
-
-if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
- # When -d is used, all remaining arguments are directories to create.
- # When -t is used, the destination is already specified.
- # Otherwise, the last argument is the destination. Remove it from $@.
- for arg
- do
- if test -n "$dst_arg"; then
- # $@ is not empty: it contains at least $arg.
- set fnord "$@" "$dst_arg"
- shift # fnord
- fi
- shift # arg
- dst_arg=$arg
- # Protect names problematic for 'test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
- done
-fi
-
-if test $# -eq 0; then
- if test -z "$dir_arg"; then
- echo "$0: no input file specified." >&2
- exit 1
- fi
- # It's OK to call 'install-sh -d' without argument.
- # This can happen when creating conditional directories.
- exit 0
-fi
-
-if test -z "$dir_arg"; then
- do_exit='(exit $ret); exit $ret'
- trap "ret=129; $do_exit" 1
- trap "ret=130; $do_exit" 2
- trap "ret=141; $do_exit" 13
- trap "ret=143; $do_exit" 15
-
- # Set umask so as not to create temps with too-generous modes.
- # However, 'strip' requires both read and write access to temps.
- case $mode in
- # Optimize common cases.
- *644) cp_umask=133;;
- *755) cp_umask=22;;
-
- *[0-7])
- if test -z "$stripcmd"; then
- u_plus_rw=
- else
- u_plus_rw='% 200'
- fi
- cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
- *)
- if test -z "$stripcmd"; then
- u_plus_rw=
- else
- u_plus_rw=,u+rw
- fi
- cp_umask=$mode$u_plus_rw;;
- esac
-fi
-
-for src
-do
- # Protect names problematic for 'test' and other utilities.
- case $src in
- -* | [=\(\)!]) src=./$src;;
- esac
-
- if test -n "$dir_arg"; then
- dst=$src
- dstdir=$dst
- test -d "$dstdir"
- dstdir_status=$?
- else
-
- # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
- # might cause directories to be created, which would be especially bad
- # if $src (and thus $dsttmp) contains '*'.
- if test ! -f "$src" && test ! -d "$src"; then
- echo "$0: $src does not exist." >&2
- exit 1
- fi
-
- if test -z "$dst_arg"; then
- echo "$0: no destination specified." >&2
- exit 1
- fi
- dst=$dst_arg
-
- # If destination is a directory, append the input filename; won't work
- # if double slashes aren't ignored.
- if test -d "$dst"; then
- if test -n "$no_target_directory"; then
- echo "$0: $dst_arg: Is a directory" >&2
- exit 1
- fi
- dstdir=$dst
- dst=$dstdir/`basename "$src"`
- dstdir_status=0
- else
- # Prefer dirname, but fall back on a substitute if dirname fails.
- dstdir=`
- (dirname "$dst") 2>/dev/null ||
- expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$dst" : 'X\(//\)[^/]' \| \
- X"$dst" : 'X\(//\)$' \| \
- X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
- echo X"$dst" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'
- `
-
- test -d "$dstdir"
- dstdir_status=$?
- fi
- fi
-
- obsolete_mkdir_used=false
-
- if test $dstdir_status != 0; then
- case $posix_mkdir in
- '')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
- else
- mkdir_mode=
- fi
-
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
- esac
-
- if
- $posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
- )
- then :
- else
-
- # The umask is ridiculous, or mkdir does not conform to POSIX,
- # or it failed possibly due to a race condition. Create the
- # directory the slow way, step by step, checking for races as we go.
-
- case $dstdir in
- /*) prefix='/';;
- [-=\(\)!]*) prefix='./';;
- *) prefix='';;
- esac
-
- eval "$initialize_posix_glob"
-
- oIFS=$IFS
- IFS=/
- $posix_glob set -f
- set fnord $dstdir
- shift
- $posix_glob set +f
- IFS=$oIFS
-
- prefixes=
-
- for d
- do
- test X"$d" = X && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
- else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
- fi
- prefix=$prefix/
- done
-
- if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
- fi
- fi
- fi
-
- if test -n "$dir_arg"; then
- { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
- { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
- { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
- test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
- else
-
- # Make a couple of temp file names in the proper directory.
- dsttmp=$dstdir/_inst.$$_
- rmtmp=$dstdir/_rm.$$_
-
- # Trap to clean up those temp files at exit.
- trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
- # Copy the file name to the temp name.
- (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
- # and set any options; do chmod last to preserve setuid bits.
- #
- # If any of these fail, we abort the whole thing. If we want to
- # ignore errors from any of these, just make sure not to ignore
- # errors from the above "$doit $cpprog $src $dsttmp" command.
- #
- { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
- { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
- { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
- { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
- # If -C, don't bother to copy if it wouldn't change the file.
- if $copy_on_change &&
- old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
- new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
-
- eval "$initialize_posix_glob" &&
- $posix_glob set -f &&
- set X $old && old=:$2:$4:$5:$6 &&
- set X $new && new=:$2:$4:$5:$6 &&
- $posix_glob set +f &&
-
- test "$old" = "$new" &&
- $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
- then
- rm -f "$dsttmp"
- else
- # Rename the file to the real destination.
- $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
-
- # The rename failed, perhaps because mv can't rename something else
- # to itself, or perhaps because mv is so ancient that it does not
- # support -f.
- {
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- test ! -f "$dst" ||
- $doit $rmcmd -f "$dst" 2>/dev/null ||
- { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
- } ||
- { echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
- }
- fi || exit 1
-
- trap '' 0
- fi
-done
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 198198dea26..00000000000
--- a/configure.ac
+++ /dev/null
@@ -1,447 +0,0 @@
-AC_INIT([nix],[m4_esyscmd(bash -c "echo -n $(cat ./.version)$VERSION_SUFFIX")])
-AC_CONFIG_MACRO_DIRS([m4])
-AC_CONFIG_SRCDIR(README.md)
-AC_CONFIG_AUX_DIR(config)
-
-AC_PROG_SED
-
-# Construct a Nix system name (like "i686-linux"):
-# https://www.gnu.org/software/autoconf/manual/html_node/Canonicalizing.html#index-AC_005fCANONICAL_005fHOST-1
-# The inital value is produced by the `config/config.guess` script:
-# upstream: https://git.savannah.gnu.org/cgit/config.git/tree/config.guess
-# It has the following form, which is not documented anywhere:
-# --[][-]
-# If `./configure` is passed any of the `--host`, `--build`, `--target` options, the value comes from `config/config.sub` instead:
-# upstream: https://git.savannah.gnu.org/cgit/config.git/tree/config.sub
-AC_CANONICAL_HOST
-AC_MSG_CHECKING([for the canonical Nix system name])
-
-AC_ARG_WITH(system, AS_HELP_STRING([--with-system=SYSTEM],[Platform identifier (e.g., `i686-linux').]),
- [system=$withval],
- [case "$host_cpu" in
- i*86)
- machine_name="i686";;
- amd64)
- machine_name="x86_64";;
- armv6|armv7)
- machine_name="${host_cpu}l";;
- *)
- machine_name="$host_cpu";;
- esac
-
- case "$host_os" in
- linux-gnu*|linux-musl*)
- # For backward compatibility, strip the `-gnu' part.
- system="$machine_name-linux";;
- *)
- # Strip the version number from names such as `gnu0.3',
- # `darwin10.2.0', etc.
- system="$machine_name-`echo $host_os | "$SED" -e's/@<:@0-9.@:>@*$//g'`";;
- esac])
-
-AC_MSG_RESULT($system)
-AC_SUBST(system)
-AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier ('cpu-os')])
-
-
-# State should be stored in /nix/var, unless the user overrides it explicitly.
-test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var
-
-# Assign a default value to C{,XX}FLAGS as the default configure script sets them
-# to -O2 otherwise, which we don't want to have hardcoded
-CFLAGS=${CFLAGS-""}
-CXXFLAGS=${CXXFLAGS-""}
-
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_CPP
-
-AC_CHECK_TOOL([AR], [ar])
-
-# Use 64-bit file system calls so that we can support files > 2 GiB.
-AC_SYS_LARGEFILE
-
-
-# Solaris-specific stuff.
-case "$host_os" in
- solaris*)
- # Solaris requires -lsocket -lnsl for network functions
- LDFLAGS="-lsocket -lnsl $LDFLAGS"
- ;;
-esac
-
-
-ENSURE_NO_GCC_BUG_80431
-
-
-# Check for pubsetbuf.
-AC_MSG_CHECKING([for pubsetbuf])
-AC_LANG_PUSH(C++)
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include
-using namespace std;
-static char buf[1024];]],
- [[cerr.rdbuf()->pubsetbuf(buf, sizeof(buf));]])],
- [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PUBSETBUF, 1, [Whether pubsetbuf is available.])],
- AC_MSG_RESULT(no))
-AC_LANG_POP(C++)
-
-
-AC_CHECK_FUNCS([statvfs pipe2 close_range])
-
-
-# Check for lutimes, optionally used for changing the mtime of
-# symlinks.
-AC_CHECK_FUNCS([lutimes])
-
-
-# Check whether the store optimiser can optimise symlinks.
-AC_MSG_CHECKING([whether it is possible to create a link to a symlink])
-ln -s bla tmp_link
-if ln tmp_link tmp_link2 2> /dev/null; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(CAN_LINK_SYMLINK, 1, [Whether link() works on symlinks.])
-else
- AC_MSG_RESULT(no)
-fi
-rm -f tmp_link tmp_link2
-
-
-# Check for .
-AC_LANG_PUSH(C++)
-AC_CHECK_HEADERS([locale])
-AC_LANG_POP(C++)
-
-
-AC_DEFUN([NEED_PROG],
-[
-AC_PATH_PROG($1, $2)
-if test -z "$$1"; then
- AC_MSG_ERROR([$2 is required])
-fi
-])
-
-NEED_PROG(bash, bash)
-AC_PATH_PROG(flex, flex, false)
-AC_PATH_PROG(bison, bison, false)
-AC_PATH_PROG(dot, dot)
-AC_PATH_PROG(lsof, lsof, lsof)
-
-
-AC_SUBST(coreutils, [$(dirname $(type -p cat))])
-
-
-AC_ARG_WITH(store-dir, AS_HELP_STRING([--with-store-dir=PATH],[path of the Nix store (defaults to /nix/store)]),
- storedir=$withval, storedir='/nix/store')
-AC_SUBST(storedir)
-
-
-# Running the functional tests without building Nix is useful for testing
-# different pre-built versions of Nix against each other.
-AC_ARG_ENABLE(build, AS_HELP_STRING([--disable-build],[Do not build nix]),
- ENABLE_BUILD=$enableval, ENABLE_BUILD=yes)
-AC_SUBST(ENABLE_BUILD)
-
-# Building without unit tests is useful for bootstrapping with a smaller footprint
-# or running the tests in a separate derivation. Otherwise, we do compile and
-# run them.
-
-AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--disable-unit-tests],[Do not build the tests]),
- ENABLE_UNIT_TESTS=$enableval, ENABLE_UNIT_TESTS=$ENABLE_BUILD)
-AC_SUBST(ENABLE_UNIT_TESTS)
-
-AS_IF(
- [test "$ENABLE_BUILD" == "no" && test "$ENABLE_UNIT_TESTS" == "yes"],
- [AC_MSG_ERROR([Cannot enable unit tests when building overall is disabled. Please do not pass '--enable-unit-tests' or do not pass '--disable-build'.])])
-
-AC_ARG_ENABLE(functional-tests, AS_HELP_STRING([--disable-functional-tests],[Do not build the tests]),
- ENABLE_FUNCTIONAL_TESTS=$enableval, ENABLE_FUNCTIONAL_TESTS=yes)
-AC_SUBST(ENABLE_FUNCTIONAL_TESTS)
-
-# documentation generation switch
-AC_ARG_ENABLE(doc-gen, AS_HELP_STRING([--disable-doc-gen],[disable documentation generation]),
- ENABLE_DOC_GEN=$enableval, ENABLE_DOC_GEN=$ENABLE_BUILD)
-AC_SUBST(ENABLE_DOC_GEN)
-
-AS_IF(
- [test "$ENABLE_BUILD" == "no" && test "$ENABLE_DOC_GEN" == "yes"],
- [AC_MSG_ERROR([Cannot enable generated docs when building overall is disabled. Please do not pass '--enable-doc-gen' or do not pass '--disable-build'.])])
-
-AS_IF(
- [test "$ENABLE_FUNCTIONAL_TESTS" == "yes" || test "$ENABLE_DOC_GEN" == "yes"],
- [NEED_PROG(jq, jq)])
-
-AS_IF([test "$ENABLE_BUILD" == "yes"],[
-
-# Look for boost, a required dependency.
-# Note that AX_BOOST_BASE only exports *CPP* BOOST_CPPFLAGS, no CXX flags,
-# and CPPFLAGS are not passed to the C++ compiler automatically.
-# Thus we append the returned CPPFLAGS to the CXXFLAGS here.
-AX_BOOST_BASE([1.66], [CXXFLAGS="$BOOST_CPPFLAGS $CXXFLAGS"], [AC_MSG_ERROR([Nix requires boost.])])
-# For unknown reasons, setting this directly in the ACTION-IF-FOUND above
-# ends up with LDFLAGS being empty, so we set it afterwards.
-LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
-
-# On some platforms, new-style atomics need a helper library
-AC_MSG_CHECKING(whether -latomic is needed)
-AC_LINK_IFELSE([AC_LANG_SOURCE([[
-#include
-uint64_t v;
-int main() {
- return (int)__atomic_load_n(&v, __ATOMIC_ACQUIRE);
-}]])], GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC=no, GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC=yes)
-AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC)
-if test "x$GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC" = xyes; then
- LDFLAGS="-latomic $LDFLAGS"
-fi
-
-AC_ARG_ENABLE(install-unit-tests, AS_HELP_STRING([--enable-install-unit-tests],[Install the unit tests for running later (default no)]),
- INSTALL_UNIT_TESTS=$enableval, INSTALL_UNIT_TESTS=no)
-AC_SUBST(INSTALL_UNIT_TESTS)
-
-AC_ARG_WITH(check-bin-dir, AS_HELP_STRING([--with-check-bin-dir=PATH],[path to install unit tests for running later (defaults to $libexecdir/nix)]),
- checkbindir=$withval, checkbindir=$libexecdir/nix)
-AC_SUBST(checkbindir)
-
-AC_ARG_WITH(check-lib-dir, AS_HELP_STRING([--with-check-lib-dir=PATH],[path to install unit tests for running later (defaults to $libdir)]),
- checklibdir=$withval, checklibdir=$libdir)
-AC_SUBST(checklibdir)
-
-# LTO is currently broken with clang for unknown reasons; ld segfaults in the llvm plugin
-AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto],[Enable LTO (only supported with GCC) [default=no]]),
- lto=$enableval, lto=no)
-if test "$lto" = yes; then
- if $CXX --version | grep -q GCC; then
- AC_SUBST(CXXLTO, [-flto=jobserver])
- else
- echo "error: LTO is only supported with GCC at the moment" >&2
- exit 1
- fi
-else
- AC_SUBST(CXXLTO, [""])
-fi
-
-PKG_PROG_PKG_CONFIG
-
-AC_ARG_ENABLE(shared, AS_HELP_STRING([--enable-shared],[Build shared libraries for Nix [default=yes]]),
- shared=$enableval, shared=yes)
-if test "$shared" = yes; then
- AC_SUBST(BUILD_SHARED_LIBS, 1, [Whether to build shared libraries.])
-else
- AC_SUBST(BUILD_SHARED_LIBS, 0, [Whether to build shared libraries.])
- PKG_CONFIG="$PKG_CONFIG --static"
-fi
-
-# Look for OpenSSL, a required dependency. FIXME: this is only (maybe)
-# used by S3BinaryCacheStore.
-PKG_CHECK_MODULES([OPENSSL], [libcrypto >= 1.1.1], [CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS"])
-
-
-# Look for libarchive.
-PKG_CHECK_MODULES([LIBARCHIVE], [libarchive >= 3.1.2], [CXXFLAGS="$LIBARCHIVE_CFLAGS $CXXFLAGS"])
-# Workaround until https://github.com/libarchive/libarchive/issues/1446 is fixed
-if test "$shared" != yes; then
- LIBARCHIVE_LIBS+=' -lz'
-fi
-
-# Look for SQLite, a required dependency.
-PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19], [CXXFLAGS="$SQLITE3_CFLAGS $CXXFLAGS"])
-
-# Look for libcurl, a required dependency.
-PKG_CHECK_MODULES([LIBCURL], [libcurl], [CXXFLAGS="$LIBCURL_CFLAGS $CXXFLAGS"])
-
-# Look for editline or readline, a required dependency.
-# The the libeditline.pc file was added only in libeditline >= 1.15.2,
-# see https://github.com/troglobit/editline/commit/0a8f2ef4203c3a4a4726b9dd1336869cd0da8607,
-# Older versions are no longer supported.
-AC_ARG_WITH(
- [readline-flavor],
- AS_HELP_STRING([--with-readline-flavor],[Which library to use for nice line editting with the Nix language REPL" [default=editline]]),
- [readline_flavor=$withval],
- [readline_flavor=editline])
-AS_CASE(["$readline_flavor"],
- [editline], [
- readline_flavor_pc=libeditline
- ],
- [readline], [
- readline_flavor_pc=readline
- AC_DEFINE([USE_READLINE], [1], [Use readline instead of editline])
- ],
- [AC_MSG_ERROR([bad value "$readline_flavor" for --with-readline-flavor, must be one of: editline, readline])])
-PKG_CHECK_MODULES([EDITLINE], [$readline_flavor_pc], [CXXFLAGS="$EDITLINE_CFLAGS $CXXFLAGS"])
-
-# Look for libsodium.
-PKG_CHECK_MODULES([SODIUM], [libsodium], [CXXFLAGS="$SODIUM_CFLAGS $CXXFLAGS"])
-
-# Look for libbrotli{enc,dec}.
-PKG_CHECK_MODULES([LIBBROTLI], [libbrotlienc libbrotlidec], [CXXFLAGS="$LIBBROTLI_CFLAGS $CXXFLAGS"])
-
-# Look for libcpuid.
-have_libcpuid=
-if test "$machine_name" = "x86_64"; then
- AC_ARG_ENABLE([cpuid],
- AS_HELP_STRING([--disable-cpuid], [Do not determine microarchitecture levels with libcpuid (relevant to x86_64 only)]))
- if test "x$enable_cpuid" != "xno"; then
- PKG_CHECK_MODULES([LIBCPUID], [libcpuid],
- [CXXFLAGS="$LIBCPUID_CFLAGS $CXXFLAGS"
- have_libcpuid=1
- AC_DEFINE([HAVE_LIBCPUID], [1], [Use libcpuid])]
- )
- fi
-fi
-AC_SUBST(HAVE_LIBCPUID, [$have_libcpuid])
-
-
-# Look for libseccomp, required for Linux sandboxing.
-case "$host_os" in
- linux*)
- AC_ARG_ENABLE([seccomp-sandboxing],
- AS_HELP_STRING([--disable-seccomp-sandboxing],[Don't build support for seccomp sandboxing (only recommended if your arch doesn't support libseccomp yet!)
- ]))
- if test "x$enable_seccomp_sandboxing" != "xno"; then
- PKG_CHECK_MODULES([LIBSECCOMP], [libseccomp],
- [CXXFLAGS="$LIBSECCOMP_CFLAGS $CXXFLAGS" CFLAGS="$LIBSECCOMP_CFLAGS $CFLAGS"])
- have_seccomp=1
- AC_DEFINE([HAVE_SECCOMP], [1], [Whether seccomp is available and should be used for sandboxing.])
- AC_COMPILE_IFELSE([
- AC_LANG_SOURCE([[
- #include
- #ifndef __SNR_fchmodat2
- # error "Missing support for fchmodat2"
- #endif
- ]])
- ], [], [
- echo "libseccomp is missing __SNR_fchmodat2. Please provide libseccomp 2.5.5 or later"
- exit 1
- ])
- else
- have_seccomp=
- fi
- ;;
- *)
- have_seccomp=
- ;;
-esac
-AC_SUBST(HAVE_SECCOMP, [$have_seccomp])
-
-# Optional dependencies for better normalizing file system data
-AC_CHECK_HEADERS([sys/xattr.h])
-AS_IF([test "$ac_cv_header_sys_xattr_h" = "yes"],[
- AC_CHECK_FUNCS([llistxattr lremovexattr])
- AS_IF([test "$ac_cv_func_llistxattr" = "yes" && test "$ac_cv_func_lremovexattr" = "yes"],[
- AC_DEFINE([HAVE_ACL_SUPPORT], [1], [Define if we can manipulate file system Access Control Lists])
- ])
-])
-
-# Look for aws-cpp-sdk-s3.
-AC_LANG_PUSH(C++)
-AC_CHECK_HEADERS([aws/s3/S3Client.h],
- [AC_DEFINE([ENABLE_S3], [1], [Whether to enable S3 support via aws-sdk-cpp.]) enable_s3=1],
- [AC_DEFINE([ENABLE_S3], [0], [Whether to enable S3 support via aws-sdk-cpp.]) enable_s3=])
-AC_SUBST(ENABLE_S3, [$enable_s3])
-AC_LANG_POP(C++)
-
-
-# Whether to use the Boehm garbage collector.
-AC_ARG_ENABLE(gc, AS_HELP_STRING([--enable-gc],[enable garbage collection in the Nix expression evaluator (requires Boehm GC) [default=yes]]),
- gc=$enableval, gc=yes)
-if test "$gc" = yes; then
- PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
- CXXFLAGS="$BDW_GC_CFLAGS $CXXFLAGS"
- AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
-
- # See `fixupBoehmStackPointer`, for the integration between Boehm GC
- # and Boost coroutines.
- old_CFLAGS="$CFLAGS"
- # Temporary set `-pthread` just for the next check
- CFLAGS="$CFLAGS -pthread"
- AC_CHECK_FUNCS([pthread_attr_get_np pthread_getattr_np])
- CFLAGS="$old_CFLAGS"
-fi
-
-AS_IF([test "$ENABLE_UNIT_TESTS" == "yes"],[
-
-# Look for gtest.
-PKG_CHECK_MODULES([GTEST], [gtest_main gmock_main])
-
-# Look for rapidcheck.
-PKG_CHECK_MODULES([RAPIDCHECK], [rapidcheck rapidcheck_gtest])
-
-])
-
-# Look for nlohmann/json.
-PKG_CHECK_MODULES([NLOHMANN_JSON], [nlohmann_json >= 3.9])
-
-
-# Look for lowdown library.
-AC_ARG_ENABLE([markdown], AS_HELP_STRING([--enable-markdown], [Enable Markdown rendering in the Nix binary (requires lowdown) [default=auto]]),
- enable_markdown=$enableval, enable_markdown=auto)
-AS_CASE(["$enable_markdown"],
- [yes | auto], [
- PKG_CHECK_MODULES([LOWDOWN], [lowdown >= 0.9.0], [
- CXXFLAGS="$LOWDOWN_CFLAGS $CXXFLAGS"
- have_lowdown=1
- AC_DEFINE(HAVE_LOWDOWN, 1, [Whether lowdown is available and should be used for Markdown rendering.])
- ], [
- AS_IF([test "x$enable_markdown" == "xyes"], [AC_MSG_ERROR([--enable-markdown was specified, but lowdown was not found.])])
- ])
- ],
- [no], [have_lowdown=],
- [AC_MSG_ERROR([bad value "$enable_markdown" for --enable-markdown, must be one of: yes, no, auto])])
-
-
-# Look for libgit2.
-PKG_CHECK_MODULES([LIBGIT2], [libgit2])
-
-
-# Look for toml11, a required dependency.
-AC_LANG_PUSH(C++)
-AC_CHECK_HEADER([toml.hpp], [], [AC_MSG_ERROR([toml11 is not found.])])
-AC_LANG_POP(C++)
-
-# Setuid installations.
-AC_CHECK_FUNCS([setresuid setreuid lchown])
-
-
-# Nice to have, but not essential.
-AC_CHECK_FUNCS([strsignal posix_fallocate sysconf])
-
-
-AC_ARG_WITH(sandbox-shell, AS_HELP_STRING([--with-sandbox-shell=PATH],[path of a statically-linked shell to use as /bin/sh in sandboxes]),
- sandbox_shell=$withval)
-AC_SUBST(sandbox_shell)
-if test ${cross_compiling:-no} = no && ! test -z ${sandbox_shell+x}; then
- AC_MSG_CHECKING([whether sandbox-shell has the standalone feature])
- # busybox shell sometimes allows executing other busybox applets,
- # even if they are not in the path, breaking our sandbox
- if PATH= $sandbox_shell -c "busybox" 2>&1 | grep -qv "not found"; then
- AC_MSG_RESULT(enabled)
- AC_MSG_ERROR([Please disable busybox FEATURE_SH_STANDALONE])
- else
- AC_MSG_RESULT(disabled)
- fi
-fi
-
-AC_ARG_ENABLE(embedded-sandbox-shell, AS_HELP_STRING([--enable-embedded-sandbox-shell],[include the sandbox shell in the Nix binary [default=no]]),
- embedded_sandbox_shell=$enableval, embedded_sandbox_shell=no)
-AC_SUBST(embedded_sandbox_shell)
-if test "$embedded_sandbox_shell" = yes; then
- AC_DEFINE(HAVE_EMBEDDED_SANDBOX_SHELL, 1, [Include the sandbox shell in the Nix binary.])
-fi
-
-])
-
-
-# Expand all variables in config.status.
-test "$prefix" = NONE && prefix=$ac_default_prefix
-test "$exec_prefix" = NONE && exec_prefix='${prefix}'
-for name in $ac_subst_vars; do
- declare $name="$(eval echo "${!name}")"
- declare $name="$(eval echo "${!name}")"
- declare $name="$(eval echo "${!name}")"
-done
-
-rm -f Makefile.config
-
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_FILES([])
-AC_OUTPUT
diff --git a/doc/manual/.version b/doc/manual/.version
new file mode 120000
index 00000000000..b7badcd0cc8
--- /dev/null
+++ b/doc/manual/.version
@@ -0,0 +1 @@
+../../.version
\ No newline at end of file
diff --git a/doc/manual/book.toml b/doc/manual/book.toml
index 73fb7e75e24..213739174b9 100644
--- a/doc/manual/book.toml
+++ b/doc/manual/book.toml
@@ -1,5 +1,6 @@
[book]
title = "Nix Reference Manual"
+src = "source"
[output.html]
additional-css = ["custom.css"]
@@ -7,9 +8,21 @@ additional-js = ["redirects.js"]
edit-url-template = "https://github.com/NixOS/nix/tree/master/doc/manual/{path}"
git-repository-url = "https://github.com/NixOS/nix"
+# Handles replacing @docroot@ with a path to ./source relative to that markdown file,
+# {{#include handlebars}}, and the @generated@ syntax used within these. it mostly
+# but not entirely replaces the links preprocessor (which we cannot simply use due
+# to @generated@ files living in a different directory to make meson happy). we do
+# not want to disable the links preprocessor entirely though because that requires
+# disabling *all* built-in preprocessors and selectively reenabling those we want.
+[preprocessor.substitute]
+command = "python3 ./substitute.py"
+before = ["anchors", "links"]
+
[preprocessor.anchors]
renderers = ["html"]
-command = "jq --from-file doc/manual/anchors.jq"
+command = "jq --from-file ./anchors.jq"
+
+[output.markdown]
[output.linkcheck]
# no Internet during the build (in the sandbox)
diff --git a/doc/manual/generate-deps.py b/doc/manual/generate-deps.py
new file mode 100755
index 00000000000..297bd39390e
--- /dev/null
+++ b/doc/manual/generate-deps.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+
+import glob
+import sys
+
+# meson expects makefile-style dependency declarations, i.e.
+#
+# target: dependency...
+#
+# meson seems to pass depfiles straight on to ninja even though
+# it also parses the file itself (or at least has code to do so
+# in its tree), so we must live by ninja's rules: only slashes,
+# spaces and octothorpes can be escaped, anything else is taken
+# literally. since the rules for these aren't even the same for
+# all three we will just fail when we encounter any of them (if
+# asserts are off for some reason the depfile will likely point
+# to nonexistant paths, making everything phony and thus fine.)
+for path in glob.glob(sys.argv[1] + '/**', recursive=True):
+ assert '\\' not in path
+ assert ' ' not in path
+ assert '#' not in path
+ print("ignored:", path)
diff --git a/doc/manual/generate-store-types.nix b/doc/manual/generate-store-types.nix
index 3b78a0e1bb6..46179abc5bf 100644
--- a/doc/manual/generate-store-types.nix
+++ b/doc/manual/generate-store-types.nix
@@ -21,7 +21,7 @@ let
"index.md" = replaceStrings
[ "@store-types@" ] [ index ]
- (readFile ./src/store/types/index.md.in);
+ (readFile ./source/store/types/index.md.in);
tableOfContents =
let
diff --git a/doc/manual/local.mk b/doc/manual/local.mk
deleted file mode 100644
index fcc50f4605c..00000000000
--- a/doc/manual/local.mk
+++ /dev/null
@@ -1,231 +0,0 @@
-# The version of Nix used to generate the doc. Can also be
-# `$(nix_INSTALL_PATH)` or just `nix` (to grap ambient from the `PATH`),
-# if one prefers.
-doc_nix = $(nix_PATH)
-
-MANUAL_SRCS := \
- $(call rwildcard, $(d)/src, *.md) \
- $(call rwildcard, $(d)/src, */*.md)
-
-man-pages := $(foreach n, \
- 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 \
- nix.conf.5 nix-daemon.8 \
- nix-profiles.5 \
-, $(d)/$(n))
-
-# man pages for subcommands
-# convert from `$(d)/src/command-ref/nix-{1}/{2}.md` to `$(d)/nix-{1}-{2}.1`
-# FIXME: unify with how nix3-cli man pages are generated
-man-pages += $(foreach subcommand, \
- $(filter-out %opt-common.md %env-common.md, $(wildcard $(d)/src/command-ref/nix-*/*.md)), \
- $(d)/$(subst /,-,$(subst $(d)/src/command-ref/,,$(subst .md,.1,$(subcommand)))))
-
-clean-files += $(d)/*.1 $(d)/*.5 $(d)/*.8
-
-# Provide a dummy environment for nix, so that it will not access files outside the macOS sandbox.
-# Set cores to 0 because otherwise `nix config show` resolves the cores based on the current machine
-dummy-env = env -i \
- HOME=/dummy \
- NIX_CONF_DIR=/dummy \
- NIX_SSL_CERT_FILE=/dummy/no-ca-bundle.crt \
- NIX_STATE_DIR=/dummy \
- NIX_CONFIG='cores = 0'
-
-nix-eval = $(dummy-env) $(doc_nix) eval --experimental-features nix-command -I nix=doc/manual --store dummy:// --impure --raw
-
-# re-implement mdBook's include directive to make it usable for terminal output and for proper @docroot@ substitution
-define process-includes
- while read -r line; do \
- set -euo pipefail; \
- filename="$$(dirname $(1))/$$(sed 's/{{#include \(.*\)}}/\1/'<<< $$line)"; \
- test -f "$$filename" || ( echo "#include-d file '$$filename' does not exist." >&2; exit 1; ); \
- matchline="$$(sed 's|/|\\/|g' <<< $$line)"; \
- sed -i "/$$matchline/r $$filename" $(2); \
- sed -i "s/$$matchline//" $(2); \
- done < <(grep '{{#include' $(1))
-endef
-
-$(d)/nix-env-%.1: $(d)/src/command-ref/nix-env/%.md
- @printf "Title: %s\n\n" "$(subst nix-env-,nix-env --,$$(basename "$@" .1))" > $^.tmp
- $(render-subcommand)
-
-$(d)/nix-store-%.1: $(d)/src/command-ref/nix-store/%.md
- @printf -- 'Title: %s\n\n' "$(subst nix-store-,nix-store --,$$(basename "$@" .1))" > $^.tmp
- $(render-subcommand)
-
-# FIXME: there surely is some more deduplication to be achieved here with even darker Make magic
-define render-subcommand
- @cat $^ >> $^.tmp
- @$(call process-includes,$^,$^.tmp)
- $(trace-gen) lowdown -sT man --nroff-nolinks -M section=1 $^.tmp -o $@
- @# fix up `lowdown`'s automatic escaping of `--`
- @# https://github.com/kristapsdz/lowdown/blob/edca6ce6d5336efb147321a43c47a698de41bb7c/entity.c#L202
- @sed -i 's/\e\[u2013\]/--/' $@
- @rm $^.tmp
-endef
-
-
-$(d)/%.1: $(d)/src/command-ref/%.md
- @printf "Title: %s\n\n" "$$(basename $@ .1)" > $^.tmp
- @cat $^ >> $^.tmp
- @$(call process-includes,$^,$^.tmp)
- $(trace-gen) lowdown -sT man --nroff-nolinks -M section=1 $^.tmp -o $@
- @rm $^.tmp
-
-$(d)/%.8: $(d)/src/command-ref/%.md
- @printf "Title: %s\n\n" "$$(basename $@ .8)" > $^.tmp
- @cat $^ >> $^.tmp
- $(trace-gen) lowdown -sT man --nroff-nolinks -M section=8 $^.tmp -o $@
- @rm $^.tmp
-
-$(d)/nix.conf.5: $(d)/src/command-ref/conf-file.md
- @printf "Title: %s\n\n" "$$(basename $@ .5)" > $^.tmp
- @cat $^ >> $^.tmp
- @$(call process-includes,$^,$^.tmp)
- $(trace-gen) lowdown -sT man --nroff-nolinks -M section=5 $^.tmp -o $@
- @rm $^.tmp
-
-$(d)/nix-profiles.5: $(d)/src/command-ref/files/profiles.md
- @printf "Title: %s\n\n" "$$(basename $@ .5)" > $^.tmp
- @cat $^ >> $^.tmp
- $(trace-gen) lowdown -sT man --nroff-nolinks -M section=5 $^.tmp -o $@
- @rm $^.tmp
-
-$(d)/src/SUMMARY.md: $(d)/src/SUMMARY.md.in $(d)/src/SUMMARY-rl-next.md $(d)/src/store/types $(d)/src/command-ref/new-cli $(d)/src/development/experimental-feature-descriptions.md
- @cp $< $@
- @$(call process-includes,$@,$@)
-
-$(d)/src/store/types: $(d)/nix.json $(d)/utils.nix $(d)/generate-store-info.nix $(d)/generate-store-types.nix $(d)/src/store/types/index.md.in $(doc_nix)
- @# FIXME: build out of tree!
- @rm -rf $@.tmp
- $(trace-gen) $(nix-eval) --write-to $@.tmp --expr 'import doc/manual/generate-store-types.nix (builtins.fromJSON (builtins.readFile $<)).stores'
- @# do not destroy existing contents
- @mv $@.tmp/* $@/
-
-$(d)/src/command-ref/new-cli: $(d)/nix.json $(d)/utils.nix $(d)/generate-manpage.nix $(d)/generate-settings.nix $(d)/generate-store-info.nix $(doc_nix)
- @rm -rf $@ $@.tmp
- $(trace-gen) $(nix-eval) --write-to $@.tmp --expr 'import doc/manual/generate-manpage.nix true (builtins.readFile $<)'
- @mv $@.tmp $@
-
-$(d)/src/command-ref/conf-file.md: $(d)/conf-file.json $(d)/utils.nix $(d)/generate-settings.nix $(d)/src/command-ref/conf-file-prefix.md $(d)/src/command-ref/experimental-features-shortlist.md $(doc_nix)
- @cat doc/manual/src/command-ref/conf-file-prefix.md > $@.tmp
- $(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-settings.nix { prefix = "conf"; } (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp;
- @mv $@.tmp $@
-
-$(d)/nix.json: $(doc_nix)
- $(trace-gen) $(dummy-env) $(doc_nix) __dump-cli > $@.tmp
- @mv $@.tmp $@
-
-$(d)/conf-file.json: $(doc_nix)
- $(trace-gen) $(dummy-env) $(doc_nix) config show --json --experimental-features nix-command > $@.tmp
- @mv $@.tmp $@
-
-$(d)/src/development/experimental-feature-descriptions.md: $(d)/xp-features.json $(d)/utils.nix $(d)/generate-xp-features.nix $(doc_nix)
- @rm -rf $@ $@.tmp
- $(trace-gen) $(nix-eval) --write-to $@.tmp --expr 'import doc/manual/generate-xp-features.nix (builtins.fromJSON (builtins.readFile $<))'
- @mv $@.tmp $@
-
-$(d)/src/command-ref/experimental-features-shortlist.md: $(d)/xp-features.json $(d)/utils.nix $(d)/generate-xp-features-shortlist.nix $(doc_nix)
- @rm -rf $@ $@.tmp
- $(trace-gen) $(nix-eval) --write-to $@.tmp --expr 'import doc/manual/generate-xp-features-shortlist.nix (builtins.fromJSON (builtins.readFile $<))'
- @mv $@.tmp $@
-
-$(d)/xp-features.json: $(doc_nix)
- $(trace-gen) $(dummy-env) $(doc_nix) __dump-xp-features > $@.tmp
- @mv $@.tmp $@
-
-$(d)/src/language/builtins.md: $(d)/language.json $(d)/generate-builtins.nix $(d)/src/language/builtins-prefix.md $(doc_nix)
- @cat doc/manual/src/language/builtins-prefix.md > $@.tmp
- $(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtins.nix (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp;
- @cat doc/manual/src/language/builtins-suffix.md >> $@.tmp
- @mv $@.tmp $@
-
-$(d)/language.json: $(doc_nix)
- $(trace-gen) $(dummy-env) $(doc_nix) __dump-language > $@.tmp
- @mv $@.tmp $@
-
-# Generate "Upcoming release" notes (or clear it and remove from menu)
-$(d)/src/release-notes/rl-next.md: $(d)/rl-next $(d)/rl-next/*
- @if type -p changelog-d > /dev/null; then \
- echo " GEN " $@; \
- changelog-d doc/manual/rl-next > $@; \
- else \
- echo " NULL " $@; \
- true > $@; \
- fi
-
-$(d)/src/SUMMARY-rl-next.md: $(d)/src/release-notes/rl-next.md
- $(trace-gen) true
- @if [ -s $< ]; then \
- echo ' - [Upcoming release](release-notes/rl-next.md)' > $@; \
- else \
- true > $@; \
- fi
-
-# Generate the HTML manual.
-.PHONY: manual-html
-manual-html: $(docdir)/manual/index.html
-
-# Open the built HTML manual in the default browser.
-manual-html-open: $(docdir)/manual/index.html
- @echo " OPEN " $<; \
- xdg-open $< \
- || open $< \
- || { \
- echo "Could not open the manual in a browser. Please open '$<'" >&2; \
- false; \
- }
-install: $(docdir)/manual/index.html
-
-# Generate 'nix' manpages.
-.PHONY: manpages
-manpages: $(mandir)/man1/nix3-manpages
-install: $(mandir)/man1/nix3-manpages
-man: doc/manual/generated/man1/nix3-manpages
-all: doc/manual/generated/man1/nix3-manpages
-
-# FIXME: unify with how the other man pages are generated.
-# this one works differently and does not use any of the amenities provided by `/mk/lib.mk`.
-$(mandir)/man1/nix3-manpages: doc/manual/generated/man1/nix3-manpages
- @mkdir -p $(DESTDIR)$$(dirname $@)
- $(trace-install) install -m 0644 $$(dirname $<)/* $(DESTDIR)$$(dirname $@)
-
-doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
- @mkdir -p $(DESTDIR)$$(dirname $@)
- $(trace-gen) for i in doc/manual/src/command-ref/new-cli/*.md; do \
- name=$$(basename $$i .md); \
- tmpFile=$$(mktemp); \
- if [[ $$name = SUMMARY ]]; then continue; fi; \
- printf "Title: %s\n\n" "$$name" > $$tmpFile; \
- cat $$i >> $$tmpFile; \
- lowdown -sT man --nroff-nolinks -M section=1 $$tmpFile -o $(DESTDIR)$$(dirname $@)/$$name.1; \
- rm $$tmpFile; \
- done
- @touch $@
-
-# the `! -name 'documentation.md'` filter excludes the one place where
-# `@docroot@` is to be preserved for documenting the mechanism
-# FIXME: maybe contributing guides should live right next to the code
-# instead of in the manual
-$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/anchors.jq $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/store/types $(d)/src/command-ref/new-cli $(d)/src/development/experimental-feature-descriptions.md $(d)/src/command-ref/conf-file.md $(d)/src/language/builtins.md $(d)/src/release-notes/rl-next.md $(d)/src/figures $(d)/src/favicon.png $(d)/src/favicon.svg
- $(trace-gen) \
- tmp="$$(mktemp -d)"; \
- cp -r doc/manual "$$tmp"; \
- find "$$tmp" -name '*.md' | while read -r file; do \
- $(call process-includes,$$file,$$file); \
- done; \
- find "$$tmp" -name '*.md' ! -name 'documentation.md' | while read -r file; do \
- docroot="$$(realpath --relative-to="$$(dirname "$$file")" $$tmp/manual/src)"; \
- sed -i "s,@docroot@,$$docroot,g" "$$file"; \
- done; \
- set -euo pipefail; \
- RUST_LOG=warn mdbook build "$$tmp/manual" -d $(DESTDIR)$(docdir)/manual.tmp 2>&1 \
- | { grep -Fv "because fragment resolution isn't implemented" || :; }; \
- rm -rf "$$tmp/manual"
- @rm -rf $(DESTDIR)$(docdir)/manual
- @mv $(DESTDIR)$(docdir)/manual.tmp/html $(DESTDIR)$(docdir)/manual
- @rm -rf $(DESTDIR)$(docdir)/manual.tmp
diff --git a/doc/manual/meson.build b/doc/manual/meson.build
new file mode 100644
index 00000000000..3630e2dc828
--- /dev/null
+++ b/doc/manual/meson.build
@@ -0,0 +1,353 @@
+project('nix-manual',
+ version : files('.version'),
+ meson_version : '>= 1.1',
+ license : 'LGPL-2.1-or-later',
+)
+
+nix = find_program('nix', native : true)
+
+mdbook = find_program('mdbook', native : true)
+bash = find_program('bash', native : true)
+
+pymod = import('python')
+python = pymod.find_installation('python3')
+
+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']
+nix_eval_for_docs_common = nix_for_docs + [
+ 'eval',
+ '-I', 'nix=' + meson.current_source_dir(),
+ '--store', 'dummy://',
+ '--impure',
+]
+nix_eval_for_docs = nix_eval_for_docs_common + '--raw'
+
+conf_file_json = custom_target(
+ command : nix_for_docs + ['config', 'show', '--json'],
+ capture : true,
+ output : 'conf-file.json',
+ env : nix_env_for_docs,
+)
+
+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',
+ env : nix_env_for_docs,
+)
+
+generate_manual_deps = files(
+ 'generate-deps.py',
+)
+
+# Generates types
+subdir('source/store')
+# Generates builtins.md and builtin-constants.md.
+subdir('source/language')
+# Generates new-cli pages, experimental-features-shortlist.md, and conf-file.md.
+subdir('source/command-ref')
+# Generates experimental-feature-descriptions.md.
+subdir('source/development')
+# Generates rl-next-generated.md.
+subdir('source/release-notes')
+subdir('source')
+
+# Hacky way to figure out if `nix` is an `ExternalProgram` or
+# `Exectuable`. Only the latter can occur in custom target input lists.
+if nix.full_path().startswith(meson.build_root())
+ nix_input = nix
+else
+ nix_input = []
+endif
+
+manual = custom_target(
+ 'manual',
+ command : [
+ 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
+ rsync -r --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
+ find @2@/manual -iname meson.build -delete
+ '''.format(
+ python.full_path(),
+ mdbook.full_path(),
+ meson.current_build_dir(),
+ ),
+ ],
+ input : [
+ generate_manual_deps,
+ 'substitute.py',
+ 'book.toml',
+ '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,
+ nix_input,
+ ],
+ output : [
+ 'manual',
+ 'markdown',
+ ],
+ depfile : 'manual.d',
+ env : {
+ 'RUST_LOG': 'info',
+ 'MDBOOK_SUBSTITUTE_SEARCH': meson.current_build_dir() / 'source',
+ },
+)
+manual_html = manual[0]
+manual_md = manual[1]
+
+install_subdir(
+ manual_html.full_path(),
+ install_dir : get_option('datadir') / 'doc/nix',
+)
+
+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]
+ title = command[0] + ' --' + page
+ section = '1'
+ custom_target(
+ command : [
+ bash,
+ files('./render-manpage.sh'),
+ '--out-no-smarty',
+ title,
+ section,
+ '@INPUT0@/command-ref' / command[0] / (page + '.md'),
+ '@OUTPUT0@',
+ ],
+ input : [
+ manual_md,
+ nix_input,
+ ],
+ output : command[0] + '-' + page + '.1',
+ install : true,
+ install_dir : get_option('mandir') / 'man1',
+ )
+ endforeach
+endforeach
+
+nix3_manpages = [
+ 'nix3-build',
+ 'nix3-bundle',
+ 'nix3-config',
+ 'nix3-config-show',
+ '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
+ section = '1'
+ custom_target(
+ command : [
+ bash,
+ '@INPUT0@',
+ page,
+ section,
+ '@INPUT1@/command-ref/new-cli/@0@.md'.format(page),
+ '@OUTPUT@',
+ ],
+ input : [
+ files('./render-manpage.sh'),
+ manual_md,
+ nix_input,
+ ],
+ output : page + '.1',
+ install : true,
+ install_dir : get_option('mandir') / 'man1',
+ )
+endforeach
+
+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 ],
+ [ 'nix.conf', 5, conf_file_md.full_path() ],
+ [ 'nix-daemon', 8 ],
+ [ 'nix-profiles', 5, 'files/profiles.md' ],
+]
+
+foreach entry : nix_manpages
+ 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()
+ md_file_resolved = join_paths('@INPUT1@/command-ref/', md_file)
+ custom_target(
+ command : [
+ bash,
+ '@INPUT0@',
+ title,
+ section,
+ md_file_resolved,
+ '@OUTPUT@',
+ ],
+ input : [
+ files('./render-manpage.sh'),
+ manual_md,
+ entry.get(3, []),
+ nix_input,
+ ],
+ output : '@0@.@1@'.format(entry[0], entry[1]),
+ install : true,
+ install_dir : get_option('mandir') / 'man@0@'.format(entry[1]),
+ )
+endforeach
diff --git a/doc/manual/package.nix b/doc/manual/package.nix
new file mode 100644
index 00000000000..2e6fcede3f7
--- /dev/null
+++ b/doc/manual/package.nix
@@ -0,0 +1,71 @@
+{ lib
+, mkMesonDerivation
+
+, meson
+, ninja
+, lowdown
+, mdbook
+, mdbook-linkcheck
+, jq
+, python3
+, rsync
+, nix-cli
+
+# Configuration Options
+
+, version
+}:
+
+let
+ inherit (lib) fileset;
+in
+
+mkMesonDerivation (finalAttrs: {
+ pname = "nix-manual";
+ inherit version;
+
+ workDir = ./.;
+ fileset = fileset.difference
+ (fileset.unions [
+ ../../.version
+ # Too many different types of files to filter for now
+ ../../doc/manual
+ ./.
+ ])
+ # Do a blacklist instead
+ ../../doc/manual/package.nix;
+
+ # TODO the man pages should probably be separate
+ outputs = [ "out" "man" ];
+
+ # Hack for sake of the dev shell
+ passthru.externalNativeBuildInputs = [
+ meson
+ ninja
+ (lib.getBin lowdown)
+ mdbook
+ mdbook-linkcheck
+ jq
+ python3
+ rsync
+ ];
+
+ nativeBuildInputs = finalAttrs.passthru.externalNativeBuildInputs ++ [
+ nix-cli
+ ];
+
+ preConfigure =
+ ''
+ chmod u+w ./.version
+ echo ${finalAttrs.version} > ./.version
+ '';
+
+ postInstall = ''
+ mkdir -p ''$out/nix-support
+ echo "doc manual ''$out/share/doc/nix/manual" >> ''$out/nix-support/hydra-build-products
+ '';
+
+ meta = {
+ platforms = lib.platforms.all;
+ };
+})
diff --git a/doc/manual/redirects.js b/doc/manual/redirects.js
index cb8cd18fa14..dea141391df 100644
--- a/doc/manual/redirects.js
+++ b/doc/manual/redirects.js
@@ -1,7 +1,7 @@
// 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 src/_redirects for path redirects (server-side)
+// 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.
diff --git a/doc/manual/remove_before_wrapper.py b/doc/manual/remove_before_wrapper.py
new file mode 100644
index 00000000000..6da4c19b0ce
--- /dev/null
+++ b/doc/manual/remove_before_wrapper.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+import shutil
+import typing as t
+
+def main():
+ if len(sys.argv) < 4 or '--' not in sys.argv:
+ print("Usage: remove-before-wrapper