help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Makefile to run guix shell?


From: zimoun
Subject: Re: Using Makefile to run guix shell?
Date: Thu, 08 Dec 2022 11:44:05 +0100

Hi,
On Wed, 07 Dec 2022 at 13:27, Peter Polidoro <peter@polidoro.io> wrote:

>> Why not just do:
>>
>>   guix shell -- make metadata
>
> I do like the idea of not making it depend on guix.

[...]

> I guess I am just curious how other people manage such long 
> commands?

Quoting [1],

                                                   I have a “general” script
    (named guixify) under ~/.local/bin/ which roughly reads:

    --8<---------------cut here---------------start------------->8---
    #!/bin/sh

    guix time-machine -C channels.scm  \
         -- shell --pure               \
         -m manifest.scm               \
         -- $@
    --8<---------------cut here---------------end--------------->8---

    where manifest.scm and channels.scm are kept with the Git project.  I
    prefer to pin a specific Guix revision to avoid bad surprises. :-) Well,
    in a project, I just run:

        guixify make   # run make using the Guix environment
        guixify        # enter in the environment

Well and if I need a more complex command-line invocation specific to
the project, I have Shell scripts with the Git project; for instance
guix-serial-shell.sh

--8<---------------cut here---------------start------------->8---
#!/bin/sh

guix time-machine -C guix/channels.scm         \
     -- shell -m guix/manifest.scm             \
     --container --expose=$(PORT) picocom      \
     -- $@
--8<---------------cut here---------------end--------------->8---

where I try to decouple what requires Guix and what not.  Well, I have
not tried, but the idea is then to run:

    $ guix-serial-shell.sh make serial-shell

where the Makefile contains the rule:

    serial-shell:
       picocom -b 9600 -f n -y n -d 8 -p 1 -c $(PORT)

(well, adapting for PORT :-))


Other said, in general, I have a Git repository which looks like

        .
        ├── COPYING
        ├── guix
        │   ├── channels.scm
        │   ├── extra
        │   │   └── packages.scm
        │   ├── manifest.scm
        │   ├── other-script.sh
        │   └── serial-shell.sh
        ├── Makefile
        ├── README
        ├── src
        │   └── code
        └── tests
            └── stuff

And the guixify scripts from above contains guix/manifest.scm and
guix/channels.scm instead. :-)

Well, I try to keep Makefile working without Guix.  And usually, the
folder guix/extra contains some packages that I use via --load-path, for
instance, guix-serial-shell.sh would have:

        guix time-machine -C channels.scm         \
             -- shell -m manifest.scm             \
             --load-path guix/extra               \
             --container --expose=$(PORT) picocom \
             -- $@


1: https://yhetil.org/guix/86wn9puqj7.fsf@gmail.com

HTH
simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]