-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nix: do not touch outside {build,dest}dir
While we're at it, cross compile
- Loading branch information
Showing
3 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
srcpkgs/nix/patches/0001-manual-build-without-nix-installation.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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?= | ||
<[email protected]> | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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?= | ||
<[email protected]> | ||
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 > [email protected] | ||
@mv [email protected] $@ | ||
|
||
-$(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 > [email protected] | ||
$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-options.nix (builtins.fromJSON (builtins.readFile $<))' >> [email protected] | ||
@mv [email protected] $@ | ||
|
||
-$(d)/nix.json: $(bindir)/nix | ||
- $(trace-gen) $(dummy-env) $(bindir)/nix __dump-args > [email protected] | ||
+$(d)/nix.json: $(nix_DIR)/nix | ||
+ $(trace-gen) $(dummy-env) $(_nix-emu) $(nix_DIR)/nix __dump-args > [email protected] | ||
@mv [email protected] $@ | ||
|
||
-$(d)/conf-file.json: $(bindir)/nix | ||
- $(trace-gen) $(dummy-env) $(bindir)/nix show-config --json --experimental-features nix-command > [email protected] | ||
+$(d)/conf-file.json: $(nix_DIR)/nix | ||
+ $(trace-gen) $(dummy-env) $(_nix-emu) $(nix_DIR)/nix show-config --json --experimental-features nix-command > [email protected] | ||
@mv [email protected] $@ | ||
|
||
-$(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 > [email protected] | ||
$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtins.nix (builtins.fromJSON (builtins.readFile $<))' >> [email protected] | ||
@cat doc/manual/src/expressions/builtins-suffix.md >> [email protected] | ||
@mv [email protected] $@ | ||
|
||
-$(d)/builtins.json: $(bindir)/nix | ||
- $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > [email protected] | ||
+$(d)/builtins.json: $(nix_DIR)/nix | ||
+ $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(_nix-emu) $(nix_DIR)/nix __dump-builtins > [email protected] | ||
@mv [email protected] $@ | ||
|
||
# Generate the HTML manual. | ||
-- | ||
2.37.2.587.g219fe53025.dirty | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters