From: zimoun <zimon.toutoune@gmail.com>
To: Peter Polidoro <peter@polidoro.io>
Cc: "(" <paren@disroot.org>, help-guix@gnu.org
Subject: Re: Using Makefile to run guix shell?
Date: Thu, 08 Dec 2022 19:47:14 +0100 [thread overview]
Message-ID: <86r0x9g2bx.fsf@gmail.com> (raw)
In-Reply-To: <87a63ydk95.fsf@polidoro.io>
Hi,
On Thu, 08 Dec 2022 at 09:21, Peter Polidoro <peter@polidoro.io> wrote:
> realistically I never want to go back to life
> before Guix. Spending too much effort making it work without Guix
> just encourages other people to use bad practices I am starting to
> think.
Well, it depends on your collaborators, if you have. :-)
For instance, maybe your collaborators are using other tools than Guix
and they do not want to give a try for whatever reason. Sometime, this
folder guix/ is not in the Git repository since some colleagues do not
want to be “polluted” by some extra files unrelated to the direct
project.
> I do not know enough about writing Makefiles, but is there a way
> to chain together the rules and targets so you could either use
> Guix or not, like a "make serial-shell" and a "make
> guix-serial-shell" with the latter prepending "guix
> time-machine..." to the serial-shell command?
You mean compose the rule, right? Well, without being a Makefile guru,
I think you can have some recursion.
--8<---------------cut here---------------start------------->8---
$ cat Makefile
ifndef GUIX_ENVIRONMENT
todo:=echo
else
todo:=hello
endif
stuff:
@echo "Enter stuff"
@echo "GUIX_ENVIRONMENT: ${GUIX_ENVIRONMENT}"
$(todo)
@echo "stuff done."
hello:
guix shell -C hello make -- $(MAKE) stuff
.PHONY: stuff hello
$ make stuff
Enter stuff
GUIX_ENVIRONMENT:
echo
stuff done.
$ make hello
guix shell -C hello make -- make stuff
Enter stuff
GUIX_ENVIRONMENT: /gnu/store/qh9mcsp50kc21h505qvzj9asrkdk0bl1-profile
hello
Hello, world!
stuff done.
--8<---------------cut here---------------end--------------->8---
Note that the Makefile calls the Makefile but since it is run inside a
shell --container, then you need to provide ’make’.
Cheers,
simon
next prev parent reply other threads:[~2022-12-08 18:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 14:47 Using Makefile to run guix shell? Peter Polidoro
2022-12-07 15:12 ` (
2022-12-07 15:26 ` Peter Polidoro
2022-12-07 15:38 ` (
2022-12-07 18:27 ` Peter Polidoro
2022-12-07 21:01 ` Wojtek Kosior via
2022-12-08 10:44 ` zimoun
2022-12-08 14:21 ` Peter Polidoro
2022-12-08 15:30 ` Wojtek Kosior via
2022-12-08 18:47 ` zimoun [this message]
2022-12-08 21:30 ` Wojtek Kosior via
2022-12-08 23:04 ` zimoun
2022-12-08 23:24 ` Wojtek Kosior via
2022-12-09 17:46 ` Peter Polidoro
2022-12-10 13:21 ` zimoun
2022-12-12 17:55 ` Peter Polidoro
2022-12-12 19:00 ` Wojtek Kosior via
2022-12-09 18:38 ` Philip McGrath
2022-12-07 17:08 ` Wolf
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=86r0x9g2bx.fsf@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=help-guix@gnu.org \
--cc=paren@disroot.org \
--cc=peter@polidoro.io \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.