Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] nix: do not touch outside {build,dest}dir
@ 2022-09-02  5:50 sgn
  2022-09-02  6:10 ` [PR PATCH] [Updated] " sgn
  2022-09-02  8:43 ` [PR PATCH] [Merged]: " sgn
  0 siblings, 2 replies; 3+ messages in thread
From: sgn @ 2022-09-02  5:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1307 bytes --]

There is a new pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages nix-sane-build
https://github.com/void-linux/void-packages/pull/39050

nix: do not touch outside {build,dest}dir
While we're at it, cross compile

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39050.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-nix-sane-build-39050.patch --]
[-- Type: text/x-diff, Size: 8456 bytes --]

From 17d340091ecdcd65c25915dacd7ca40ea6ae24c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Fri, 2 Sep 2022 12:47:09 +0700
Subject: [PATCH] nix: do not touch outside {build,dest}dir

While we're at it, cross compile
---
 ...anual-build-without-nix-installation.patch | 35 +++++++++
 .../nix/patches/0002-manual-cross-build.patch | 76 +++++++++++++++++++
 srcpkgs/nix/template                          | 13 +++-
 3 files changed, 121 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/nix/patches/0001-manual-build-without-nix-installation.patch
 create mode 100644 srcpkgs/nix/patches/0002-manual-cross-build.patch

