Re: First example of g-golf (hello world) not working

Zelphir Kaltstahl <[email protected]> Sun, 13 Apr 2025 04:40:09 +0000
Newsgroups gmane.lisp.guile.user
Message-ID <[email protected]>
On 13.04.25 05:56, David Pirotte wrote:
> Hello Zelphir,
>
>> I guess --no-grafts is not sufficient, and I need to use it, and
>> additionally install one of the two packages you mentioned. Merely
>> adding --no-grafts still results in the error:
> I believe your guix shell command is incomplete.
>
> Florian, could you tell us the exact command line steps a guix g-golf
> user must accomplish to run the upstream version of an example, or
> their own app as there are developing it, thanks.
>
>>> Guix now two separate g-golf examples packages:
>>> 	g-golf-gtk-4-examples
>>> 	g-golf-adw-1-examples
>> I installed those 2 packages and tried running like before, which
>> results in a new, different error, but I am not sure what it means to
>> "run from my profile bin dir", so I did not take any steps towards
>> that:
> Here as well, your guix shell command is incomplete (it misses gtk-4).
> But I think that as you installed the above listed packages, all you
> have to do is to go to 'your guix user bin dir' and run from there:
>
> 	./hello-world	[or any other example
>
> This is because those are the wrapper version of the upstream examples.
>
> Note that in your bin dir, they probably are symlink, the examples are
> effectively installed in $(prefix)/share/doc/g-golf/examples/gtk-4
>
> I suggest you list the content of $(prefix)/share/doc/g-golf/examples/gtk-4
> and edit both the wrapper (launcher) and the updated original version
> of the script, to see and learn from Florian.
>
> You might also want to edit the (gnu packages guile-xyz) and read the
> g-golf-gtk-4-examples and g-golf-adw-1-examples package definition, and
> learn from those as well.
>
> Cheers,
> David

Hello David!

I think there is some confusion, or at least something I am unaware of:

I am running a guix command like this:

~~~~Makefile~~~~
.POSIX:
.RECIPEPREFIX = >
.DELETE_ON_ERROR:

MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules

# --no-grafts is required to run g-golf examples. Some bug in Guix.
SHELL ::= guix time-machine --channels=guix-env/channels.scm -- shell --no-grafts --check --manifest=guix-env/manifest.scm -- bash -c
.SHELLFLAGS = -Euo pipefail -c

GUILE_LOAD_PATH ::= .
# GUILE_LOAD_PATH += utils

GUILE_LOAD_PATH_ARG ::= $(foreach dir, $(GUILE_LOAD_PATH),-L $(dir))

.PHONY: run
run:
> guile $(GUILE_LOAD_PATH_ARG) main.scm

.PHONY: repl
repl:
> guile
~~~~

In this Makefile I am defining what shell make uses. I use guix time-machine to 
make sure the result is reproducible, locked to one specific commit, described 
using the channels.scm. Then there is the guix shell command with the 
--no-grafts argument. In that guix shell I am then running a normal shell to run 
the guile command in, with all the required directories of my project added to 
the load path. There is no profile, which would have a well known location of 
the bin directory, only that temporary shell, that has a bin directory somewhere 
at location with unpredictable name. If I update to a newer commit for 
time-machine, then that location will also change. At no point I am (currently!) 
creating a profile with predictable/specifiable bin dir location to go to. There 
is no predictable prefix, as far as I am aware.

It may be, that G-Golf is not meant or ready to be used in such a way.

To summarize it:

I guess, I want to have a single command, that will make the code run based on 
reproducible dependencies (specified somewhere, in my case in manifest.scm and 
channels.scm), so that I can run it on another machine, where there is guix 
installed. A few descriptive/declarative files like channels.scm and 
manifest.scm are OK, since I can simply commit them in my repo and all will be 
reproducible again. Usually I can run Guile code like this, with reproducible 
result on other machines.

I have some ideas:

(1) switch to making a guix profile instead, so that the bin directory is in a 
predictable location and then try running the ./hello-world thing (but how to do 
it with my own code??)

(2) perhaps there is a way to ask guix shell where its bin directory is, so that 
I can switch to that automatically to then run the code from there?

(3) Generally I would like to run the code, not a prebuilt example package. How 
else do I know, that the code listed in the repository of G-Golf as example 
actually works?

Best regards,
Zelphir

-- 
repositories:https://notabug.org/ZelphirKaltstahl,https://codeberg.org/ZelphirKaltstahl