diff options
Diffstat (limited to 'system/nix/config/fix_nix_options.patch')
-rw-r--r-- | system/nix/config/fix_nix_options.patch | 226 |
1 files changed, 226 insertions, 0 deletions
diff --git a/system/nix/config/fix_nix_options.patch b/system/nix/config/fix_nix_options.patch new file mode 100644 index 0000000000..a9e3e1d4f0 --- /dev/null +++ b/system/nix/config/fix_nix_options.patch @@ -0,0 +1,226 @@ +diff --git a/configure.ac b/configure.ac +index 6d78237..b1bb516 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -341,7 +341,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 abdfd6a..3745106 100644 +--- a/doc/manual/local.mk ++++ b/doc/manual/local.mk +@@ -21,18 +21,21 @@ 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 show-config 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) $(bindir)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --store dummy:// --impure --raw ++nix-eval = $(dummy-env) $(nix_DIR)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --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 +@@ -96,54 +99,70 @@ $(d)/src/SUMMARY.md: $(d)/src/SUMMARY.md.in $(d)/src/command-ref/new-cli $(d)/sr + @cp $< $@ + @$(call process-includes,$@,$@) + +-$(d)/src/command-ref/new-cli: $(d)/nix.json $(d)/utils.nix $(d)/generate-manpage.nix $(bindir)/nix ++$(d)/src/command-ref/new-cli: $(d)/nix.json $(d)/utils.nix $(d)/generate-manpage.nix $(nix_DIR)/nix + @rm -rf $@ $@.tmp + $(trace-gen) $(nix-eval) --write-to $@.tmp --expr 'import doc/manual/generate-manpage.nix (builtins.readFile $<)' + @mv $@.tmp $@ + +-$(d)/src/command-ref/conf-file.md: $(d)/conf-file.json $(d)/utils.nix $(d)/src/command-ref/conf-file-prefix.md $(d)/src/command-ref/experimental-features-shortlist.md $(bindir)/nix ++clean-files += $(d)/src/command-ref/new-cli/*.md ++ ++$(d)/src/command-ref/conf-file.md: $(d)/conf-file.json $(d)/utils.nix $(d)/src/command-ref/conf-file-prefix.md $(d)/src/command-ref/experimental-features-shortlist.md $(nix_DIR)/nix + @cat doc/manual/src/command-ref/conf-file-prefix.md > $@.tmp + $(trace-gen) $(nix-eval) --expr '(import doc/manual/utils.nix).showSettings { useAnchors = true; } (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp; + @mv $@.tmp $@ + +-$(d)/nix.json: $(bindir)/nix +- $(trace-gen) $(dummy-env) $(bindir)/nix __dump-cli > $@.tmp ++clean-files += $(d)/src/command-ref/conf-file.md ++ ++$(d)/nix.json: $(nix_DIR)/nix ++ $(trace-gen) $(dummy-env) $(nix_DIR)/nix __dump-cli > $@.tmp + @mv $@.tmp $@ + +-$(d)/conf-file.json: $(bindir)/nix +- $(trace-gen) $(dummy-env) $(bindir)/nix show-config --json --experimental-features nix-command > $@.tmp ++$(d)/conf-file.json: $(nix_DIR)/nix ++ $(trace-gen) $(dummy-env) $(nix_DIR)/nix show-config --json --experimental-features nix-command > $@.tmp + @mv $@.tmp $@ + +-$(d)/src/contributing/experimental-feature-descriptions.md: $(d)/xp-features.json $(d)/utils.nix $(d)/generate-xp-features.nix $(bindir)/nix ++$(d)/src/contributing/experimental-feature-descriptions.md: $(d)/xp-features.json $(d)/utils.nix $(d)/generate-xp-features.nix $(nix_DIR)/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 $(bindir)/nix ++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 $(nix_DIR)/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: $(bindir)/nix +- $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-xp-features > $@.tmp ++clean-files += $(d)/src/command-ref/experimental-features-shortlist.md ++ ++$(d)/xp-features.json: $(nix_DIR)/nix ++ $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(nix_DIR)/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 $(bindir)/nix ++clean-files += $(d)/xp-features.json ++ ++$(d)/src/language/builtins.md: $(d)/language.json $(d)/generate-builtins.nix $(d)/src/language/builtins-prefix.md $(nix_DIR)/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 $@ + +-$(d)/src/language/builtin-constants.md: $(d)/language.json $(d)/generate-builtin-constants.nix $(d)/src/language/builtin-constants-prefix.md $(bindir)/nix ++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 $(nix_DIR)/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 $@ + +-$(d)/language.json: $(bindir)/nix +- $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-language > $@.tmp ++clean-files += $(d)/src/language/builtin-constants.md ++ ++$(d)/language.json: $(nix_DIR)/nix ++ $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(nix_DIR)/nix __dump-language > $@.tmp + @mv $@.tmp $@ + ++clean-files += $(d)/language.json ++ + # Generate the HTML manual. + .PHONY: manual-html + manual-html: $(docdir)/manual/index.html +diff --git a/src/libexpr/local.mk b/src/libexpr/local.mk +index d243b9c..05572ea 100644 +--- a/src/libexpr/local.mk ++++ b/src/libexpr/local.mk +@@ -34,7 +34,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, $(d)/nix-expr.pc, $(libdir)/pkgconfig, 0644)) + +diff --git a/src/libexpr/primops/fromTOML.cc b/src/libexpr/primops/fromTOML.cc +index 2f4d402..08fbfc0 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 <sstream> + +diff --git a/src/libstore/sqlite.cc b/src/libstore/sqlite.cc +index 7c8decb..3f36374 100644 +--- a/src/libstore/sqlite.cc ++++ b/src/libstore/sqlite.cc +@@ -25,7 +25,7 @@ SQLiteError::SQLiteError(const char *path, const char *errMsg, int errNo, int ex + { + int err = sqlite3_errcode(db); + int exterr = sqlite3_extended_errcode(db); +- int offset = sqlite3_error_offset(db); ++ int offset = -1; + + auto path = sqlite3_db_filename(db, nullptr); + auto errMsg = sqlite3_errmsg(db); +diff --git a/src/libutil/ref.hh b/src/libutil/ref.hh +index af5f830..b0cf17d 100644 +--- a/src/libutil/ref.hh ++++ b/src/libutil/ref.hh +@@ -24,14 +24,14 @@ public: + : p(r.p) + { } + +- explicit ref<T>(const std::shared_ptr<T> & p) ++ explicit ref(const std::shared_ptr<T> & p) + : p(p) + { + if (!p) + throw std::invalid_argument("null pointer cast to ref"); + } + +- explicit ref<T>(T * p) ++ explicit ref(T * p) + : p(p) + { + if (!p) +diff --git a/src/nix/local.mk b/src/nix/local.mk +index 20ea29d..70eaeff 100644 +--- a/src/nix/local.mk ++++ b/src/nix/local.mk +@@ -27,14 +27,24 @@ $(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 + ++clean-files += doc/manual/generate-manpage.nix.gen.hh doc/manual/utils.nix.gen.hh ++ + src/nix/doc/files/%.md: doc/manual/src/command-ref/files/%.md + @mkdir -p $$(dirname $@) + @cp $< $@ + + src/nix/profile.cc: src/nix/profile.md src/nix/doc/files/profiles.md.gen.hh ++ ++clean-files += src/nix/doc/files/profiles.md.gen.hh |