From e93607e502e8fdd7fbfa42ed9945b7c196b2ce5a Mon Sep 17 00:00:00 2001 From: Pouria Rezaei Date: Sun, 30 Jun 2024 23:16:48 +0330 Subject: [PATCH] system/nix: Updated to 2.15.3. Signed-off-by: Pouria Rezaei --- system/nix/fix_nix_options.patch | 195 +++++++++++++++++++++++++------ system/nix/nix.SlackBuild | 8 +- system/nix/nix.info | 8 +- 3 files changed, 169 insertions(+), 42 deletions(-) diff --git a/system/nix/fix_nix_options.patch b/system/nix/fix_nix_options.patch index 6cbbd156b..181a8f641 100644 --- a/system/nix/fix_nix_options.patch +++ b/system/nix/fix_nix_options.patch @@ -1,40 +1,36 @@ diff --git a/doc/manual/local.mk b/doc/manual/local.mk -index f43510b..1e1e62d 100644 +index 63e7e61..e131bde 100644 --- a/doc/manual/local.mk +++ b/doc/manual/local.mk -@@ -24,7 +24,7 @@ dummy-env = env -i \ +@@ -31,7 +31,7 @@ dummy-env = env -i \ NIX_STATE_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 - $(d)/%.1: $(d)/src/command-ref/%.md - @printf "Title: %s\n\n" "$$(basename $@ .1)" > $^.tmp -@@ -48,29 +48,29 @@ $(d)/src/SUMMARY.md: $(d)/src/SUMMARY.md.in $(d)/src/command-ref/new-cli - $(trace-gen) cat doc/manual/src/SUMMARY.md.in | while IFS= read line; do if [[ $$line = @manpages@ ]]; then cat doc/manual/src/command-ref/new-cli/SUMMARY.md; else echo "$$line"; fi; done > $@.tmp - @mv $@.tmp $@ + # re-implement mdBook's include directive to make it usable for terminal output and for proper @docroot@ substitution + define process-includes +@@ -89,46 +89,46 @@ $(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)/generate-manpage.nix $(bindir)/nix -+$(d)/src/command-ref/new-cli: $(d)/nix.json $(d)/generate-manpage.nix $(nix_DIR)/nix - @rm -rf $@ - $(trace-gen) $(nix-eval) --write-to $@.tmp --expr 'import doc/manual/generate-manpage.nix { toplevel = builtins.readFile $<; }' - @# @docroot@: https://nixos.org/manual/nix/unstable/contributing/hacking.html#docroot-variable - $(trace-gen) sed -i $@.tmp/*.md -e 's^@docroot@^../..^g' +-$(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)/generate-options.nix $(d)/src/command-ref/conf-file-prefix.md $(bindir)/nix -+$(d)/src/command-ref/conf-file.md: $(d)/conf-file.json $(d)/generate-options.nix $(d)/src/command-ref/conf-file-prefix.md $(nix_DIR)/nix +-$(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 ++$(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 - @# @docroot@: https://nixos.org/manual/nix/unstable/contributing/hacking.html#docroot-variable - $(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-options.nix (builtins.fromJSON (builtins.readFile $<))' \ - | sed -e 's^@docroot@^..^g'>> $@.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-args > $@.tmp +- $(trace-gen) $(dummy-env) $(bindir)/nix __dump-cli > $@.tmp +$(d)/nix.json: $(nix_DIR)/nix -+ $(trace-gen) $(dummy-env) $(nix_DIR)/nix __dump-args > $@.tmp ++ $(trace-gen) $(dummy-env) $(nix_DIR)/nix __dump-cli > $@.tmp @mv $@.tmp $@ -$(d)/conf-file.json: $(bindir)/nix @@ -43,12 +39,28 @@ index f43510b..1e1e62d 100644 + $(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 ++$(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 ++$(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)/builtins.json $(d)/generate-builtins.nix $(d)/src/language/builtins-prefix.md $(bindir)/nix +$(d)/src/language/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d)/src/language/builtins-prefix.md $(nix_DIR)/nix @cat doc/manual/src/language/builtins-prefix.md > $@.tmp - @# @docroot@: https://nixos.org/manual/nix/unstable/contributing/hacking.html#docroot-variable - $(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtins.nix (builtins.fromJSON (builtins.readFile $<))' \ -@@ -78,8 +78,8 @@ $(d)/src/language/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d + $(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 $@ @@ -60,34 +72,54 @@ index f43510b..1e1e62d 100644 # Generate the HTML manual. diff --git a/doc/manual/local.mk b/doc/manual/local.mk -index 1e1e62d..3978847 100644 +index e131bde..ba2460d 100644 --- a/doc/manual/local.mk +++ b/doc/manual/local.mk -@@ -109,12 +109,12 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli +@@ -161,22 +161,22 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli @touch $@ - $(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/anchors.jq $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/language/builtins.md + $(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/anchors.jq $(d)/custom.css $(d)/src/SUMMARY.md $(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 - $(trace-gen) \ -- set -euo pipefail; \ -- RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual.tmp 2>&1 \ -- | { grep -Fv "because fragment resolution isn't implemented" || :; } +- 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' | 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 + # $(trace-gen) \ -+ # set -euo pipefail; \ -+ # RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual.tmp 2>&1 \ -+ # | { grep -Fv "because fragment resolution isn't implemented" || :; } ++ # 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' | 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 endif diff --git a/Makefile b/Makefile -index c1a1ce2..3ec1423 100644 +index d6b4947..aead461 100644 --- a/Makefile +++ b/Makefile -@@ -34,6 +34,8 @@ else +@@ -42,6 +42,8 @@ else GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE endif @@ -95,7 +127,7 @@ index c1a1ce2..3ec1423 100644 + include mk/lib.mk - GLOBAL_CXXFLAGS += -g -Wall -include config.h -std=c++17 -I src + GLOBAL_CXXFLAGS += -g -Wall -include config.h -std=c++2a -I src diff --git a/src/libstore/sqlite.cc b/src/libstore/sqlite.cc index 871f2f3..21897d0 100644 --- a/src/libstore/sqlite.cc @@ -109,3 +141,96 @@ index 871f2f3..21897d0 100644 auto path = sqlite3_db_filename(db, nullptr); auto errMsg = sqlite3_errmsg(db); +diff --git a/flake.nix b/flake.nix +index 71f6270..86c0a4f 100644 +--- a/flake.nix ++++ b/flake.nix +@@ -540,6 +540,8 @@ + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = ["fortify"]; ++ ++ NIX_CFLAGS_COMPILE = "-DCOVERAGE=1"; + }; + + # API docs for Nix's unstable internal C++ interfaces. +diff --git a/src/libexpr/tests/value/context.cc b/src/libexpr/tests/value/context.cc +index 083359b..88b3f32 100644 +--- a/src/libexpr/tests/value/context.cc ++++ b/src/libexpr/tests/value/context.cc +@@ -116,6 +116,8 @@ Gen Arbitrary::arbitrary() + + namespace nix { + ++#ifndef COVERAGE ++ + RC_GTEST_FIXTURE_PROP( + NixStringContextElemTest, + prop_round_rip, +@@ -124,4 +126,6 @@ RC_GTEST_FIXTURE_PROP( + RC_ASSERT(o == NixStringContextElem::parse(store(), o.to_string(store()))); + } + ++#endif ++ + } +diff --git a/src/libstore/tests/derived-path.cc b/src/libstore/tests/derived-path.cc +index e6d32db..343f7aa 100644 +--- a/src/libstore/tests/derived-path.cc ++++ b/src/libstore/tests/derived-path.cc +@@ -51,6 +51,8 @@ TEST_F(DerivedPathTest, force_init) + { + } + ++#ifndef COVERAGE ++ + RC_GTEST_FIXTURE_PROP( + DerivedPathTest, + prop_legacy_round_rip, +@@ -67,4 +69,6 @@ RC_GTEST_FIXTURE_PROP( + RC_ASSERT(o == DerivedPath::parse(*store, o.to_string(*store))); + } + ++#endif ++ + } +diff --git a/src/libstore/tests/outputs-spec.cc b/src/libstore/tests/outputs-spec.cc +index 984d1d9..2832cef 100644 +--- a/src/libstore/tests/outputs-spec.cc ++++ b/src/libstore/tests/outputs-spec.cc +@@ -222,6 +222,8 @@ Gen Arbitrary::arbitrary() + + namespace nix { + ++#ifndef COVERAGE ++ + RC_GTEST_PROP( + OutputsSpec, + prop_round_rip, +@@ -230,4 +232,6 @@ RC_GTEST_PROP( + RC_ASSERT(o == OutputsSpec::parse(o.to_string())); + } + ++#endif ++ + } +diff --git a/src/libstore/tests/path.cc b/src/libstore/tests/path.cc +index 430aa00..efa35ef 100644 +--- a/src/libstore/tests/path.cc ++++ b/src/libstore/tests/path.cc +@@ -134,6 +134,8 @@ Gen Arbitrary::arbitrary() + + namespace nix { + ++#ifndef COVERAGE ++ + RC_GTEST_FIXTURE_PROP( + StorePathTest, + prop_regex_accept, +@@ -150,4 +152,6 @@ RC_GTEST_FIXTURE_PROP( + RC_ASSERT(p == store->parseStorePath(store->printStorePath(p))); + } + ++#endif ++ + } diff --git a/system/nix/nix.SlackBuild b/system/nix/nix.SlackBuild index eb920d550..4abff9ce6 100644 --- a/system/nix/nix.SlackBuild +++ b/system/nix/nix.SlackBuild @@ -46,7 +46,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=nix -VERSION=${VERSION:-2.13.6} +VERSION=${VERSION:-2.15.3} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -99,12 +99,13 @@ find -L . \ # - 20220325 bkw: patch from Debian, stops nix from installing # /usr/bin/nix and its libraries during "make". spamming the real -# root partition is bad, m'kay? (Updated) +# root partition is bad, m'kay? (Updated). # - The above patch was added thanks to Pragmatic Cypher, along with # mdbook patch to make it disabled. -# - Added global CFLAGS +# - Added global CFLAGS. # - Changed to ignore offset, since function hasn't still implemented # in Slackware 15's sqlite. +# - Disabled rapidcheck tests in the coverage run. patch -p1 < $CWD/fix_nix_options.patch autoreconf -vfim @@ -117,6 +118,7 @@ CXXFLAGS="$SLKCFLAGS" \ --mandir=/usr/man \ --docdir=/usr/doc/$PRGNAM-$VERSION \ --sysconfdir=/etc \ + --enable-static=rapidcheck \ --build=$ARCH-slackware-linux \ --host=$ARCH-slackware-linux diff --git a/system/nix/nix.info b/system/nix/nix.info index c76e6d590..f11da9c8c 100644 --- a/system/nix/nix.info +++ b/system/nix/nix.info @@ -1,10 +1,10 @@ PRGNAM="nix" -VERSION="2.13.6" +VERSION="2.15.3" HOMEPAGE="http://nixos.org/nix" -DOWNLOAD="https://github.com/NixOS/nix/archive/2.13.6/nix-2.13.6.tar.gz" -MD5SUM="8fd7108b28c2716e87bbac8797de46a1" +DOWNLOAD="https://github.com/NixOS/nix/archive/2.15.3/nix-2.15.3.tar.gz" +MD5SUM="2b5404f762f40f116fb57226001a7933" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="graphviz gtest jq libeditline lowdown libcpuid nlohmann_json" +REQUIRES="graphviz gtest jq libcpuid libeditline librapidcheck lowdown nlohmann_json" MAINTAINER="Pouria Rezaei" EMAIL="Pouria.rz@outlook.com"