Erlang + Emacs profile

2020-06-23 Thread Zelphir Kaltstahl
Hello Guix users!

What is your way of setting up a profile for Erlang development?

There are some things I would like to have, some of which I already
managed to get:

  * [X] Erlang installed through Guix package manager in a separate profile
  * [X] `erl` REPL available in that separate profile
  * [X] an Emacs Erlang mode (installed it through M-x list-pack RET and
searched for erlang there)
  * [_] org-mode babel erlang for literate programming in org-mode,
using the Guix installed erlang executable – I found
https://github.com/xfwduke/ob-erlang, which also seems to work, but
I do not know how to point it to the Guix installed Erlang, so that
it can actually run code. Currently it complains about not finding
Erlang. Does anyone know how to point it to the Erlang executable? I
created this issue: https://github.com/xfwduke/ob-erlang/issues/1

I did not see any separate OTP package on `guix search`. Is this already
included in the `erlang` package or is this missing from Guix package
repositories?

Here is my current manifest.scm file for creating a profile (currently
not much in there):


(specifications->manifest
 '("erlang@21.3.8.13"))


Note, that Emacs is not in here, because I have it in my global or base
profile. I'd rather not have a separate Emacs for this project, but
simply use the one installed already. I am also aware, that Guix has
packages for Emacs packages, but so far I've always installed those
inside Emacs using M-x list-pack. This probably means, that Guix is not
aware of them being installed, but I had no problems with it so far.

Regards,
Zelphir



Problem with guix pull and symlink

2020-06-23 Thread Zelphir Kaltstahl
Hello Guix Users!

Since recently I see the following message on `guix pull` as normal user:

$ guix pull
Migrating profile generations to '/var/guix/profiles/per-user/xiaolong'...
guix pull: error: symlink: File exists: 
"/var/guix/profiles/per-user/xiaolong/current-guix"

And if I do:

$ unlink /var/guix/profiles/per-user/xiaolong/current-guix

And then try to do `guix pull` again, I get:

Migrating profile generations to '/var/guix/profiles/per-user/xiaolong'...
Updating channel 'guix' from Git repository at 
'https://git.savannah.gnu.org/git/guix.git'...
guix pull: error: Git error: failed open - 
'/home/xiaolong/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq/.git/FETCH_HEAD'
 is locked: Permission denied

I don't know how to fix this. I know I recently updated my root profile
running `guix pull` as root user. Perhaps that was wrong? For example:
https://www.mail-archive.com/help-guix@gnu.org/msg09356.html mentions
that one should not do so, but I only found that later and I did need to
update the locales packages in my root profile.

What should I do now, to get back to normal state?

Regards,
Zelphir



Re: Dependencies between service extensions

2020-06-23 Thread Marius Bakke
conjaroy  writes:

> Greetings help-guix,
>
> I've been a casual user of Nix for a couple of years and have decided to
> test the waters with Guix. While I'm looking forward to spending time with
> Lisp after many years away, my biggest impression is that Guix seems to
> have well-documented interfaces in cases where Nix relies more on loose
> conventions.
>
> After reviewing the manual and some of the service definitions, I'd like a
> better understanding of how to implement a common pattern. Let's say that I
> have some application Foo that uses an external system for persistence,
> like a SQL database. Before starting up service Foo I need to ensure both
> that the database service is running and that the database instance for Foo
> has been initialized, because Foo doesn't know how to initialize the
> database on its own.
>
> The first issue (how to ensure that the database service is up) seems to be
> solved by adding a shepherd-root-service-type service extension that
> declares a set of "requirements". And the second issue (performing
> pre-startup initialization) seems to be handled by the
> activation-service-type extension. So far so good.
>
> But I couldn't find documentation on whether service activation scripts can
> safely rely on other services that happen to be declared as requirements in
> the shepherd-root-service-type extension. And while I found many activation
> scripts that do simple things like modifying the filesystem, I couldn't see
> any that interact directly with other services. However, I did see some
> evidence of service extensions relying on the side effects of other service
> extensions: a number of activation scripts call "getpwnam" for info on
> system accounts that could exist only if the corresponding
> account-service-type extension has already been executed.
>
> So my questions are: could someone clarify best practices for initializing
> state in Service A before Service B starts up? And is there anything about
> the ordering/dependencies of a service's extensions that could be better
> documented in the manual?

To encode requirements for an activation script, I think you need to
declare a service type for it with appropriate requirements, and make
the start and stop actions "noop".  Then you can have other services
depend on the "activation service".

I did something similar in a service I'm working on that consists of
many different daemons.  To avoid having to run essentially the same
activation script on each, I created a "common" service that all daemons
depend upon.  It's fairly verbose (you don't need a record type), but
looks like this:

