diff --git a/configure.ac b/configure.ac index f98a0a5..41a55fc 100644 --- a/configure.ac +++ b/configure.ac @@ -421,7 +421,8 @@ 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 +if test ${cross_compiling:-no} = no && test -n "${sandbox_shell}" && + test -z "${sandbox_shell%%*busybox*}"; 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 diff --git a/doc/manual/local.mk b/doc/manual/local.mk index 71ad5c8..8e7d5a0 100644 --- a/doc/manual/local.mk +++ b/doc/manual/local.mk @@ -24,15 +24,18 @@ 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 +clean-files += $(d)/*.1 $(d)/generated/man1/*.1 $(d)/*.5 $(d)/*.8 +clean-files += $(d)/*.json # 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 +dum_DIR := $(realpath $(nix_DIR)) + dummy-env = env -i \ - HOME=/dummy \ - NIX_CONF_DIR=/dummy \ - NIX_SSL_CERT_FILE=/dummy/no-ca-bundle.crt \ - NIX_STATE_DIR=/dummy \ + HOME=$(dum_DIR)/dummy \ + NIX_CONF_DIR=$(dum_DIR)/dummy \ + NIX_SSL_CERT_FILE=$(dum_DIR)/dummy/no-ca-bundle.crt \ + NIX_STATE_DIR=$(dum_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 @@ -111,11 +114,15 @@ $(d)/src/command-ref/new-cli: $(d)/nix.json $(d)/utils.nix $(d)/generate-manpage $(trace-gen) $(nix-eval) --write-to $@.tmp --expr 'import doc/manual/generate-manpage.nix true (builtins.readFile $<)' @mv $@.tmp $@ +clean-files += $(d)/src/command-ref/new-cli/*.md + $(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 $@ +clean-files += $(d)/src/command-ref/conf-file.md + $(d)/nix.json: $(doc_nix) $(trace-gen) $(dummy-env) $(doc_nix) __dump-cli > $@.tmp @mv $@.tmp $@ @@ -124,36 +131,50 @@ $(d)/conf-file.json: $(doc_nix) $(trace-gen) $(dummy-env) $(doc_nix) config show --json --experimental-features nix-command > $@.tmp @mv $@.tmp $@ +clean-files += $(d)/conf-file.json + $(d)/src/contributing/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 $@ +clean-files += $(d)/src/contributing/experimental-feature-descriptions.md + $(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 $@ +clean-files += $(d)/src/command-ref/experimental-features-shortlist.md + $(d)/xp-features.json: $(doc_nix) $(trace-gen) $(dummy-env) $(doc_nix) __dump-xp-features > $@.tmp @mv $@.tmp $@ +clean-files += $(d)/xp-features.json + $(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 $<)).builtins' >> $@.tmp; @cat doc/manual/src/language/builtins-suffix.md >> $@.tmp @mv $@.tmp $@ +clean-files += $(d)/src/language/builtins.md + $(d)/src/language/builtin-constants.md: $(d)/language.json $(d)/generate-builtin-constants.nix $(d)/src/language/builtin-constants-prefix.md $(doc_nix) @cat doc/manual/src/language/builtin-constants-prefix.md > $@.tmp $(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtin-constants.nix (builtins.fromJSON (builtins.readFile $<)).constants' >> $@.tmp; @cat doc/manual/src/language/builtin-constants-suffix.md >> $@.tmp @mv $@.tmp $@ +clean-files += $(d)/src/language/builtin-constants.md + $(d)/language.json: $(doc_nix) $(trace-gen) $(dummy-env) $(doc_nix) __dump-language > $@.tmp @mv $@.tmp $@ +clean-files += $(d)/language.json + # 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 \ @@ -164,6 +185,8 @@ $(d)/src/release-notes/rl-next.md: $(d)/rl-next $(d)/rl-next/* true > $@; \ fi +clean-files += $(d)/src/release-notes/rl-next.md + $(d)/src/SUMMARY-rl-next.md: $(d)/src/release-notes/rl-next.md $(trace-gen) true @if [ -s $< ]; then \ @@ -172,6 +195,8 @@ $(d)/src/SUMMARY-rl-next.md: $(d)/src/release-notes/rl-next.md true > $@; \ fi +clean-files += $(d)/src/SUMMARY-rl-next.md + # Generate the HTML manual. .PHONY: manual-html manual-html: $(docdir)/manual/index.html @@ -218,20 +243,3 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli # 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/contributing/experimental-feature-descriptions.md $(d)/src/command-ref/conf-file.md $(d)/src/language/builtins.md $(d)/src/language/builtin-constants.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/src/libexpr/local.mk b/src/libexpr/local.mk index ecadc5e..26e875e 100644 --- a/src/libexpr/local.mk +++ b/src/libexpr/local.mk @@ -37,7 +37,13 @@ $(d)/parser-tab.cc $(d)/parser-tab.hh: $(d)/parser.y $(d)/lexer-tab.cc $(d)/lexer-tab.hh: $(d)/lexer.l $(trace-gen) flex --outfile $(libexpr_DIR)/lexer-tab.cc --header-file=$(libexpr_DIR)/lexer-tab.hh $< -clean-files += $(d)/parser-tab.cc $(d)/parser-tab.hh $(d)/lexer-tab.cc $(d)/lexer-tab.hh +clean-files += \ + $(d)/fetchurl.nix.gen.hh \ + $(d)/flake/call-flake.nix.gen.hh \ + $(d)/imported-drv-to-derivation.nix.gen.hh \ + $(d)/primops/derivation.nix.gen.hh \ + $(d)/parser-tab.cc $(d)/parser-tab.hh $(d)/parser-tab.output \ + $(d)/lexer-tab.cc $(d)/lexer-tab.hh $(eval $(call install-file-in, $(buildprefix)$(d)/nix-expr.pc, $(libdir)/pkgconfig, 0644)) diff --git a/src/libexpr/primops/fromTOML.cc b/src/libexpr/primops/fromTOML.cc index 9bee8ca..a74cbaa 100644 --- a/src/libexpr/primops/fromTOML.cc +++ b/src/libexpr/primops/fromTOML.cc @@ -1,7 +1,7 @@ #include "primops.hh" #include "eval-inline.hh" -#include "../../toml11/toml.hpp" +#include "toml.hpp" #include diff --git a/src/libutil/ref.hh b/src/libutil/ref.hh index 03aa642..e2bf37a 100644 --- a/src/libutil/ref.hh +++ b/src/libutil/ref.hh @@ -25,14 +25,14 @@ public: : p(r.p) { } - explicit ref(const std::shared_ptr & p) + explicit ref(const std::shared_ptr & p) : p(p) { if (!p) throw std::invalid_argument("null pointer cast to ref"); } - explicit ref(T * p) + explicit ref(T * p) : p(p) { if (!p) diff --git a/src/nix/local.mk b/src/nix/local.mk index 9883509..f439aba 100644 --- a/src/nix/local.mk +++ b/src/nix/local.mk @@ -42,22 +42,34 @@ $(eval $(call install-symlink, $(bindir)/nix, $(libexecdir)/nix/build-remote)) src/nix-env/user-env.cc: src/nix-env/buildenv.nix.gen.hh +clean-files += src/nix-env/buildenv.nix.gen.hh + src/nix/develop.cc: src/nix/get-env.sh.gen.hh +clean-files += src/nix/get-env.sh.gen.hh + src/nix-channel/nix-channel.cc: src/nix-channel/unpack-channel.nix.gen.hh +clean-files += src/nix-channel/unpack-channel.nix.gen.hh + src/nix/main.cc: \ doc/manual/generate-manpage.nix.gen.hh \ doc/manual/utils.nix.gen.hh doc/manual/generate-settings.nix.gen.hh \ doc/manual/generate-store-info.nix.gen.hh \ src/nix/generated-doc/help-stores.md +clean-files += doc/manual/generate-manpage.nix.gen.hh \ + doc/manual/utils.nix.gen.hh doc/manual/generate-settings.nix.gen.hh \ + doc/manual/generate-store-info.nix.gen.hh + src/nix/generated-doc/files/%.md: doc/manual/src/command-ref/files/%.md @mkdir -p $$(dirname $@) @cp $< $@ src/nix/profile.cc: src/nix/profile.md src/nix/generated-doc/files/profiles.md.gen.hh +clean-files += src/nix/doc/files/profiles.md.gen.hh + src/nix/generated-doc/help-stores.md: doc/manual/src/store/types/index.md.in @mkdir -p $$(dirname $@) @echo 'R"(' >> $@.tmp