Re: Help defining a trivial package.

2019-09-02 Thread Timothy Sample
Hello,

"Pierre-Henry F."  writes:
>
> Hello Tim !
>
> I'm using a couple of hours here an there to try to rebuild the package you 
> gave me (Thank you for that :-) ).
> So far, I've built a very stupid but "working" package (see below if you 
> really want to ;-) ).

Looks good so far!

> Will answer on the mailing list for others to benefit from this exchange.

I’ve added the mailing list back in, then.  ;)

> Needless to say, it's not exactly obvious to figure these things out /a 
> priori/.

For sure.  By using the trivial build system, you’re working at a pretty
low level.  It’s especially tough to learn both Guix and Guile at the
same time.  For your reference, here’s a sketch of what the “#:builder”
code would look like if it were Python:

import os, shutil, stat, subprocess, guix.build.utils

# Unpack
source = _build_inputs["source"]
tar = _build_inputs["tar"]
lzip = _build_inputs["lzip"]
os.putenv("PATH", ":".join([tar + "/bin", lzip + "/bin"]))
subprocess.run(["tar", "--lzip", "-xvf", source])

# Configure
bash = _build_inputs["bash"]
python = _build_inputs["python"]
guix.build.utils.substitute("blog/bin/program",
[["/usr/bin/bash", bash + "/bin/bash"],
 ["python3", python + "/bin/python3"]])

# Install
out = _outputs["out"]
os.chmod("blog/bin/program", 0o755)
shutil.copytree("blog", out)

Here, “_build_inputs” and “_outputs” are set by Guix, and are
dictionaries.  For “_build_inputs”, the keys are the strings you put in
the “inputs” part of the package, and the values are the paths where the
packages are installed.  So, “_build_inputs["python"]” points to the
directory in the store where Python is installed.  We usually only have
one output, which is called “out”.  This is the path in the store where
we install the package being built.

The only other thing is that “guix.build.utils.substitute” is basically
just find-and-replace.  It takes the name of a file and a list of
two-element lists and replaces all the occurrences of the first elements
in the file with their corresponding second elements.

Obviously the Guile interfaces are a little different, but hopefully
this Rosetta Stone makes it easier to see what’s going on.

As an aside, ever since I learned that there’s a way to do quasiquotes
in Python [1], I’ve wondered how strange it would be if Guix were
written in Python.  Pretty strange!  :)

[1] https://macropy3.readthedocs.io/en/latest/reference.html#quasiquote

> Anyway, thanks!

You’re welcome!


-- Tim



Re: How to build only Guix Manual

2019-09-02 Thread Rafael Fontenelle
Julien,

Thanks, it is helping me a lot to fix errors in anchors and references
already. But the compilation is not successfully completing because
some os-config-* can not found -- indeed, I notice there is no
os-config-* in the build tree (no pt_BR neither English one).