--8<---cut here---start->8---
;; This is a dummy service that all Ganeti daemons depend upon, mainly to
;; avoid having the same activation snippet on each.
(define-record-type* 
  ganeti-common-configuration make-ganeti-common-configuration
  ganeti-common-configuration?
  (ganeti ganeti-common-configuration-ganeti;
  (default ganeti))
  (directories ganeti-common-configuration-directories  ;list of strings
   (default '("/var/log/ganeti"
  "/var/log/ganeti/kvm"
  "/var/log/ganeti/os"
  "/var/lib/ganeti/rapi"
  "/var/lib/ganeti/queue"
  "/var/run/ganeti/bdev-cache"
  "/var/run/ganeti/socket"
  "/var/run/ganeti/instance-disks"
  "/var/run/ganeti/instance-reason"
  "/var/run/ganeti/livelocks"

(define (ganeti-common-activation config)
  (let ((directories (ganeti-common-configuration-directories config)))
  #~(begin
  (use-modules (guix build utils))
  (for-each mkdir-p '#$directories

(define ganeti-common-service
  (lambda _
(list (shepherd-service
   (documentation "Create the directories required by Ganeti.")
   (provision '(ganeti-common))
   (requirement '(file-systems))
   ;; Do nothing but the activation snippet, at least for now.
   (start #~(const #t))

(define ganeti-common-service-type
  (service-type (name 'ganeti-common)
(extensions
 (list (service-extension activation-service-type
  ganeti-common-activation)
   ;; This service also installs Ganeti to the profile
   ;; to make gnt-cluster, etc readily available.
   (service-extension profile-service-type
  (compose list
   
ganeti-common-configuration-ganeti))
   (service-extension shepherd-root-service-type
  ganeti-common-service)))
(default-value (ganeti-common-configuration))
(description
 "This 

failing to package attrs-strict for swh.model

2020-06-23 Thread zimoun
Dear,

I am trying to package "swh.model" which is a CLI tool developed by
Software Heritage.  It allows to compute SWHID which is their internal
hash tag.  This package is on PyPI, so I did:

   guix import pypi -r swh.model

which returns 2 packages: "python-attrs-srtict" and "swh.model".


Aside some minor tweaks about the license, synopsis and description I
added them to "gnu/packages/python-xyz.scm" and then I simply have tried
to build:

  ./pre-inst-env guix build python-attrs-strict

Well, the first unexpected thing is an 404 error:

--8<---cut here---start->8---
building 
/gnu/store/r6dgvrq486d8hdii9szz2filq85nbwjx-attrs-strict-0.1.0.tar.gz.drv...

Starting download of 
/gnu/store/9p0baqs1386gv5hhzrv5yrcj35klxpfi-attrs-strict-0.1.0.tar.gz
>From 
>https://files.pythonhosted.org/packages/source/a/attrs-strict/attrs-strict-0.1.0.tar.gz...
download failed 
"https://files.pythonhosted.org/packages/source/a/attrs-strict/attrs-strict-0.1.0.tar.gz;
 404 "Not Found"

Starting download of 
/gnu/store/9p0baqs1386gv5hhzrv5yrcj35klxpfi-attrs-strict-0.1.0.tar.gz
>From 
>https://ci.guix.gnu.org/file/attrs-strict-0.1.0.tar.gz/sha256/0nldyv053xiv9aaysjszgisi9d9d87f5l2jf3rhl3xm9c9spar96...
download failed 
"https://ci.guix.gnu.org/file/attrs-strict-0.1.0.tar.gz/sha256/0nldyv053xiv9aaysjszgisi9d9d87f5l2jf3rhl3xm9c9spar96;
 404 "Not Found"

Starting download of 
/gnu/store/9p0baqs1386gv5hhzrv5yrcj35klxpfi-attrs-strict-0.1.0.tar.gz
>From 
>https://tarballs.nixos.org/sha256/0nldyv053xiv9aaysjszgisi9d9d87f5l2jf3rhl3xm9c9spar96...
download failed 
"https://tarballs.nixos.org/sha256/0nldyv053xiv9aaysjszgisi9d9d87f5l2jf3rhl3xm9c9spar96;
 404 "Not Found"

Starting download of 
/gnu/store/9p0baqs1386gv5hhzrv5yrcj35klxpfi-attrs-strict-0.1.0.tar.gz
>From 
>https://archive.softwareheritage.org/api/1/content/sha256:2665757562a9f641611e4e0a5adc412db514757c5f4bed954a3bf651c0f68d5a/raw/...
download failed 
"https://archive.softwareheritage.org/api/1/content/sha256:2665757562a9f641611e4e0a5adc412db514757c5f4bed954a3bf651c0f68d5a/raw/;
 404 "Not Found"
failed to download 
"/gnu/store/9p0baqs1386gv5hhzrv5yrcj35klxpfi-attrs-strict-0.1.0.tar.gz" from 
"https://files.pythonhosted.org/packages/source/a/attrs-strict/attrs-strict-0.1.0.tar.gz;
builder for 
`/gnu/store/r6dgvrq486d8hdii9szz2filq85nbwjx-attrs-strict-0.1.0.tar.gz.drv' 
failed to produce output path 
`/gnu/store/9p0baqs1386gv5hhzrv5yrcj35klxpfi-attrs-strict-0.1.0.tar.gz'
build of 
/gnu/store/r6dgvrq486d8hdii9szz2filq85nbwjx-attrs-strict-0.1.0.tar.gz.drv failed
View build log at 
'/var/log/guix/drvs/r6/dgvrq486d8hdii9szz2filq85nbwjx-attrs-strict-0.1.0.tar.gz.drv.bz2'.
cannot build derivation 
`/gnu/store/yn1vi5ank86870xc75w82pwbpahgv4vx-python-attrs-strict-0.1.0.drv': 1 
dependencies couldn't be built
guix build: error: build of 
`/gnu/store/yn1vi5ank86870xc75w82pwbpahgv4vx-python-attrs-strict-0.1.0.drv'failed
--8<---cut here---end--->8---

What do I miss?

Then, from the PyPI webpage, I download the tarball by hand (wget) and
then I run:

/pre-inst-env guix build python-attrs-strict \
  --with-source=python-attrs-strict=attrs_strict-0.1.0.tar.gz

which fails at the check phase.  Well, I have added as 'native-inputs'
the packages "python-pytest" and "python-pluggy".  And I add these
lines:

--8<---cut here---start->8---
(arguments
 `(#:phases (modify-phases %standard-phases
  (replace 'check
(lambda _
  (invoke "pytest")
  #t)
--8<---cut here---end--->8---

But the tests is still failing with the same message at this end:

--8<---cut here---start->8---
AttributeError: type object 'Callable' has no attribute '_abc_registry'
--8<---cut here---end--->8---

Well, I am not a Python packager expert and I do not know how to
debug. Advices welcome. :-)


All the best,
simon



Re: I tried Guix for half a day but had to go back to NixOS

2020-06-23 Thread zimoun
Dear,

On Wed, 24 Jun 2020 at 00:21, Yasuaki Kudo  wrote:

> * Graphical installer run from a USB stick was broken.  I went insane, asking 
> the questions already answered and kept repeating them.   So I could not get 
> past the partition phase.
>
> * The Nouveau driver for my Nvidia graphics card detected a slightly off 
> resolution for my
> 4k monitor and at 30hz (not 60).   The installation of proprietary Nvidia 
> version seemed too daunting...
>
> * I struggled to find an installable web browser that had WebRTC (for online 
> conferences), which was IceCat.   I wonder if that's pretty much the only 
> choice for someone who needs precompiled code (because compiling a web 
> browser seems to take a long tome)
>
> Guix seems very interesting with Scheme and all but I had to go back to 
> NixOS.  

To mitigate the issue, instead of running full Guix System, you could
just run Guix as a package manager on the top of NixOS. :-)

Doing so, you can try Guix and what the Scheme offers without the issue
you described.  (I am running Guix on the top of Debian.)


Thank you for your feedback.

All the best,
simon



Re: I tried Guix for half a day but had to go back to NixOS

2020-06-23 Thread Simen Endsjø



Yasuaki Kudo  writes:


As the title says, I tried Guix for half a day 

I wanted to let you know that:

* Graphical installer run from a USB stick was broken.  I went 
insane, asking the questions already answered and kept repeating 
them.   So I could not get past the partition phase.


I believe this is because of a really bad case of UX-fail. I hit 
the same loop,
and found out that particular question had a different default, so 
I kept

jumping back to start instead of accepting and continuing :)



Re: Gitlab CI

2020-06-23 Thread Jérémy Korwin-Zmijowski
I tried to apply the caching as you did, but I error during project
configuration.

https://framagit.org/Jeko/guile-dummy/-/jobs/1029866

Jérémy

Le mardi 23 juin 2020 à 12:15 +0200, Jérémy Korwin-Zmijowski a écrit :
> Hey divoplade !
> 
> Thank you very much for sharing your hack ! The caching section is
> very
> interesting... Does it save time between runs ?
> 
> After a lot of attempts, I ended up with a green pipeline but it
> takes
> 43 minute to complete haha 
> https://framagit.org/Jeko/guile-dummy/-/pipelines
> 
> Jérémy
> 
> 
> 
> 
> 
> 




Re: Dependencies between service extensions

2020-06-23 Thread conjaroy
Does anyone have feedback on how to implement this type of dependency
correctly in a Guix service?

On Sun, Jun 7, 2020 at 11:43 AM conjaroy  wrote:

> Greetings help-guix,
>
> I've been a casual user of Nix for a couple of years and have decided to
> test the waters with Guix. While I'm looking forward to spending time with
> Lisp after many years away, my biggest impression is that Guix seems to
> have well-documented interfaces in cases where Nix relies more on loose
> conventions.
>
> After reviewing the manual and some of the service definitions, I'd like a
> better understanding of how to implement a common pattern. Let's say that I
> have some application Foo that uses an external system for persistence,
> like a SQL database. Before starting up service Foo I need to ensure both
> that the database service is running and that the database instance for Foo
> has been initialized, because Foo doesn't know how to initialize the
> database on its own.
>
> The first issue (how to ensure that the database service is up) seems to
> be solved by adding a shepherd-root-service-type service extension that
> declares a set of "requirements". And the second issue (performing
> pre-startup initialization) seems to be handled by the
> activation-service-type extension. So far so good.
>
> But I couldn't find documentation on whether service activation scripts
> can safely rely on other services that happen to be declared as
> requirements in the shepherd-root-service-type extension. And while I found
> many activation scripts that do simple things like modifying the
> filesystem, I couldn't see any that interact directly with other services.
> However, I did see some evidence of service extensions relying on the side
> effects of other service extensions: a number of activation scripts call
> "getpwnam" for info on system accounts that could exist only if the
> corresponding account-service-type extension has already been executed.
>
> So my questions are: could someone clarify best practices for initializing
> state in Service A before Service B starts up? And is there anything about
> the ordering/dependencies of a service's extensions that could be better
> documented in the manual?
>
> Thanks for all of your work on this project.
>
> Jason
>


Re: Gitlab CI

2020-06-23 Thread Jérémy Korwin-Zmijowski
Hey divoplade !

Thank you very much for sharing your hack ! The caching section is very
interesting... Does it save time between runs ?

After a lot of attempts, I ended up with a green pipeline but it takes
43 minute to complete haha 
https://framagit.org/Jeko/guile-dummy/-/pipelines

Jérémy








Re: Gitlab CI

2020-06-23 Thread Jérémy Korwin-Zmijowski
Le samedi 20 juin 2020 à 15:40 +0200, Ricardo Wurmus a écrit :
> 
> Can you specify a different Docker image?  Then you could create one
> containing Guix with “guix pack -f docker”.
> 

I am not the owmer of the Gitlab instance, so I think I can't... But I
can ask to the admin haha. Worth the shot !

Thank you Ricardo !