Skip to content

Commit 2f240ff

Browse files
committed
system/nix: Some extra hardcoded assurance.
I realized late that it's started to spam root partition, again. I'm not really happy with this, not at all; first patch updated. Signed-off-by: Pouria Rezaei <[email protected]>
1 parent 5115b34 commit 2f240ff

File tree

2 files changed

+75
-7
lines changed

2 files changed

+75
-7
lines changed

system/nix/fix_nix_options.patch

Lines changed: 73 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
11
diff --git a/doc/manual/local.mk b/doc/manual/local.mk
2-
index abdfd6a..dea46f3 100644
2+
index abdfd6a..b4aba08 100644
33
--- a/doc/manual/local.mk
44
+++ b/doc/manual/local.mk
5-
@@ -32,7 +32,7 @@ dummy-env = env -i \
6-
NIX_STATE_DIR=/dummy \
5+
@@ -25,14 +25,16 @@ clean-files += $(d)/*.1 $(d)/*.5 $(d)/*.8
6+
7+
# Provide a dummy environment for nix, so that it will not access files outside the macOS sandbox.
8+
# Set cores to 0 because otherwise nix show-config resolves the cores based on the current machine
9+
+tmp_DIR := $(realpath $(bindir))
10+
+
11+
dummy-env = env -i \
12+
- HOME=/dummy \
13+
- NIX_CONF_DIR=/dummy \
14+
- NIX_SSL_CERT_FILE=/dummy/no-ca-bundle.crt \
15+
- NIX_STATE_DIR=/dummy \
16+
+ HOME=$(tmp_DIR)/dummy \
17+
+ NIX_CONF_DIR=$(tmp_DIR)/dummy \
18+
+ NIX_SSL_CERT_FILE=$(tmp_DIR)/dummy/no-ca-bundle.crt \
19+
+ NIX_STATE_DIR=$(tmp_DIR)/dummy \
720
NIX_CONFIG='cores = 0'
821

922
-nix-eval = $(dummy-env) $(bindir)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --store dummy:// --impure --raw
1023
+nix-eval = $(dummy-env) $(nix_DIR)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --store dummy:// --impure --raw
1124

1225
# re-implement mdBook's include directive to make it usable for terminal output and for proper @docroot@ substitution
1326
define process-includes
14-
@@ -96,52 +96,52 @@ $(d)/src/SUMMARY.md: $(d)/src/SUMMARY.md.in $(d)/src/command-ref/new-cli $(d)/sr
27+
@@ -96,52 +98,52 @@ $(d)/src/SUMMARY.md: $(d)/src/SUMMARY.md.in $(d)/src/command-ref/new-cli $(d)/sr
1528
@cp $< $@
1629
@$(call process-includes,$@,$@)
1730

@@ -78,11 +91,65 @@ index abdfd6a..dea46f3 100644
7891
7992

8093
# Generate the HTML manual.
94+
diff --git a/mk/lib.mk b/mk/lib.mk
95+
index e86a7f1..5a81a0c 100644
96+
--- a/mk/lib.mk
97+
+++ b/mk/lib.mk
98+
@@ -118,7 +118,7 @@ $(foreach mf, $(makefiles), $(eval $(call include-sub-makefile, $(mf))))
99+
# Instantiate stuff.
100+
$(foreach lib, $(libraries), $(eval $(call build-library,$(lib))))
101+
$(foreach prog, $(programs), $(eval $(call build-program,$(prog))))
102+
-$(foreach script, $(bin-scripts), $(eval $(call install-program-in,$(script),$(bindir))))
103+
+$(foreach script, $(bin-scripts), $(eval $(call install-program-in,$(script),$(nix_DIR))))
104+
$(foreach script, $(bin-scripts), $(eval programs-list += $(script)))
105+
$(foreach script, $(noinst-scripts), $(eval programs-list += $(script)))
106+
$(foreach template, $(template-files), $(eval $(call instantiate-template,$(template))))
107+
diff --git a/mk/libraries.mk b/mk/libraries.mk
108+
index 1bc73d7..6549029 100644
109+
--- a/mk/libraries.mk
110+
+++ b/mk/libraries.mk
111+
@@ -60,7 +60,7 @@ define build-library
112+
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
113+
114+
ifdef HOST_CYGWIN
115+
- $(1)_INSTALL_DIR ?= $$(bindir)
116+
+ $(1)_INSTALL_DIR ?= $$(nix_DIR)
117+
else
118+
$(1)_INSTALL_DIR ?= $$(libdir)
119+
endif
120+
diff --git a/mk/programs.mk b/mk/programs.mk
121+
index 1ee1d3f..05080fe 100644
122+
--- a/mk/programs.mk
123+
+++ b/mk/programs.mk
124+
@@ -38,7 +38,7 @@ define build-program
125+
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
126+
+$$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
127+
128+
- $(1)_INSTALL_DIR ?= $$(bindir)
129+
+ $(1)_INSTALL_DIR ?= $$(nix_DIR)
130+
131+
ifdef $(1)_INSTALL_DIR
132+
133+
diff --git a/src/nix/local.mk b/src/nix/local.mk
134+
index 20ea29d..a082bd1 100644
135+
--- a/src/nix/local.mk
136+
+++ b/src/nix/local.mk
137+
@@ -22,8 +22,8 @@ nix_LDFLAGS = -pthread $(SODIUM_LIBS) $(EDITLINE_LIBS) $(BOOST_LDFLAGS) $(LOWDOW
138+
139+
$(foreach name, \
140+
nix-build nix-channel nix-collect-garbage nix-copy-closure nix-daemon nix-env nix-hash nix-instantiate nix-prefetch-url nix-shell nix-store, \
141+
- $(eval $(call install-symlink, nix, $(bindir)/$(name))))
142+
-$(eval $(call install-symlink, $(bindir)/nix, $(libexecdir)/nix/build-remote))
143+
+ $(eval $(call install-symlink, nix, $(nix_DIR)/$(name))))
144+
+$(eval $(call install-symlink, $(nix_DIR)/nix, $(libexecdir)/nix/build-remote))
145+
146+
src/nix-env/user-env.cc: src/nix-env/buildenv.nix.gen.hh
147+
81148
diff --git a/doc/manual/local.mk b/doc/manual/local.mk
82-
index dea46f3..422d531 100644
149+
index b4aba08..daed407 100644
83150
--- a/doc/manual/local.mk
84151
+++ b/doc/manual/local.mk
85-
@@ -174,22 +174,22 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
152+
@@ -176,22 +176,22 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
86153
@touch $@
87154

88155
$(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 $(d)/src/language/builtin-constants.md

system/nix/nix.SlackBuild

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ find -L . \
102102
# root partition is bad, m'kay? (Updated).
103103
# - The above patch was added thanks to Pragmatic Cypher, along with
104104
# mdbook patch to make it disabled.
105-
# - Added global CFLAGS.
105+
# - Added global CFLAGS
106106
# - Changed to ignore offset, since function hasn't still implemented
107107
# in Slackware 15's sqlite.
108108
# - Fixed missing -lrapidcheck flag.
@@ -118,6 +118,7 @@ CXXFLAGS="$SLKCFLAGS" \
118118
--libdir=/usr/lib${LIBDIRSUFFIX} \
119119
--mandir=/usr/man \
120120
--docdir=/usr/doc/$PRGNAM-$VERSION \
121+
--bindir=$PKG \
121122
--sysconfdir=/etc \
122123
--enable-static=rapidcheck \
123124
--build=$ARCH-slackware-linux \

0 commit comments

Comments
 (0)