From 594874994122081931fe9d27d8c2f8ce8f3ac80e Mon Sep 17 00:00:00 2001 From: root Date: Tue, 7 May 2024 16:09:09 +0200 Subject: [PATCH] sys-apps/nix: new package, add 2.15.0-r1 --- sys-apps/nix/Manifest | 8 + sys-apps/nix/files/nix-2.10-libpaths.patch | 48 ++++++ sys-apps/nix/files/nix-2.13.3-DESTDIR.patch | 107 ++++++++++++ sys-apps/nix/files/nix-2.15-DESTDIR.patch | 120 +++++++++++++ sys-apps/nix/files/nix-2.15-dummy.patch | 31 ++++ sys-apps/nix/files/nix-daemon.initd | 15 ++ sys-apps/nix/metadata.xml | 16 ++ sys-apps/nix/nix-2.15.0-r1.ebuild | 182 ++++++++++++++++++++ 8 files changed, 527 insertions(+) create mode 100644 sys-apps/nix/Manifest create mode 100644 sys-apps/nix/files/nix-2.10-libpaths.patch create mode 100644 sys-apps/nix/files/nix-2.13.3-DESTDIR.patch create mode 100644 sys-apps/nix/files/nix-2.15-DESTDIR.patch create mode 100644 sys-apps/nix/files/nix-2.15-dummy.patch create mode 100644 sys-apps/nix/files/nix-daemon.initd create mode 100644 sys-apps/nix/metadata.xml create mode 100644 sys-apps/nix/nix-2.15.0-r1.ebuild diff --git a/sys-apps/nix/Manifest b/sys-apps/nix/Manifest new file mode 100644 index 0000000..39045fb --- /dev/null +++ b/sys-apps/nix/Manifest @@ -0,0 +1,8 @@ +AUX nix-2.10-libpaths.patch 2870 BLAKE2B a586fbc4c6e9369f6f34cbe48ded6e6fb424dff0c1aa2c49b91071da7ae6f50ea1ccbc230358e08434993b8473614c2fcbcebe81f116cdfb116e370b0cafecd3 SHA512 5167a5fa9642217cf8d321eefffd97955885b693e96240fa3ab9148c18f727b9d0e013f875d39191e856effc3d6f9ed37363767df7c5342a7218a0426eff5f68 +AUX nix-2.13.3-DESTDIR.patch 5841 BLAKE2B e65e4f829a2e448d85e7cf76fa5b103eeb697940186bd520b0e65b0c1126c9189d9acc20b3758872792a4ec9edbe12f323c7545501f9e8a2c729a93c79e35087 SHA512 0ef56dfb19e26d2c2324a234b255c27b1be600e0073813873c36b93663283567a5734b3215882b18b1dd165dd65cae3b76cb972f6162a031c1669aa50d8181df +AUX nix-2.15-DESTDIR.patch 6707 BLAKE2B 6d6dea357c91e03f62487bb68f40dec6e16895525150d36088fb03fbca8bba160e49e8b88ea215ec441e3419f27e0a143277b80536e11b8f6e51a91d01688b7a SHA512 b22f44f9c924d4bd1a26e52476ea7b1e2904663bbc04fdab906fd5046de52cdb1e6c6e945ee1ddb445f23be72e31d6195f4591cbb6c477478b3a2584a8b81787 +AUX nix-2.15-dummy.patch 1097 BLAKE2B 519469e98092db8e9403e3853447e84af5db0592166e05598020919f2bcc251a9e289ebdf75aeea3d81cbf62b64f9c1056967df69e3b1dca9334ff61a05c39a6 SHA512 a30bad40cd8792c6de539652cbe3dd0396c8990c7801abb939f3d7f10c8dbe5691fbc14d846c631aeeff0f250c14c9b3bca07a1d4b6b131ff784809836ab6ab3 +AUX nix-daemon.initd 369 BLAKE2B bae15823ecd559733ebc8bd6f88314d93dccdf586dafe785ae58ed46949d1329c9bb7da93dc2918e2c0ccd3aacb50e3fdb380c019c85fb09f86575d9c80ce116 SHA512 e5a05a9f5efb179ebf3a98e58435a571e87716166a351045be4cbd19423e426cf11ed9b2eb2df6222d00e43e5d38fbed5da579820f776031e3c70de0206f980d +DIST nix-2.15.0.tar.gz 1290181 BLAKE2B 9b66f4741bdc6e868f2e96908d89fd221646b9705c308dc5c6e1b8c81678291e866dd76eb16aa52af1f0bc50af5d6e3663fc93c7262aab15dea50eb9b7ea7555 SHA512 c37d40c3f80ba04f0a0e20d5067fc9e4f908670f7bbabbc3c15f291116e024b6fb97fdb04b51378c5ba5c39487e8a949b12db163cef06cadcd521f1f6c6e6aa4 +EBUILD nix-2.15.0-r1.ebuild 4631 BLAKE2B 1b50bd4a64a4ff4144ccdbf5b8a205ad770a72a47e458f5ebe2762958d01a353f3fa6902c119a155749b25cc8665a5c7e04438e566f19db0a68ce056a8cafe56 SHA512 e613babd5f72aa68c25852f82079746cb7279edccd9d5fe1523719f4cc86247c4b354be3243db4718f7031b99b25926b2080afaa37f94e0b055fe4b45e567ef8 +MISC metadata.xml 639 BLAKE2B ea4831ea928d44ad1208f85498684fb3f55764fa0f63e8239736c54085405b12c90a25a5fa73876bca8fe4622fefa6069c1a9e1164dd9f3a11ec8ea5dfb9b130 SHA512 045e5892440c2fe9500de23608b0a72ee72740c267f330106d1017fc10d66d1e2abbbdd263c7b90fa5d5240c9ef6a23f94b3889d3230ba86c693487a9490b935 diff --git a/sys-apps/nix/files/nix-2.10-libpaths.patch b/sys-apps/nix/files/nix-2.10-libpaths.patch new file mode 100644 index 0000000..7665207 --- /dev/null +++ b/sys-apps/nix/files/nix-2.10-libpaths.patch @@ -0,0 +1,48 @@ +Workaround -L path order by passing local library paths before +systemwide paths to avoid pulling libnixstore.so from system +instead of locally-built library. + +The patch is not perfect because it passes LDFLAGS after local +libraries but it makes nix link correctly. + +Bug: https://github.com/NixOS/nix/issues/3087 +--- a/mk/libraries.mk ++++ b/mk/libraries.mk +@@ -91,7 +91,7 @@ define build-library + $(1)_PATH := $$(_d)/$$($(1)_NAME).$(SO_EXT) + + $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/ +- +$$(trace-ld) $(CXX) -o $$(abspath $$@) -shared $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $$($(1)_LDFLAGS_UNINSTALLED) ++ +$$(trace-ld) $(CXX) -o $$(abspath $$@) -shared $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $$($(1)_LDFLAGS_UNINSTALLED) $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) + + ifneq ($(OS), Darwin) + $(1)_LDFLAGS_USE += -Wl,-rpath,$$(abspath $$(_d)) +@@ -105,7 +105,7 @@ define build-library + $$(eval $$(call create-dir, $$($(1)_INSTALL_DIR))) + + $$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/ +- +$$(trace-ld) $(CXX) -o $$@ -shared $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED)) ++ +$$(trace-ld) $(CXX) -o $$@ -shared $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED)) $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) + + $(1)_LDFLAGS_USE_INSTALLED += -L$$(DESTDIR)$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME))) + ifneq ($(OS), Darwin) +--- a/mk/programs.mk ++++ b/mk/programs.mk +@@ -32,7 +32,7 @@ define build-program + $$(eval $$(call create-dir, $$(_d))) + + $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/ +- +$$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) ++ +$$(trace-ld) $(CXX) -o $$@ $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) + + $(1)_INSTALL_DIR ?= $$(bindir) + $(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$(1) +@@ -49,7 +49,7 @@ define build-program + _libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH)) + + $(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/ +- +$$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED)) ++ +$$(trace-ld) $(CXX) -o $$@ $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED)) $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) + + else + diff --git a/sys-apps/nix/files/nix-2.13.3-DESTDIR.patch b/sys-apps/nix/files/nix-2.13.3-DESTDIR.patch new file mode 100644 index 0000000..10974fa --- /dev/null +++ b/sys-apps/nix/files/nix-2.13.3-DESTDIR.patch @@ -0,0 +1,107 @@ +commit a43935b0ff667b8718a9a3363acd7f4619fc9bec +Author: Sergei Trofimovich +Date: Thu Feb 10 21:56:03 2022 +0000 + + Add basic DESTDIR= support + +diff --git a/doc/manual/local.mk b/doc/manual/local.mk +index f43510b6d..7cf63d730 100644 +--- a/doc/manual/local.mk ++++ b/doc/manual/local.mk +@@ -18,13 +18,14 @@ 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 show-config resolves the cores based on the current machine + dummy-env = env -i \ ++ LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \ + 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) $(bindir)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --store dummy:// --impure --raw ++nix-eval = $(dummy-env) $(DESTDIR)$(bindir)/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 +49,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 $@ + +-$(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 $(DESTDIR)$(bindir)/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' + @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 $(DESTDIR)$(bindir)/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 + @mv $@.tmp $@ + +-$(d)/nix.json: $(bindir)/nix +- $(trace-gen) $(dummy-env) $(bindir)/nix __dump-args > $@.tmp ++$(d)/nix.json: $(DESTDIR)$(bindir)/nix ++ $(trace-gen) $(dummy-env) $(DESTDIR)$(bindir)/nix __dump-args > $@.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: $(DESTDIR)$(bindir)/nix ++ $(trace-gen) $(dummy-env) $(DESTDIR)$(bindir)/nix show-config --json --experimental-features nix-command > $@.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 $(DESTDIR)$(bindir)/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,25 +79,25 @@ $(d)/src/language/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d + @cat doc/manual/src/language/builtins-suffix.md >> $@.tmp + @mv $@.tmp $@ + +-$(d)/builtins.json: $(bindir)/nix +- $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp ++$(d)/builtins.json: $(DESTDIR)$(bindir)/nix ++ $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(DESTDIR)$(bindir)/nix __dump-builtins > $@.tmp + @mv $@.tmp $@ + + # Generate the HTML manual. +-html: $(docdir)/manual/index.html +-install: $(docdir)/manual/index.html ++html: $(DESTDIR)$(docdir)/manual/index.html ++install: $(DESTDIR)$(docdir)/manual/index.html + + # Generate 'nix' manpages. +-install: $(mandir)/man1/nix3-manpages ++install: $(DESTDIR)$(mandir)/man1/nix3-manpages + man: doc/manual/generated/man1/nix3-manpages + all: doc/manual/generated/man1/nix3-manpages + +-$(mandir)/man1/nix3-manpages: doc/manual/generated/man1/nix3-manpages +- @mkdir -p $(DESTDIR)$$(dirname $@) +- $(trace-install) install -m 0644 $$(dirname $<)/* $(DESTDIR)$$(dirname $@) ++$(DESTDIR)$(mandir)/man1/nix3-manpages: doc/manual/generated/man1/nix3-manpages ++ @mkdir -p $$(dirname $@) ++ $(trace-install) install -m 0644 $$(dirname $<)/* $$(dirname $@) + + doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli +- @mkdir -p $(DESTDIR)$$(dirname $@) ++ @mkdir -p $$(dirname $@) + $(trace-gen) for i in doc/manual/src/command-ref/new-cli/*.md; do \ + name=$$(basename $$i .md); \ + tmpFile=$$(mktemp); \ +@@ -108,7 +109,7 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli + done + @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 ++$(DESTDIR)$(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 + $(trace-gen) \ + set -euo pipefail; \ + RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual.tmp 2>&1 \ diff --git a/sys-apps/nix/files/nix-2.15-DESTDIR.patch b/sys-apps/nix/files/nix-2.15-DESTDIR.patch new file mode 100644 index 0000000..fae1330 --- /dev/null +++ b/sys-apps/nix/files/nix-2.15-DESTDIR.patch @@ -0,0 +1,120 @@ +From 2b962dec1e8cad8205f31bf2c675a21c16e69199 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Thu, 10 Feb 2022 21:56:03 +0000 +Subject: [PATCH] Add basic DESTDIR= support + +--- + doc/manual/local.mk | 39 ++++++++++++++++++++------------------- + 1 file changed, 20 insertions(+), 19 deletions(-) + +diff --git a/doc/manual/local.mk b/doc/manual/local.mk +index 63e7e61e4..b64561097 100644 +--- a/doc/manual/local.mk ++++ b/doc/manual/local.mk +@@ -25,13 +25,14 @@ 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 show-config resolves the cores based on the current machine + dummy-env = env -i \ ++ LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \ + 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) $(bindir)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --store dummy:// --impure --raw ++nix-eval = $(dummy-env) $(DESTDIR)$(bindir)/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 +@@ -94,61 +95,61 @@ $(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 (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 ++$(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 $(DESTDIR)$(bindir)/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 ++$(d)/nix.json: $(DESTDIR)$(bindir)/nix ++ $(trace-gen) $(dummy-env) $(DESTDIR)$(bindir)/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: $(DESTDIR)$(bindir)/nix ++ $(trace-gen) $(dummy-env) $(DESTDIR)$(bindir)/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 $(DESTDIR)$(bindir)/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 $(DESTDIR)$(bindir)/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: $(DESTDIR)$(bindir)/nix ++ $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(DESTDIR)$(bindir)/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 $(DESTDIR)$(bindir)/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)/builtins.json: $(bindir)/nix +- $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp ++$(d)/builtins.json: $(DESTDIR)$(bindir)/nix ++ $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(DESTDIR)$(bindir)/nix __dump-builtins > $@.tmp + @mv $@.tmp $@ + + # Generate the HTML manual. + .PHONY: manual-html +-manual-html: $(docdir)/manual/index.html +-install: $(docdir)/manual/index.html ++manual-html: $(DESTDIR)$(docdir)/manual/index.html ++install: $(DESTDIR)$(docdir)/manual/index.html + + # Generate 'nix' manpages. +-install: $(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 ++$(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 $@) ++ @mkdir -p $$(dirname $@) + $(trace-gen) for i in doc/manual/src/command-ref/new-cli/*.md; do \ + name=$$(basename $$i .md); \ + tmpFile=$$(mktemp); \ +@@ -160,7 +161,7 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli + done + @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/contributing/experimental-feature-descriptions.md $(d)/src/command-ref/conf-file.md $(d)/src/language/builtins.md ++$(DESTDIR)$(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) \ + tmp="$$(mktemp -d)"; \ + cp -r doc/manual "$$tmp"; \ +-- +2.39.2 + diff --git a/sys-apps/nix/files/nix-2.15-dummy.patch b/sys-apps/nix/files/nix-2.15-dummy.patch new file mode 100644 index 0000000..53c2b00 --- /dev/null +++ b/sys-apps/nix/files/nix-2.15-dummy.patch @@ -0,0 +1,31 @@ +From c6f7481a0f9c9dfe4bc9a3b37e13c8415db71c0d Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Tue, 11 Apr 2023 22:49:14 +0100 +Subject: [PATCH] doc/manual/local.mk: prefix /dummy with temp dir + +--- + doc/manual/local.mk | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/doc/manual/local.mk b/doc/manual/local.mk +index b64561097..f999050fd 100644 +--- a/doc/manual/local.mk ++++ b/doc/manual/local.mk +@@ -26,10 +26,10 @@ clean-files += $(d)/*.1 $(d)/*.5 $(d)/*.8 + # Set cores to 0 because otherwise nix show-config resolves the cores based on the current machine + dummy-env = env -i \ + LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \ +- HOME=/dummy \ +- NIX_CONF_DIR=/dummy \ +- NIX_SSL_CERT_FILE=/dummy/no-ca-bundle.crt \ +- NIX_STATE_DIR=/dummy \ ++ HOME=$(T)/dummy \ ++ NIX_CONF_DIR=$(T)/dummy \ ++ NIX_SSL_CERT_FILE=$(T)/dummy/no-ca-bundle.crt \ ++ NIX_STATE_DIR=$(T)/dummy \ + NIX_CONFIG='cores = 0' + + nix-eval = $(dummy-env) $(DESTDIR)$(bindir)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --store dummy:// --impure --raw +-- +2.39.2 + diff --git a/sys-apps/nix/files/nix-daemon.initd b/sys-apps/nix/files/nix-daemon.initd new file mode 100644 index 0000000..1fd4273 --- /dev/null +++ b/sys-apps/nix/files/nix-daemon.initd @@ -0,0 +1,15 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --quiet --background --exec /usr/bin/nix-daemon + eend ${?} +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --quiet --exec /usr/bin/nix-daemon + eend ${?} +} diff --git a/sys-apps/nix/metadata.xml b/sys-apps/nix/metadata.xml new file mode 100644 index 0000000..76fa1a1 --- /dev/null +++ b/sys-apps/nix/metadata.xml @@ -0,0 +1,16 @@ + + + + + slyich@gmail.com + Sergei Trofimovich + + + Install /etc/profile.d/ entry to inject nix support for all users. + Enable garbage collection in the Nix expression evaluator (use dev-libs/boehm-gc). + Use dev-libs/libsodium for cryptography + + + NixOS/nix + + diff --git a/sys-apps/nix/nix-2.15.0-r1.ebuild b/sys-apps/nix/nix-2.15.0-r1.ebuild new file mode 100644 index 0000000..ce3217e --- /dev/null +++ b/sys-apps/nix/nix-2.15.0-r1.ebuild @@ -0,0 +1,182 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools linux-info readme.gentoo-r1 tmpfiles toolchain-funcs + +DESCRIPTION="A purely functional package manager" +HOMEPAGE="https://nixos.org/nix" + +SRC_URI="https://github.com/NixOS/nix/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64" +IUSE="+etc-profile +gc doc +sodium" + +# sys-apps/busybox-nix-sandbox-shell is needed for sandbox mount of /bin/sh +RDEPEND=" + app-arch/brotli + app-arch/bzip2 + app-arch/xz-utils + app-misc/jq + app-text/lowdown-nix + dev-cpp/gtest + dev-db/sqlite + dev-libs/editline:0= + amd64? ( dev-libs/libcpuid:0= ) + dev-libs/openssl:0= + >=dev-libs/boost-1.66:0=[context] + net-misc/curl + sys-apps/busybox-nix-sandbox-shell + sys-libs/libseccomp + sys-libs/zlib + gc? ( dev-libs/boehm-gc[cxx] ) + doc? ( dev-libs/libxml2 + dev-libs/libxslt + app-text/docbook-xsl-stylesheets + ) + sodium? ( dev-libs/libsodium:0= ) +" +# add users and groups +RDEPEND+=" + acct-group/nixbld +" +for i in {1..64}; do + RDEPEND+=" + >=acct-user/nixbld${i}-1 + " +done +DEPEND="${RDEPEND} + app-text/mdbook + app-text/mdbook-linkcheck + dev-cpp/nlohmann_json + dev-cpp/rapidcheck + >=sys-devel/bison-2.6 + >=sys-devel/flex-2.5.35 +" + +# Upstream does not bundle .m4 files, extract from upstreams: +# dev-util/pkgconfig: m4/pkg.m4 +# dev-build/autoconf-archive: m4/ax_boost_base.m4, m4/ax_require_defined.m4 +DEPEND+=" + dev-build/autoconf-archive + virtual/pkgconfig +" + +PATCHES=( + "${FILESDIR}"/${PN}-2.10-libpaths.patch + "${FILESDIR}"/${PN}-2.15-DESTDIR.patch + "${FILESDIR}"/${PN}-2.15-dummy.patch +) + +DISABLE_AUTOFORMATTING=yes +DOC_CONTENTS=" Quick start user guide on Gentoo: + +[as root] enable nix-daemon service: + [systemd] # systemctl enable nix-daemon && systemctl start nix-daemon + [openrc] # rc-update add nix-daemon && /etc/init.d/nix-daemon start +[as a user] relogin to get environment and profile update +[as a user] fetch nixpkgs update: + \$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable + \$ nix-channel --update +[as a user] install nix packages: + \$ nix-env -i mc +[as a user] configure environment: + Somewhere in .bash_profile you might want to set + LOCALE_ARCHIVE=\$HOME/.nix-profile/lib/locale/locale-archive + but please read https://github.com/NixOS/nixpkgs/issues/21820 + +Next steps: + nix package manager user manual: http://nixos.org/nix/manual/ +" + +pkg_pretend() { + # USER_NS is used to run builders in a default setting in linux: + # https://nixos.wiki/wiki/Nix#Sandboxing + local CONFIG_CHECK="~USER_NS" + check_extra_config +} + +src_prepare() { + default + + eautoreconf + + # rely on users settings + sed 's/GLOBAL_CXXFLAGS += -O3/GLOBAL_CXXFLAGS += /' -i Makefile || die + sed 's/GLOBAL_CXXFLAGS += -O3/GLOBAL_CXXFLAGS += /' -i perl/Makefile || die + + # inject our copy of lowdown-nix + export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${PKG_CONFIG_PATH:+:}${EPREFIX}/usr/$(get_libdir)/lowdown-nix/lib/pkgconfig" + export PATH="$PATH:${EPREFIX}/usr/$(get_libdir)/lowdown-nix/bin" + + # inject rapidcheck extra includes + export CXXFLAGS="${CXXFLAGS} -I${EPREFIX}/usr/include/rapidcheck/extras/gtest/include" +} + +src_configure() { + CONFIG_SHELL="${BROOT}/bin/bash" econf \ + --localstatedir="${EPREFIX}"/nix/var \ + $(use_enable gc) \ + --with-sandbox-shell="${EPREFIX}"/usr/bin/busybox-nix-sandbox-shell + + emake Makefile.config # gets generated late + cat >> Makefile.config <<-EOF + V = 1 + CC = $(tc-getCC) + CXX = $(tc-getCXX) + EOF +} + +src_compile() { + # Upstream does not support building without installation. + # Rely on src_install's DESTDIR=. + : +} + +src_install() { + # TODO: emacs highlighter + default + + readme.gentoo_create_doc + + # TODO: will need a tweak for prefix + + # Follow the steps of 'scripts/install-multi-user.sh:create_directories()' + local dir dirs=( + /nix + /nix/var + /nix/var/log + /nix/var/log/nix + /nix/var/log/nix/drvs + /nix/var/nix{,/db,/gcroots,/profiles,/temproots,/userpool,/daemon-socket} + /nix/var/nix/{gcroots,profiles}/per-user + ) + for dir in "${dirs[@]}"; do + keepdir "${dir}" + fperms 0755 "${dir}" + done + + keepdir /nix/store + fowners root:nixbld /nix/store + fperms 1775 /nix/store + + newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon + + if ! use etc-profile; then + rm "${ED}"/etc/profile.d/nix.sh || die + fi + # nix-daemon.sh should not be used for users' profile. + # Only for daemon itself. + rm "${ED}"/etc/profile.d/nix-daemon.sh || die +} + +pkg_postinst() { + if ! use etc-profile; then + ewarn "${EROOT}/etc/profile.d/nix.sh was removed (due to USE=-etc-profile)." + fi + + readme.gentoo_print_elog + tmpfiles_process nix-daemon.conf +}