diff --git a/srcpkgs/nix/patches/0001-manual-build-without-nix-installation.patch b/srcpkgs/nix/patches/0001-manual-build-without-nix-installation.patch
new file mode 100644
index 000000000000..0b47cf987765
--- /dev/null
+++ b/srcpkgs/nix/patches/0001-manual-build-without-nix-installation.patch
@@ -0,0 +1,35 @@
+From 80e23e10c854e54a1231b2fede26a44acaf8cee4 Mon Sep 17 00:00:00 2001
+Message-Id: <80e23e10c854e54a1231b2fede26a44acaf8cee4.1662096893.git.congdanhqx@gmail.com>
+From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
+ <congdanhqx@gmail.com>
+Date: Fri, 2 Sep 2022 10:33:10 +0700
+Subject: [PATCH 1/2] manual: build without nix installation
+
+---
+ doc/manual/local.mk | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index 371ed6f21..81f91c8b0 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -85,14 +85,14 @@ $(mandir)/man1/nix3-manpages: doc/manual/generated/man1/nix3-manpages
+ 	$(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); \
+ 	  if [[ $$name = SUMMARY ]]; then continue; fi; \
+ 	  printf "Title: %s\n\n" "$$name" > $$tmpFile; \
+ 	  cat $$i >> $$tmpFile; \
+-	  lowdown -sT man -M section=1 $$tmpFile -o $(DESTDIR)$$(dirname $@)/$$name.1; \
++	  lowdown -sT man -M section=1 $$tmpFile -o $$(dirname $@)/$$name.1; \
+ 	  rm $$tmpFile; \
+ 	done
+ 	@touch $@
+-- 
+2.37.2.587.g219fe53025.dirty
+
diff --git a/srcpkgs/nix/patches/0002-manual-cross-build.patch b/srcpkgs/nix/patches/0002-manual-cross-build.patch
new file mode 100644
index 000000000000..b504b33ce60e
--- /dev/null
+++ b/srcpkgs/nix/patches/0002-manual-cross-build.patch
@@ -0,0 +1,76 @@
+From 8434469b5ba6ce1f631e3815cf8b92cdb719d732 Mon Sep 17 00:00:00 2001
+Message-Id: <8434469b5ba6ce1f631e3815cf8b92cdb719d732.1662096893.git.congdanhqx@gmail.com>
+In-Reply-To: <80e23e10c854e54a1231b2fede26a44acaf8cee4.1662096893.git.congdanhqx@gmail.com>
+References: <80e23e10c854e54a1231b2fede26a44acaf8cee4.1662096893.git.congdanhqx@gmail.com>
+From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
+ <congdanhqx@gmail.com>
+Date: Fri, 2 Sep 2022 12:05:18 +0700
+Subject: [PATCH 2/2] manual: cross-build
+
+---
+ doc/manual/local.mk | 26 ++++++++++++++++----------
+ 1 file changed, 16 insertions(+), 10 deletions(-)
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index 81f91c8b0..886682bc5 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -20,7 +20,13 @@ 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
++ifneq ($(findstring qemu,$(CROSS_EMULATOR)),)
++  _nix-emu := QEMU_LD_PREFIX=${QEMU_LD_PREFIX} $(CROSS_EMULATOR)
++else
++  _nix-emu := $(CROSS_EMULATOR)
++endif
++
++nix-eval = $(dummy-env) $(_nix-emu) $(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
+@@ -44,31 +50,31 @@ $(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 $(nix_DIR)/nix
+ 	@rm -rf $@
+ 	$(trace-gen) $(nix-eval) --write-to $@ --expr 'import doc/manual/generate-manpage.nix { command = builtins.readFile $<; renderLinks = true; }'
+ 
+-$(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
+ 	@cat doc/manual/src/command-ref/conf-file-prefix.md > $@.tmp
+ 	$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-options.nix (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp
+ 	@mv $@.tmp $@
+ 
+-$(d)/nix.json: $(bindir)/nix
+-	$(trace-gen) $(dummy-env) $(bindir)/nix __dump-args > $@.tmp
++$(d)/nix.json: $(nix_DIR)/nix
++	$(trace-gen) $(dummy-env) $(_nix-emu) $(nix_DIR)/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: $(nix_DIR)/nix
++	$(trace-gen) $(dummy-env) $(_nix-emu) $(nix_DIR)/nix show-config --json --experimental-features nix-command > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-$(d)/src/expressions/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d)/src/expressions/builtins-prefix.md $(bindir)/nix
++$(d)/src/expressions/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d)/src/expressions/builtins-prefix.md $(nix_DIR)/nix
+ 	@cat doc/manual/src/expressions/builtins-prefix.md > $@.tmp
+ 	$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtins.nix (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp
+ 	@cat doc/manual/src/expressions/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: $(nix_DIR)/nix
++	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(_nix-emu) $(nix_DIR)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+ # Generate the HTML manual.
+-- 
+2.37.2.587.g219fe53025.dirty
+
diff --git a/srcpkgs/nix/template b/srcpkgs/nix/template
index 42f983935ba9..6d7724ba7fe1 100644
--- a/srcpkgs/nix/template
+++ b/srcpkgs/nix/template
@@ -3,11 +3,14 @@ pkgname=nix
 version=2.10.3
 revision=3
 build_style=gnu-configure
+build_helper=qemu
 # Use /nix/var as suggested by the official Manual.
 configure_args="--localstatedir=/nix/var
  --with-sandbox-shell=/usr/bin/busybox.static"
+make_build_args="V=1 SET_RPATH_TO_LIBS=0"
+make_install_args="V=1 SET_RPATH_TO_LIBS=0"
 hostmakedepends="curl pkg-config flex tar xz automake autoconf-archive mdBook jq
- busybox-static"
+ busybox-static lowdown"
 makedepends="boost-devel brotli-devel bzip2-devel gc-devel libcurl-devel
  liblzma-devel openssl-devel libsodium-devel sqlite-devel
  libseccomp-devel editline-devel jq-devel libarchive-devel
@@ -20,8 +23,7 @@ homepage="https://nixos.org/nix/"
 changelog="https://nixos.org/releases/${pkgname}/${pkgname}-${version}/manual/#sec-relnotes"
 distfiles="https://github.com/NixOS/nix/archive/refs/tags/${version}.tar.gz"
 checksum=5a8d79714bf04c425f41fdd22e67d4704d2e44c7a760c6c144e5767c6d662413
-disable_parallel_build=yes
-nocross="cross build populates /usr/lib32 with libraries and tries to link against them"
+# disable_parallel_build="build is fine, only linking test"
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	makedepends+=" musl-legacy-compat"
@@ -33,6 +35,11 @@ esac
 
 CXXFLAGS="-Wno-deprecated-declarations"
 
+if [ "$CROSS_BUILD" ]; then
+	make_build_args+=" CROSS_EMULATOR=/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static"
+	make_install_args+=" CROSS_EMULATOR=/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static"
+fi
+
 # Default configuration file.
 conf_files="/etc/nix/nix.conf"
 # Create required build users/groups.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Updated] nix: do not touch outside {build,dest}dir
  2022-09-02  5:50 [PR PATCH] nix: do not touch outside {build,dest}dir sgn
@ 2022-09-02  6:10 ` sgn
  2022-09-02  8:43 ` [PR PATCH] [Merged]: " sgn
  1 sibling, 0 replies; 3+ messages in thread
From: sgn @ 2022-09-02  6:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages nix-sane-build
https://github.com/void-linux/void-packages/pull/39050

nix: do not touch outside {build,dest}dir
While we're at it, cross compile

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39050.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-nix-sane-build-39050.patch --]
[-- Type: text/x-diff, Size: 10061 bytes --]

From ca21a4542d664ad63db5642cc2e4bb49d15bee38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Fri, 2 Sep 2022 12:47:09 +0700
Subject: [PATCH] nix: do not touch outside {build,dest}dir

While we're at it, cross compile
---
 ...anual-build-without-nix-installation.patch | 85 +++++++++++++++++++
 .../nix/patches/0002-manual-cross-build.patch | 58 +++++++++++++
 srcpkgs/nix/template                          | 13 ++-
 3 files changed, 153 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/nix/patches/0001-manual-build-without-nix-installation.patch
 create mode 100644 srcpkgs/nix/patches/0002-manual-cross-build.patch

diff --git a/srcpkgs/nix/patches/0001-manual-build-without-nix-installation.patch b/srcpkgs/nix/patches/0001-manual-build-without-nix-installation.patch
new file mode 100644
index 000000000000..6a1807defd66
--- /dev/null
+++ b/srcpkgs/nix/patches/0001-manual-build-without-nix-installation.patch
@@ -0,0 +1,85 @@
+From b8a68be8b552584f28bd177bbf785fd768828081 Mon Sep 17 00:00:00 2001
+Message-Id: <b8a68be8b552584f28bd177bbf785fd768828081.1662098974.git.congdanhqx@gmail.com>
+From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
+ <congdanhqx@gmail.com>
+Date: Fri, 2 Sep 2022 10:33:10 +0700
+Subject: [PATCH 1/2] manual: build without nix installation
+
+---
+ doc/manual/local.mk | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index 371ed6f21..ef37d5d6b 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -20,7 +20,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
+@@ -44,31 +44,31 @@ $(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 $(nix_DIR)/nix
+ 	@rm -rf $@
+ 	$(trace-gen) $(nix-eval) --write-to $@ --expr 'import doc/manual/generate-manpage.nix { command = builtins.readFile $<; renderLinks = true; }'
+ 
+-$(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
+ 	@cat doc/manual/src/command-ref/conf-file-prefix.md > $@.tmp
+ 	$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-options.nix (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp
+ 	@mv $@.tmp $@
+ 
+-$(d)/nix.json: $(bindir)/nix
+-	$(trace-gen) $(dummy-env) $(bindir)/nix __dump-args > $@.tmp
++$(d)/nix.json: $(nix_DIR)/nix
++	$(trace-gen) $(dummy-env) $(nix_DIR)/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: $(nix_DIR)/nix
++	$(trace-gen) $(dummy-env) $(nix_DIR)/nix show-config --json --experimental-features nix-command > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-$(d)/src/expressions/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d)/src/expressions/builtins-prefix.md $(bindir)/nix
++$(d)/src/expressions/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d)/src/expressions/builtins-prefix.md $(nix_DIR)/nix
+ 	@cat doc/manual/src/expressions/builtins-prefix.md > $@.tmp
+ 	$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtins.nix (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp
+ 	@cat doc/manual/src/expressions/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: $(nix_DIR)/nix
++	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(nix_DIR)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+ # Generate the HTML manual.
+@@ -85,14 +85,14 @@ $(mandir)/man1/nix3-manpages: doc/manual/generated/man1/nix3-manpages
+ 	$(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); \
+ 	  if [[ $$name = SUMMARY ]]; then continue; fi; \
+ 	  printf "Title: %s\n\n" "$$name" > $$tmpFile; \
+ 	  cat $$i >> $$tmpFile; \
+-	  lowdown -sT man -M section=1 $$tmpFile -o $(DESTDIR)$$(dirname $@)/$$name.1; \
++	  lowdown -sT man -M section=1 $$tmpFile -o $$(dirname $@)/$$name.1; \
+ 	  rm $$tmpFile; \
+ 	done
+ 	@touch $@
+-- 
+2.37.2.587.g219fe53025.dirty
+
diff --git a/srcpkgs/nix/patches/0002-manual-cross-build.patch b/srcpkgs/nix/patches/0002-manual-cross-build.patch
new file mode 100644
index 000000000000..6bcdd4619e31
--- /dev/null
+++ b/srcpkgs/nix/patches/0002-manual-cross-build.patch
@@ -0,0 +1,58 @@
+From 83130b47f14a74387f4ab185d3109ca4523e8f2a Mon Sep 17 00:00:00 2001
+Message-Id: <83130b47f14a74387f4ab185d3109ca4523e8f2a.1662098974.git.congdanhqx@gmail.com>
+In-Reply-To: <b8a68be8b552584f28bd177bbf785fd768828081.1662098974.git.congdanhqx@gmail.com>
+References: <b8a68be8b552584f28bd177bbf785fd768828081.1662098974.git.congdanhqx@gmail.com>
+From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
+ <congdanhqx@gmail.com>
+Date: Fri, 2 Sep 2022 12:05:18 +0700
+Subject: [PATCH 2/2] manual: cross-build
+
+---
+ doc/manual/local.mk | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index ef37d5d6b..cae3b007a 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -20,7 +20,13 @@ dummy-env = env -i \
+ 	NIX_STATE_DIR=/dummy \
+ 	NIX_CONFIG='cores = 0'
+ 
+-nix-eval = $(dummy-env) $(nix_DIR)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --store dummy:// --impure --raw
++ifneq (,$(findstring qemu,$(CROSS_EMULATOR)))
++  _nix-emu := QEMU_LD_PREFIX=${QEMU_LD_PREFIX} $(CROSS_EMULATOR)
++else
++  _nix-emu := $(CROSS_EMULATOR)
++endif
++
++nix-eval = $(dummy-env) $(_nix-emu) $(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
+@@ -54,11 +60,11 @@ $(d)/src/command-ref/conf-file.md: $(d)/conf-file.json $(d)/generate-options.nix
+ 	@mv $@.tmp $@
+ 
+ $(d)/nix.json: $(nix_DIR)/nix
+-	$(trace-gen) $(dummy-env) $(nix_DIR)/nix __dump-args > $@.tmp
++	$(trace-gen) $(dummy-env) $(_nix-emu) $(nix_DIR)/nix __dump-args > $@.tmp
+ 	@mv $@.tmp $@
+ 
+ $(d)/conf-file.json: $(nix_DIR)/nix
+-	$(trace-gen) $(dummy-env) $(nix_DIR)/nix show-config --json --experimental-features nix-command > $@.tmp
++	$(trace-gen) $(dummy-env) $(_nix-emu) $(nix_DIR)/nix show-config --json --experimental-features nix-command > $@.tmp
+ 	@mv $@.tmp $@
+ 
+ $(d)/src/expressions/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d)/src/expressions/builtins-prefix.md $(nix_DIR)/nix
+@@ -68,7 +74,7 @@ $(d)/src/expressions/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix
+ 	@mv $@.tmp $@
+ 
+ $(d)/builtins.json: $(nix_DIR)/nix
+-	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(nix_DIR)/nix __dump-builtins > $@.tmp
++	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(_nix-emu) $(nix_DIR)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+ # Generate the HTML manual.
+-- 
+2.37.2.587.g219fe53025.dirty
+
diff --git a/srcpkgs/nix/template b/srcpkgs/nix/template
index 42f983935ba9..6d7724ba7fe1 100644
--- a/srcpkgs/nix/template
+++ b/srcpkgs/nix/template
@@ -3,11 +3,14 @@ pkgname=nix
 version=2.10.3
 revision=3
 build_style=gnu-configure
+build_helper=qemu
 # Use /nix/var as suggested by the official Manual.
 configure_args="--localstatedir=/nix/var
  --with-sandbox-shell=/usr/bin/busybox.static"
+make_build_args="V=1 SET_RPATH_TO_LIBS=0"
+make_install_args="V=1 SET_RPATH_TO_LIBS=0"
 hostmakedepends="curl pkg-config flex tar xz automake autoconf-archive mdBook jq
- busybox-static"
+ busybox-static lowdown"
 makedepends="boost-devel brotli-devel bzip2-devel gc-devel libcurl-devel
  liblzma-devel openssl-devel libsodium-devel sqlite-devel
  libseccomp-devel editline-devel jq-devel libarchive-devel
@@ -20,8 +23,7 @@ homepage="https://nixos.org/nix/"
 changelog="https://nixos.org/releases/${pkgname}/${pkgname}-${version}/manual/#sec-relnotes"
 distfiles="https://github.com/NixOS/nix/archive/refs/tags/${version}.tar.gz"
 checksum=5a8d79714bf04c425f41fdd22e67d4704d2e44c7a760c6c144e5767c6d662413
-disable_parallel_build=yes
-nocross="cross build populates /usr/lib32 with libraries and tries to link against them"
+# disable_parallel_build="build is fine, only linking test"
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	makedepends+=" musl-legacy-compat"
@@ -33,6 +35,11 @@ esac
 
 CXXFLAGS="-Wno-deprecated-declarations"
 
+if [ "$CROSS_BUILD" ]; then
+	make_build_args+=" CROSS_EMULATOR=/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static"
+	make_install_args+=" CROSS_EMULATOR=/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static"
+fi
+
 # Default configuration file.
 conf_files="/etc/nix/nix.conf"
 # Create required build users/groups.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Merged]: nix: do not touch outside {build,dest}dir
  2022-09-02  5:50 [PR PATCH] nix: do not touch outside {build,dest}dir sgn
  2022-09-02  6:10 ` [PR PATCH] [Updated] " sgn
@ 2022-09-02  8:43 ` sgn
  1 sibling, 0 replies; 3+ messages in thread
From: sgn @ 2022-09-02  8:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]

There's a merged pull request on the void-packages repository

nix: do not touch outside {build,dest}dir
https://github.com/void-linux/void-packages/pull/39050

Description:
While we're at it, cross compile

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-02  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-02  5:50 [PR PATCH] nix: do not touch outside {build,dest}dir sgn
2022-09-02  6:10 ` [PR PATCH] [Updated] " sgn
2022-09-02  8:43 ` [PR PATCH] [Merged]: " sgn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).