patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Spectrum OS Development <devel@spectrum-os.org>
Cc: Alyssa Ross <hi@alyssa.is>, Demi Marie Obenour <demiobenour@gmail.com>
Subject: [PATCH] Add wrapper scripts to run make in a Nix shell
Date: Thu, 07 Aug 2025 14:50:01 -0400	[thread overview]
Message-ID: <20250807-make-wrapper-scripts-v1-1-3f020195a916@gmail.com> (raw)

It is very easy to forget to do this, and the results are confusing at
best and wrong at worst.  Add wrapper scripts that get it right and also
automatically change to the correct directory for you.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
 host/initramfs/run-make.sh |  1 +
 host/rootfs/run-make.sh    |  1 +
 img/app/run-make.sh        |  1 +
 release/live/run-make.sh   |  1 +
 scripts/run-make.sh        | 12 ++++++++++++
 tools/lseek/run-make.sh    |  1 +
 vm/sys/net/run-make.sh     |  1 +
 7 files changed, 18 insertions(+)

diff --git a/host/initramfs/run-make.sh b/host/initramfs/run-make.sh
new file mode 120000
index 0000000000000000000000000000000000000000..2142d230828768016cf5a4a59a895448ae3b12d9
--- /dev/null
+++ b/host/initramfs/run-make.sh
@@ -0,0 +1 @@
+../../scripts/run-make.sh
\ No newline at end of file
diff --git a/host/rootfs/run-make.sh b/host/rootfs/run-make.sh
new file mode 120000
index 0000000000000000000000000000000000000000..2142d230828768016cf5a4a59a895448ae3b12d9
--- /dev/null
+++ b/host/rootfs/run-make.sh
@@ -0,0 +1 @@
+../../scripts/run-make.sh
\ No newline at end of file
diff --git a/img/app/run-make.sh b/img/app/run-make.sh
new file mode 120000
index 0000000000000000000000000000000000000000..2142d230828768016cf5a4a59a895448ae3b12d9
--- /dev/null
+++ b/img/app/run-make.sh
@@ -0,0 +1 @@
+../../scripts/run-make.sh
\ No newline at end of file
diff --git a/release/live/run-make.sh b/release/live/run-make.sh
new file mode 120000
index 0000000000000000000000000000000000000000..2142d230828768016cf5a4a59a895448ae3b12d9
--- /dev/null
+++ b/release/live/run-make.sh
@@ -0,0 +1 @@
+../../scripts/run-make.sh
\ No newline at end of file
diff --git a/scripts/run-make.sh b/scripts/run-make.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b865bb3461b5d3f192598d273cee278a76d0a6b7
--- /dev/null
+++ b/scripts/run-make.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env -S bash --
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+set -eu
+case $0 in (/*) cd "${0%/*}/";; (*/*) cd "./${0%/*}";; esac
+if [ ! -f shell.nix ] || [ ! -f Makefile ]; then
+  echo "Must have a shell.nix and a Makefile" >&2
+  exit 1
+fi
+cmd='exec make'
+for i; do cmd+=" '"${i//\'/\'\\\'\'}\'; done
+exec nix-shell --pure --run "$cmd"
diff --git a/tools/lseek/run-make.sh b/tools/lseek/run-make.sh
new file mode 120000
index 0000000000000000000000000000000000000000..2142d230828768016cf5a4a59a895448ae3b12d9
--- /dev/null
+++ b/tools/lseek/run-make.sh
@@ -0,0 +1 @@
+../../scripts/run-make.sh
\ No newline at end of file
diff --git a/vm/sys/net/run-make.sh b/vm/sys/net/run-make.sh
new file mode 120000
index 0000000000000000000000000000000000000000..38a7b0cf91ebf669e9794d91c6962cbe882de20f
--- /dev/null
+++ b/vm/sys/net/run-make.sh
@@ -0,0 +1 @@
+../../../scripts/run-make.sh
\ No newline at end of file

---
base-commit: 39baa378367d95fac6ce4d0140b25203b2ee9b53
change-id: 20250807-make-wrapper-scripts-77231ac0c0a7
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)


             reply	other threads:[~2025-08-07 18:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 18:50 Demi Marie Obenour [this message]
2025-08-08 15:00 ` [PATCH] Add wrapper scripts to run make in a Nix shell Alyssa Ross
2025-08-08 17:32   ` Demi Marie Obenour
2025-08-08 18:02     ` Alyssa Ross
2025-08-08 18:30       ` Demi Marie Obenour
2025-08-08 18:36         ` Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250807-make-wrapper-scripts-v1-1-3f020195a916@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

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).