See output of `make doc/guix.pt_BR.html' (it seems safe to ignore po4a
"seems outdated" messages):

  PO4A doc/contributing.pt_BR.texi
Your input po file po/doc/guix-manual.pt_BR.po seems outdated (The
amount of entries differ between files: 7994 is not 228
). Please consider running po4a-updatepo to refresh it.
  POXREF doc/contributing.pt_BR.texi
mv "doc/contributing.pt_BR.texi.tmp" "doc/contributing.pt_BR.texi"
  PO4A doc/guix.pt_BR.texi
Your input po file po/doc/guix-manual.pt_BR.po seems outdated (The
amount of entries differ between files: 7994 is not 8055
). Please consider running po4a-updatepo to refresh it.
sed -i "s|guix\.info|$(basename "doc/guix.pt_BR.texi" | sed
's|texi$|info|')|" "doc/guix.pt_BR.texi.tmp"
  POXREF doc/guix.pt_BR.texi
mv "doc/guix.pt_BR.texi.tmp" "doc/guix.pt_BR.texi"
Updating ./doc/version-pt_BR.texi
  MAKEINFO doc/guix.pt_BR.html
doc/guix.pt_BR.texi:10287: @include: could not find
os-config-bare-bones-pt_BR.texi
doc/guix.pt_BR.texi:10422: @include: could not find os-config-desktop-pt_BR.texi
doc/guix.pt_BR.texi:10429: @include: could not find
os-config-lightweight-desktop-pt_BR.texi
make: *** [Makefile:4228: doc/guix.pt_BR.html] Error 1

Any suggestion?

Em seg, 2 de set de 2019 às 17:04, Julien Lepiller
 escreveu:
>
> Le Mon, 2 Sep 2019 16:41:22 -0300,
> Rafael Fontenelle  a écrit :
>
> > Hello,
> >
> > I'm translating Guix Manual to Brazilian Portuguese, and I want to
> > build only the documentation (not the software) in order to test my
> > translation.
> >
> > What I've got so far found:
> > 1- doc/build.scm : line 9 : added "pt_BR" to the list of languages
> > 2- doc/local.mk : line 21 : added guix.pt_BR.texi to info_TEXINFOS
> > 3- doc/local.mk : line 34 : added guix/contributing.pt_BR.texi to
> > TRANSLATED_INFO
> > 4- po/doc/local.mk: line 58: added "guix-manual.pt_BR.po" to
> > DOC_PO_FILES
> >
> > Is there a way for me to build only the Guix Manual (not the
> > software)?
> >
> > Thanks in advance.
> >
> > Best regards,
> > Rafael Fontenelle
> >
>
> Hi Rafael,
>
> thanks for taking the time to translate the manual!
>
> You can build the manual only by configuring the repository. If you are
> running guix, you can simply run `guix environment guix` inside your
> current git checkout. Otherwise, you will need to install the required
> dependencies using your system package manager.
>
> Then, you can run:
>
> ./bootstrap
> ./configure --localstatedir=/var
>
> and to build only the manual:
>
> make doc/guix.pt_BR.info
>
> or
>
> make doc/guix.pt_BR.html



adding environment variables to /etc/config.scm

2019-09-02 Thread Jonathan Lane
Hello,

I have a laptop with Intel graphics and I need to set the environment
variable "COGL_ATLAS_DEFAULT_BLIT_MODE=framebuffer" to fix GPU 
corruption issues as described here:

https://wiki.archlinux.org/index.php/Intel_graphics#Troubleshooting
https://bugs.freedesktop.org/show_bug.cgi?id=88584

Unfortunately, it's supposed to go in /etc/environment, and that file
gets clobbered every time I reboot or run `guix system reconfigure`.  I
see that $GUIXSRC/gnu/system.scm does some logic to generate that file,
but I don't see an exported variable to manipulate from config.scm like
I do %desktop-services and the like.  What is the recommended way to add
global variables here?  It has to be a global variable because it alters
the behavior of the X server before gdm starts or my user logs in - I've
tested putting it in .profile and .bashrc to no avail.

Alternatively, this bug is not present on Wayland, so an update to make
gdm run via Wayland by default and expose Wayland sessions would solve
the root problem.

Thanks,

Jonathan Lane



Re: How to build only Guix Manual

2019-09-02 Thread Julien Lepiller
Le Mon, 2 Sep 2019 16:41:22 -0300,
Rafael Fontenelle  a écrit :

> Hello,
> 
> I'm translating Guix Manual to Brazilian Portuguese, and I want to
> build only the documentation (not the software) in order to test my
> translation.
> 
> What I've got so far found:
> 1- doc/build.scm : line 9 : added "pt_BR" to the list of languages
> 2- doc/local.mk : line 21 : added guix.pt_BR.texi to info_TEXINFOS
> 3- doc/local.mk : line 34 : added guix/contributing.pt_BR.texi to
> TRANSLATED_INFO
> 4- po/doc/local.mk: line 58: added "guix-manual.pt_BR.po" to
> DOC_PO_FILES
> 
> Is there a way for me to build only the Guix Manual (not the
> software)?
> 
> Thanks in advance.
> 
> Best regards,
> Rafael Fontenelle
> 

Hi Rafael,

thanks for taking the time to translate the manual!

You can build the manual only by configuring the repository. If you are
running guix, you can simply run `guix environment guix` inside your
current git checkout. Otherwise, you will need to install the required
dependencies using your system package manager.

Then, you can run:

./bootstrap
./configure --localstatedir=/var

and to build only the manual:

make doc/guix.pt_BR.info

or

make doc/guix.pt_BR.html



How to build only Guix Manual

2019-09-02 Thread Rafael Fontenelle
Hello,

I'm translating Guix Manual to Brazilian Portuguese, and I want to
build only the documentation (not the software) in order to test my
translation.

What I've got so far found:
1- doc/build.scm : line 9 : added "pt_BR" to the list of languages
2- doc/local.mk : line 21 : added guix.pt_BR.texi to info_TEXINFOS
3- doc/local.mk : line 34 : added guix/contributing.pt_BR.texi to
TRANSLATED_INFO
4- po/doc/local.mk: line 58: added "guix-manual.pt_BR.po" to DOC_PO_FILES

Is there a way for me to build only the Guix Manual (not the software)?

Thanks in advance.

Best regards,
Rafael Fontenelle



Re: Guix substitute timeout

2019-09-02 Thread Ludovic Courtès
Hi Chris!

Christopher Baines  skribis:

> I'm unsure how well the substituter copes with unreliable network
> connections, anecdotally it seems to often hang indefinitely.

How often?

I experienced it at some point last year but the problem vanished soon
after I reported it here: .

If you can reproduce it, could you try to get a C backtrace of ‘guix
substitute’, as well as the output of ‘guix’ to see if it’s fetching
gzip or lzip stuff, and the process sub-tree?

> Looking at the code [1], there is some code that looks like it would
> cancel the substitution after some amount of time, but it also looks to
> be disabled (as #:timeout? is #f when fetch is called).

That comes from commit 2207f73156e144a9349e4d395d5049119b67a896 from
2013 (!), when hydra.gnu.org was so slow and (I think) we’d rather not
time out too quickly while fetching a substitute or we’d never fetch
anything.  Good times…

We could probably enable it, though it should be a not-too-short
timeout.

Thoughts?

Ludo’.



Re: Scripting guix in guile

2019-09-02 Thread Ludovic Courtès
Hi Konrad,

Konrad Hinsen  skribis:

> The problems I see are
>
>  1. What to put into the #! line to locate Guile.

On Guix System #!/run/current-system/profile/bin/guile is very likely to
work :-), but on other systems you could use “#!/usr/bin/env guile” I
suppose.

>  2. How to construct the load path to make sure it includes
> Guix as installed under $HOME/.config/guix/current

That’s indeed annoying.  I think we should add ‘-s’ and similar flags
that ‘guile’ supports to ‘guix repl’.

In the meantime, as Jesse suggested, you could arrange to have both
‘guix’ (the package) and ‘guile’ in a profile, such that Guix and its
dependencies are available in $GUILE_LOAD_PATH.

As for inspecting the installed packages, the entry point is (guix
profiles), which has everything you need to grab info about a profile.

HTH!

Ludo’.