Re: hurd-vm-service-type into /etc/config.scm

2024-04-10 Thread Saku Laesvuori
> Hi Saku o/
> 
> Thanks a lot, it works !
> 
> I'm in late for the plain text instead html, I think it's ok now.

Yes, now the email looks good!

- Saku


signature.asc
Description: PGP signature


Re: hurd-vm-service-type into /etc/config.scm

2024-04-09 Thread Saku Laesvuori
On Sat, Mar 30, 2024 at 09:25:32PM +0100, hubert.lomb...@ik.me wrote:
> Hi Saku, thanks a lot for your answer,
> 
> Have tried to modify some settings about my e-mail client...

Unfortunately that seems to not have fixed the problem. I am still
seeing blank lines between every line of text. This time also the
quotation levels ('>' characters at the beginning of the line) are also
off: some new text you wrote is multiple quotations in. I won't fix them
in this message so you can see more clearly what I'm talking about.

>> Le 2024-03-28T07:58:43.000+01:00, Saku Laesvuori 
>> a écrit :
>>>  On Wed, Mar 27, 2024 at 11:21:11AM +0100, hubert.lomb...@ik.me wrote:
>>>> Hello o/
>>>> 
>>>> Further investigations to insert the hurd-vm in /etc/config.scm
>>>> In my attempt at config.scm, inspired both by my own file and from
>>>> examples found on the Internet, I've tried to use (define %my-gnome as
>>>> well and (modify-services %desktop-services, knowing that I'm missing at
>>>> least 1 module related to the package list. I've tried several, but I
>>>> can't
>>>> 
>>>>  figure out which one (or which...)
>>>> 
>>>>  $ sudo guix system reconfigure /etc/config.scm
>>>> 
>>>>  --8<---cut
>>>> here---start->8---
>>>> 
>>>>  ce-9/eval.scm:223:20: In procedure proc:
>>>> 
>>>>  erreur : packages : variable non liée
>>>> 
>>>>  conseil : Auriez-vous oublié un `use-modules' ?
>>>> 
>>>>  --8<---cut
>>>> here---end--->8---
>>>> 
>>>>  As I only use Guix System, I'm aware that I'd better build
>>>> myself a a
>>>> 
>>>>  virtual machine to test this kind of configuration. Secondly,
>>>> I'm also
>>>> 
>>>>  aware that even if my (use-modules) field was satisfied, there
>>>> might
>>>> 
>>>>  still be other problems...
>>>> 
>>>>  Here's the failing test, what do you think?
>>>> 
>>>>  /etc/config.scm
>>>> 
>>>>  --8<---cut
>>>> here---start->8---
>>>> 
>>>>  (use-modules
>>>> 
>>>>  (gnu)
>>>> 
>>>>  (gnu services)
>>>> 
>>>>  (gnu services base)
>>>> 
>>>>  (gnu packages gnome)
>>>> 
>>>>  (gnu packages)
>>>> 
>>>>  (gnu packages base)
>>>> 
>>>>  (gnu system nss)
>>>> 
>>>>  (guix utils)
>>>> 
>>>>  (gnu services cups)
>>>> 
>>>>  (gnu packages certs)) ;;Maybe some modules not relevant here
>>>> ?...
>>>> 
>>>>  (use-service-modules desktop networking ssh xorg cups
>>>> virtualization sound)
>>>> 
>>>>  (use-package-modules bootloaders certs cups gnome xorg linux
>>>> vim scanner screen ssh wm audio)
>>>> 
>>>>  (operating-system
>>>> 
>>>>  (locale "fr_FR.utf8")
>>>> 
>>>>  (timezone "Europe/Paris")
>>>> 
>>>>  (keyboard-layout (keyboard-layout "fr"))
>>>> 
>>>>  (host-name "gnu")
>>>> 
>>>>  (users
>>>> 
>>>>  (cons* (user-account
>>>> 
>>>>  (name "hubert")
>>>> 
>>>>  (comment "Hubert")
>>>> 
>>>>  (group "users")
>>>> 
>>>>  (home-directory "/home/hubert")
>>>> 
>>>>  (supplementary-groups
>>>> 
>>>>  '("wheel" "netdev" "audio" "video" "kvm" "lp" "cdrom"
>>>> "scanner")))
>>>> 
>>>>  %base-user-accounts))
>>>> 
>>>>  (bootloader (bootloader-configuration
>>>> 
>>>>  (bootloader grub-efi-bootloader)
>>>> 
>>>>  (targets (list "/boot/efi"))
>>>> 
>>>>  (keyboard-layout keyboard-layout)))
>>>> 
>>>>  (swap-devices
>&g

Re: hurd-vm-service-type into /etc/config.scm

2024-03-28 Thread Saku Laesvuori
On Wed, Mar 27, 2024 at 11:21:11AM +0100, hubert.lomb...@ik.me wrote:
> Hello o/
> 
> Further investigations to insert the hurd-vm in /etc/config.scm In my
> attempt at config.scm, inspired both by my own file and from examples
> found on the Internet, I've tried to use (define %my-gnome as well and
> (modify-services %desktop-services, knowing that I'm missing at least
> 1 module related to the package list. I've tried several, but I can't
> figure out which one (or which...)
> 
> $ sudo guix system reconfigure /etc/config.scm
> 
> --8<---cut here---start->8---
> ce-9/eval.scm:223:20: In procedure proc:
> erreur : packages : variable non liée
> conseil : Auriez-vous oublié un `use-modules' ?
> --8<---cut here---end--->8---
> 
> As I only use Guix System, I'm aware that I'd better build myself a a
> virtual machine to test this kind of configuration. Secondly, I'm also
> aware that even if my (use-modules) field was satisfied, there might
> still be other problems...
> 
> Here's the failing test, what do you think?
> 
> /etc/config.scm
> 
> --8<---cut here---start->8---
> (use-modules
>   (gnu)
>   (gnu services)
>   (gnu services base)
>   (gnu packages gnome)
>   (gnu packages)
>   (gnu packages base)
>   (gnu system nss)
>   (guix utils)
>   (gnu services cups)
>   (gnu packages certs)) ;;Maybe some modules not relevant here ?...
> 
> (use-service-modules desktop networking ssh xorg cups virtualization sound)
> 
> (use-package-modules bootloaders certs cups gnome xorg linux vim scanner 
> screen ssh wm audio)
> 
> (operating-system
>   (locale "fr_FR.utf8")
>   (timezone "Europe/Paris")
>   (keyboard-layout (keyboard-layout "fr"))
>   (host-name "gnu")
>   (users
>(cons* (user-account
> (name "hubert")
> (comment "Hubert")
> (group "users")
> (home-directory "/home/hubert")
> (supplementary-groups
>  '("wheel" "netdev" "audio" "video" "kvm" "lp" "cdrom" 
> "scanner")))
>   %base-user-accounts))
>   (bootloader (bootloader-configuration
>     (bootloader grub-efi-bootloader)
>     (targets (list "/boot/efi"))
>     (keyboard-layout keyboard-layout)))
>   (swap-devices
>(list (swap-space
>    (target (uuid "527ab16b-d20c-4269-bc6f-8910ef3f8c5e")  
>   
>   (file-systems
>(cons* (file-system
> (mount-point "/boot/efi")
> (device (uuid "1C82-1420" 'fat32))
> (type "vfat"))
>   (file-system
> (mount-point "/")
> (device (uuid "e4fb3e05-b455-40db-bc59-4d4d011e1e01" 'ext4))
> (type "ext4"))
>   %base-file-systems)))
>   (packages
>    (append
>     (list nss-certs ;for HTTPS access
>       vim ;some tools expect it to be there
>       gvfs ;for user mounts
>       openssh
>       cups
>       foomatic-filters
>       hplip
>       sane-backends
>       ijs
>       ghostscript)
>     %base-packages))
> 
>   (define %my-gnome
> (package
>   (inherit gnome)
>   (name "my-gnome")
>   (propagated-inputs
>    (modify-inputs (package-propagated-inputs gnome)
>      (delete "epiphany")
>      (delete "evolution")
>      (delete "gnome-weather")
>      (delete "simple-scan")
>      (delete "gnome-maps")
>      (delete "gnome-boxes")
>      (delete "gnome-console")
>      (delete "gnome-contacts")
>      (append gnome-terminal
>     %my-gnome)

I suspect this define here. Firstly, it should be outside the
operating-system record. Here it means a field named 'define' which is
clearly not intended. The %my-gnome at the end will also cause problems
later as now %my-gnome is defined as a package record (that is not
stored anywhere) and as %my-gnome, which will cause nonterminating and
useless recursion. You might also have to import (guix packages) to
construct package records.

- Saku

PS. Your email client adds empty rows between every row of text, which
makes it hard to read. If there is a setting to control that or to omit
the HTML part completely (I'm assuming the problem is caused by
converting HTML-first emails to text form), you could try to turn it
off.


signature.asc
Description: PGP signature


Re: hurd-vm-service-type into /etc/config.scm

2024-03-19 Thread Saku Laesvuori
On Mon, Mar 18, 2024 at 03:52:44PM +0100, hubert.lomb...@ik.me via wrote:
> Hi Richard !
> 
> Le 2024-03-16T16:07:29.000+01:00, Richard Sent
>  a écrit :
> 
> > Hubert,
> >
> > Your issue is in your operating-system services field. In the backtrace:
> > 
> > --8<---cut here---start->8---
> > In procedure append: Wrong type argument in position 2 (expecting
> > empty list) #< type: # > --8<---cut here---end--->8---
> > 
> > You have several services outside of the (list) call, so you're
> > basically running
> > 
> > --8<---cut here---start->8---
> > (append (list (service-1 service-2) service-3 service-4
> > %desktop-services))
> > --8<---cut here---end--->8---
> > 
> > Append only takes lists as arguments. %desktop-services is a list, but
> > bluetooth service and hurd-vm service are not.
> 
> Thank you :) while/after reading your answer, I have tried to change
> my config file
> 
> by adding %base-services like it :
> 
> /etc/config.scm
> 
> --8<---cut here---start->8---
> (services
>    (append (list (service gnome-desktop-service-type)
>  (service cups-service-type)
>  (set-xorg-configuration
>   (xorg-configuration
> (keyboard-layout keyboard-layout
>    ;; Voici la liste des services par défaut à laquelle nous
>    ;; ajoutons nos propres services.
>    %desktop-services))
> 
> (services (cons* (service bluetooth-service-type)
>  (bluetooth-configuration
>    (auto-enable? #t)))
>   (service hurd-vm-service-type
>    (hurd-vm-configuration
>      (disk-size (* 1 (expt 2 20))) ;10G
>      (memory-size 1024))) ;1024MiB
>   %base-services))
> --8<---cut here---end--->8---

(Indentation modified to show the actual structure more clearly)

The S-exp structure is wrong here. A service declaration is of form

```
(service xxx-service-type
 (xxx-configuration
   (field-name value)
   (another-field another-value)))
```

and the `services` field must be a list of such service declarations. In
your configuration snippet the first definition of `services` is valid
but the second one is three separate elements (not a list). The first
element is a pair (not a list) with elements `(service bluetooth-service-type)`
and `(bluetooth-configuration (auto-enable? #t))`, the second element is
a single valid service declaration and the third is a list of service
declarations.

Also, you are defining the `services` field twice which will not give
expected results even if it passes the compiler (hopefully it doesn't).
You have to combine the lists and set the `services` field to that.

I think %base-services is a subset of %desktop-services, so you should
not need both in the same `operating-system` declaration.

> Instead of putting the Hurd in %base-services (arbitrarily inserted by
> myself), maybe I should create a service like %define-my-service, or
> use (modify-services.

In Guix one doesn't "put services into %base-services" but instead
creates a new list of services which contains the services in
%base-services and some additional services.

- Saku


signature.asc
Description: PGP signature


Re: Configuring mount for NTFS partition at boot makes the system unbootable.

2024-03-03 Thread Saku Laesvuori
> [...]
> When running a system reconfigure and mounting this partition with
> ntfs-3g, which is FUSE, without rebooting, I can read and write data,
> but on reboot the system will fail to boot.
> 
> My initial guess is that this may be some
> issue with the FUSE kernel module not loading at boot time, but I have
> no clue how to add such entry to load it, if this is the problem at all.

Based on that guess I would try looking into the initrd-modules field of
the operating-system declaration. No idea wheter it will work but seems
like it would be worth trying.


signature.asc
Description: PGP signature


Re: Home service for mbsync?

2024-02-22 Thread Saku Laesvuori
> Does anyone have an 'mbsync' home service, please? Thanks!

I use a service that combines mbsync and imapnotify. It's not quite
ready yet (the code could be cleaner and it should provide a way to sync
all mailboxes manually) but it's attached if you want to take a look.
(define-module (mailsync)
  #:use-module (gnu home services shepherd)
  #:use-module (gnu home services)
  #:use-module (gnu packages mail)
  #:use-module (gnu packages admin)
  #:use-module (gnu services configuration)
  #:use-module (guix gexp)
  #:use-module (guix records)
  #:use-module (srfi srfi-1)
  #:export (mailsync-mailbox
mailsync-mailbox?
home-mailsync-configuration
home-mailsync-configuration?
home-mailsync-service-type))

(define (string-list? x)
  (and (list? x)
   (every string? x)))

(define (string-or-file-like? x)
  (or (string? x)
  (file-like? x)))

(define-maybe/no-serialization string-or-file-like)

(define-configuration/no-serialization mailsync-mailbox
  (host
   (string)
   "The hostname of the IMAP server to synchronise with.")
  (port
   (integer 993)
   "The port to use to connect to the IMAP server.")
  (tls?
   (boolean #t)
   "Whether to connect with IMAPS or not.")
  (password-command
   (string)
   "The command to run to get the IMAP password")
  (user
   (string)
   "The IMAP username.")
  (listen-boxes
   (string-list (list "INBOX"))
   "The mailboxes to listen for changes to.")
  (post-sync
   (maybe-string-or-file-like)
   "A command to run after syncing the mailbox.")
  (id
   (symbol)
   "An unique identifier for this mailbox."))

(define (make-imapnotify-config mailbox syncer-id)
  (match-record mailbox 
(host port tls? password-command user listen-boxes post-sync)
#~(format #f "{\"host\": ~s,
\"port\": ~a,
\"tls\": ~a,
\"username\": ~s,
\"passwordCmd\": ~s,
\"onNewMail\": ~s,
\"onNewMailPost\": ~s,
\"wait\": 3,
\"boxes\": ~a}"
   #$host #$port #$(if tls? "true" "false") #$user #$password-command
   #$(file-append shepherd (string-append "/bin/herd start " 
(symbol->string syncer-id)))
   #$(if (maybe-value-set? post-sync) post-sync "")
   #$(format #f "[~a]"
   (string-join
(map (lambda (x)
   (format #f "~s" x))
 listen-boxes)
", ")

(define (make-isync-config mailbox)
  (match-record mailbox 
(host port tls? password-command user id)
(format #f "IMAPAccount account
Host ~a
User ~a
PassCmd ~s
SSLType ~a

IMAPStore remote
Account account

MaildirStore local
SubFolders Verbatim
Path ~~/.mail/~a/
Inbox ~~/.mail/~a/Inbox

Channel channel
Far :remote:
Near :local:
Create Both
Expunge Both
SyncState *
Patterns *\n"
host user password-command (if tls? "IMAPS" "STARTTLS") id id)))

(define (mailsync-mailbox-list? x)
  (and (list? x)
   (every mailsync-mailbox? x)))

(define-configuration/no-serialization home-mailsync-configuration
  (isync
   (file-like isync)
   "The @code{isync} package to use.")
  (goimapnotify
   (file-like go-gitlab.com-shackra-goimapnotify)
   "The @code{goimapnotify} package to use.")
  (mailboxes
   (mailsync-mailbox-list '())
   "The mailboxes to synchronise."))

(define (home-mailsync-shepherd-service config)
  (match-record config 
(isync goimapnotify mailboxes)
(apply append
   (map (lambda (mailbox)
  (let* ((id (mailsync-mailbox-id mailbox))
 (syncer-id (symbol-append 'mailsync-syncer- id))
 (listener-id (symbol-append 'mailsync-listener- id))
 (isync-config-file
  (mixed-text-file
   "mbsyncrc"
   (make-isync-config mailbox)))
 (imapnotify-config-file
  (mixed-text-file
   "imapnotify-config.json"
   (make-imapnotify-config mailbox syncer-id
(list
  (shepherd-service
   (provision (list syncer-id))
   (requirement '())
   (one-shot? #t)
   (start #~(make-forkexec-constructor
 (list
  #$(file-append isync "/bin/mbsync")
  "--all"
  "--quiet"
  "--config" #$isync-config-file)))
   (actions (list (shepherd-configuration-action 
isync-config-file
  (shepherd-service
   (provision (list listener-id))
   (requirement (list syncer-id))
   (one-shot? #f)
   (start #~(make-forkexec-constructor
 (list
  #$(file-append goimapnotify 
"/bin/goimapnotify")
   

Re: Trying to create a .zshrc in guix home environment referencing a zsh plugin

2024-01-21 Thread Saku Laesvuori
> [reformatted]
>
> (zshrc
>  (list (computed-file
> "zshrc"
> #~(begin
> (reduce string-append ""
> (list "bindkey -e\n"
>   (format #f "source 
> ~s/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh\n"
>   #$zsh-syntax-highlighting)
>   "eval \"$(direnv hook zsh)\"\n"
>   "eval \"$(zoxide init zsh)\"\n"))

The gexp passed to computed-file should produce a file when built
(evaluated)[1]. Your gexp doesn't create any files or directories, it just
evaluates to a string. Try using mixed-text-file[2] instead.

It is not relevant to this error, but I think your path to
zsh-syntax-highlighting.zsh is wrong. In my configuration it is
"/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh".

[1]: https://guix.gnu.org/manual/devel/en/guix.html#index-computed_002dfile
[2]: 
https://guix.gnu.org/manual/devel/en/guix.html#index-mixed_002dtext_002dfile

> And I receive following error:
> 
> --
> $ guix time-machine -C ./channels.scm -- home reconfigure config.scm
> guix home: error: reference to invalid output 'out' of derivation 
> '/gnu/store/2dqwm651a0p0vqwhpvsy7dn8zvx4n99x-zshrc.drv'
> --

The error says that the derivation (created by computed-file) does not
produce an output named out (because the gexp doesn't produce any
outputs).


signature.asc
Description: PGP signature


Re: guix offload

2023-12-20 Thread Saku Laesvuori
> Hello.
> 
> I have a configured build machine. From time to time it is not available
> and guix build gets stuck in an endless loop of:
> 
> guix offload: error: failed to connect to : No route to host
> process 13902 acquired build slot 
> guix offload: error: failed to connect to : No route to host
> process 13902 acquired build slot 
> 
> Is it possible to make the build continue locally after several
> unsuccessful attempts?

I don't think that is currently possible. You can, however, filter your
build machines with a snippet like this in the operating system
declaration[1]. This filters away hosts that are not resolvable, but you
could adapt it to use some other predicate if needed.

```
(build-machines
 (list #~(let* ((resolvable? (lambda (machine)
   (false-if-exception
 (gethost (build-machine-name machine))
   (filter resolvable?
   (list (build-machine
 (name "example.com")
 (systems '("x86_64-linux"))
 (host-key "")
 (user "offload")))
```

If you don't use guix system you can implement the filter logic in
/etc/guix/machines.scm.

[1]: 
https://guix.gnu.org/manual/devel/en/guix.html#guix_002dconfiguration_002dbuild_002dmachines


signature.asc
Description: PGP signature


Re: USB redirection via libvirt

2023-11-20 Thread Saku Laesvuori
> I am trying to get USB redirection working with libvirt, but I am 
> hitting a snag. [...] I am now getting a new error:
> 
> Error setting USB device node ACL: 'Error PoliciKit error: 
> GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Action 
> org.spice-space.lowlevelusbaccess is not registered' (0)
> 
> It fails no matter which client I use (virt-manager, virt-viewer, 
> gnome-boxes). Is there a way to fix that permission so I can redirect my 
> USB devices?

I had the same problem some time ago. It can be fixed by extending
polkit-service-type with spice-gtk, i.e.

(operating-system
  ...
  (services
...
(simple-service 'spice-polkit polkit-service-type (list spice-gtk


signature.asc
Description: PGP signature


Re: Turning off tests leads to a different store item

2023-11-08 Thread Saku Laesvuori
On Wed, Nov 08, 2023 at 10:18:40AM -0800, Vagrant Cascadian wrote:
> On 2023-11-08, Felix Lechner via wrote:
> > On Wed, Nov 08 2023, Maxim Cournoyer wrote:
> >> A source tree doesn't produce a derivation.  A derivation is the
> >> complete build recipe that captures the source and the package
> >> definition, that when built by the daemon produces a store item.
> >
> > Okay, thanks! Now I'm going to get it right:
> >
> > The store item that is produced should not change whether build-time
> > tests run or not.
> >
> > It does not make sense (and wastes resources) to rebuild a consuming
> > package because build-time tests were enabled or disabled in an input.
> 
> I do not really think people are misunderstanding you, more that your
> *should* does not align with reality in a way that guix can depend on;
> build-time tests *do* affect the build result in some cases.
> 
> [...]
> 
> The only way to ensure they do not change the build results is even more
> resource-intensive; systematically run the build without tests and then
> run the build with tests and compare the store items... assuming the
> build is reproducible in the first place, which is not yet 100% reliable
> either, unfortunately.

There is another way: simply preventing the tests from changing the
resulting store item. For example, the package could first be built
without tests and then that build tree could be copied to the build tree
of the build with tests enabled. The result of that build could then
just be copied from the testless build, ignoring any changes the test
suite has made to the build tree. I'm not confident enough in my
understanding of how Guix builds things to say for sure that this
specific method would work, but I am quite sure that the general idea is
implementable.


signature.asc
Description: PGP signature


Re: Store file names / how to intern files in subdirectory?

2023-10-05 Thread Saku Laesvuori
> [...]
> I understand it makes no sense to try to get
> /gnu/store/greenclip.service, but would it be possible to achieve
> /gnu/store/pznbc8xxhfkwxjbaff9h982cy4df1y1a-greenclip.service/some-directory/greenclip.service?
> Or are files always saved at the "top level" of the store?

It is possible with file-union. See the G-expressions section in the
manual.


signature.asc
Description: PGP signature


Re: Encrypted install in VM stuck in GRUB

2023-09-14 Thread Saku Laesvuori
> Hi all,
> 
> I installed guix in an x86 virtual machine, using the 1.4 installer. I
> selected the guided partitioning option with encryption, so everything was
> done by the installer.
> 
> When the installation is finished and the virtual machine reboots, I have 
> 
> -- copy start --
> Booting from Hard Disk...
> GRUB loading..
> Welcome to GRUB!
> 
> Attempting to decypt master key...
> Enter passphrase for hd0,gpt2 ()
> -- copy end --
> 
> Then I type the passphrase (I was very careful that the focus is in the vm
> screen and to not make any mistake, and I did the same twice) and I have
> 
> -- copy start --
> error: access denied.
> error: no such cryptodisk found.
> error: disk 'cryptoduuid/ not found
> Entering rescue mode...
> grub rescue>
> -- copy end --
> 
> I have setup the keyboard to use French azerty layout in the installer, then
> I was expecting my keyboard layout to be that one when typing the
> passphrase. If it is not so, then I typed a wrong password but in other
> distros, the message I got when typing a wrong password is pretty different,
> so maybe this is not the problem.

That is the same error message I get after mistyping my password. I'm
also quite sure the layout is US qwerty before unlocking the encryption
regardless of any keyboard layouts defined in the system configuration.


signature.asc
Description: PGP signature


Re: GHC packages' inputs leak in guix shell

2023-09-09 Thread Saku Laesvuori
> > I can’t check right now, but I’m guessing a plain `cabal install`
> > would also add base64-bytestring to GHC’s visible packages?
> 
> I tested with cabal-install and it somehow manages to hide the haskell
> packages that are installed as dependencies.

Apparently cabal uses ghc environments[1], which are files that define a
list of flags for ghc, to hide all packages except the explicitly
installed ones. Guix could probably also create a file like that for
every profile that contains ghc and/or packages for it. Another way
would be adding a phase to hide all the haskell packages in the
package-db ($out/lib/ghc-9.2.5/ghc-esqueleto-3.5.8.1.conf.d) except for
the package itself.

Creating environment files could maybe cause problems when combining
profiles, so I think hiding dependency packages in a build phase would
be a better solution. I tried this with ghc-esqueleto and it seems to
work (though I'm sure the code isn't particularly clean and it certainly
is slower than I would like).

[1]: 
https://ghc.gitlab.haskell.org/ghc/doc/users_guide/packages.html#package-environments

```
(define-public ghc-esqueleto
  (package
(name "ghc-esqueleto")
(version "3.5.8.1")
(source (origin
  (method url-fetch)
  (uri (hackage-uri "esqueleto" version))
  (sha256
   (base32
"0k7h2hbxv14x0kq9w2wi83h0swzlri99ic9rj76540l39yqwjc5v"
(build-system haskell-build-system)
(properties '((upstream-name . "esqueleto")))
(inputs (list ghc-aeson
  ghc-attoparsec
  ghc-blaze-html
  ghc-conduit
  ghc-monad-logger
  ghc-persistent
  ghc-resourcet
  ghc-tagged
  ghc-unliftio
  ghc-unordered-containers
  openssl
  zlib))
(native-inputs (list ghc-hspec
 ghc-hspec-core
 ghc-mysql
 ghc-mysql-simple
 ghc-persistent-mysql
 ghc-persistent-postgresql
 ghc-persistent-sqlite
 ghc-postgresql-simple
 ghc-quickcheck))
(arguments
 (list
  #:tests? #f ; Needs a running MySQLd.
  #:phases #~(modify-phases %standard-phases
   (add-after 'register 'hide-dependencies
 (begin
   (use-modules (srfi srfi-1)
(ice-9 popen)
(ice-9 rdelim))
   (lambda* (#:key name inputs #:allow-other-keys)
 (let* ((out #$output)
(lib (string-append out "/lib"))
(haskell  (assoc-ref inputs "haskell"))
(name-version (strip-store-file-name haskell))
(version (last (string-split name-version #\-)))
(conf-dir (string-append lib "/ghc-" version 
"/" name ".conf.d"))
(port (open-input-pipe
   (string-append "ghc-pkg list 
--simple-output "
  "--package-db=" 
conf-dir)))
(pkgs (string-split (read-line port) #\space))
(ghc-pkg (lambda (args)
   (apply invoke "ghc-pkg"
  (string-append 
"--package-db=" conf-dir)
  args
   (for-each (lambda (pkg)
   (ghc-pkg (list "hide" pkg)))
 pkgs)
   (ghc-pkg (list "expose" (string-drop name 
4)) ; drop "ghc-"
(home-page "https://github.com/bitemyapp/esqueleto;)
(synopsis "Type-safe embedded domain specific language for SQL queries")
(description
 "This library provides a type-safe embedded domain specific
language (EDSL) for SQL queries that works with SQL backends as provided by
@code{ghc-persistent}.  Its language closely resembles SQL, so you don't have
to learn new concepts, just new syntax, and it's fairly easy to predict the
generated SQL and optimize it for your backend.")
(license license:bsd-3)))
```


signature.asc
Description: PGP signature


Re: How to use certbot and REQUEST_CA_BUNDLE

2023-09-05 Thread Saku Laesvuori
On Tue, Sep 05, 2023 at 10:59:21AM +0200, Moisés Simón wrote:
> Hi,
> 
> I'm running my own acme server and CA I need to pass REQUEST_CA_BUNDLE env 
> variable to the certbot mcron job.
> 
> What would be the best approach to pass this variable to certbot-service that 
> Guix provides?

Probably writing a patch for the certbot service, I don't think it's
possible to modify the environment of a service's shepherd job if the
service doesn't provide a configuration option for it.


signature.asc
Description: PGP signature


Re: GHC packages' inputs leak in guix shell

2023-08-29 Thread Saku Laesvuori
> I can’t check right now, but I’m guessing a plain `cabal install`
> would also add base64-bytestring to GHC’s visible packages?

I tested with cabal-install and it somehow manages to hide the haskell
packages that are installed as dependencies.

```
$ guix shell -CN cabal-install coreutils zlib -D ghc-old-time
## Building old-time failed so I added it's inputs.
## Zlib is also required for building the dependency chain.
$ cabal update
$ env -u GHC_PACKAGE_PATH cabal install --lib esqueleto
$ ghci
ﬦ import Database.Esqueleto.Experimental
-- This works, so the package from cabal-install is visible
ﬦ import Data.ByteString.Base64.URL.Lazy

: error:
Could not load module `Data.ByteString.Base64.URL.Lazy'
It is a member of the hidden package `base64-bytestring-1.2.1.0'.
You can run `:set -package base64-bytestring' to expose it.
(Note: this unloads all the modules in the current scope.)
```


signature.asc
Description: PGP signature


Re: GHC packages' inputs leak in guix shell

2023-08-28 Thread Saku Laesvuori
On Mon, Aug 28, 2023 at 01:40:14PM +0200, Simon Tournier wrote:
> Hi,
> 
> On Thu, 24 Aug 2023 at 19:16, Saku Laesvuori  wrote:
> >> > Running `guix shell --pure ghc-esqueleto -D ghc-bytestring-builder`
> >> > results in an environment that has the base64-bytestring package (from
> >> > ghc-base64-bytestring) visible, even though it is not listed on listed
> >> > the command line (ghc-bytestring-builder doesn't dependend on it). It
> >> > seems to "leak" from the inputs of ghc-esqueleto which does depend on
> >> > ghc-base64-bytestring.
> >> 
> >> What do you mean by “leak”?
> >
> > I would expect packages to keep their (non-propagated) inputs separate
> > from the environment I use. Here ghc-esqueleto makes it's haskell inputs
> > visible to the ghc in my environment.
> 
> Could you be more explicit?
> 
> The package ghc-base64-bytestring does not seems being propagated; the
> store item ghc-base64-bytestring does not appear in the profile
> generated by “guix shell”.

Yes, it is not propagated but it's still visible to ghc, which is not
something I would expect. I'd expect to not be able to import modules
from packages that are not in any of the active profiles.

> However,
> 
> --8<---cut here---start->8---
> $ guix shell -C ghc-esqueleto ghc gcc-toolchain -- ghci
> GHCi, version 9.2.5: https://www.haskell.org/ghc/  :? for help
> ghci> import Data.ByteString.Base64.URL.Lazy
> ghci> :t encode
> encode
>   :: Data.ByteString.Lazy.Internal.ByteString
>  -> Data.ByteString.Lazy.Internal.ByteString
> --8<---cut here---end--->8---
> 
> and instead, you would like:
> 
> : error:
> Could not find module `Data.ByteString.Base64.URL.Lazy'
> It is not a module in the current program, or in any known package.
> 
> Right?

Exactly.

> Well, I do not know if it is possible.  I guess it is because of this
> file:
> 
> --8<---cut here---start->8---
> $ find $(guix build ghc-esqueleto) -type f -print | grep base64
> /gnu/store/zqax59v1v537h26g0kypka6klaaahnqf-ghc-esqueleto-3.5.8.1/lib/ghc-9.2.5/ghc-esqueleto-3.5.8.1.conf.d/base64-bytestring-1.2.1.0-CQYLTs5ShsEFl2lwe4hRrI.conf
> --8<---cut here---end--->8---

I think that is most likely the reason. I don't think cabal has this
problem (I haven't actually used cabal much at all so this is just
speculation), so it could be possible to fix. Of course, cabal-install
and guix have different ways of packaging so it might also be
impossible.


signature.asc
Description: PGP signature


Re: GHC packages' inputs leak in guix shell

2023-08-24 Thread Saku Laesvuori
> > Running `guix shell --pure ghc-esqueleto -D ghc-bytestring-builder`
> > results in an environment that has the base64-bytestring package (from
> > ghc-base64-bytestring) visible, even though it is not listed on listed
> > the command line (ghc-bytestring-builder doesn't dependend on it). It
> > seems to "leak" from the inputs of ghc-esqueleto which does depend on
> > ghc-base64-bytestring.
> 
> What do you mean by “leak”?

I would expect packages to keep their (non-propagated) inputs separate
from the environment I use. Here ghc-esqueleto makes it's haskell inputs
visible to the ghc in my environment.

> Does it happen if you run
> 
> guix shell -C ghc-esqueleto -D ghc-bytestring-builder
> 
> ?

Yes it does.


signature.asc
Description: PGP signature


GHC packages' inputs leak in guix shell

2023-08-15 Thread Saku Laesvuori
Running `guix shell --pure ghc-esqueleto -D ghc-bytestring-builder`
results in an environment that has the base64-bytestring package (from
ghc-base64-bytestring) visible, even though it is not listed on listed
the command line (ghc-bytestring-builder doesn't dependend on it). It
seems to "leak" from the inputs of ghc-esqueleto which does depend on
ghc-base64-bytestring.

Is this a bug in guix or is it unavoidable for some reason?


signature.asc
Description: PGP signature


Re: Can Guix channels be non-GPL?

2023-06-13 Thread Saku Laesvuori
> One view is that GPL does not propagate, because the Guile language does
> not link.

This would be a very dangerous interpretation and clearly go against the
spirit of the GPL: any proprietary software could use any GPL software
if they were written in a language that doesn't link. There is a lot of
python code, for example, under the GPL and it would have no protection
against being used in proprietary programs.

> If Guix’ GPL would propagate, then the GPL2 of libgit2 would propagate
> to Guix.

Libgit2 defines an exception that it may be linked against programs
under any license, and I would consider FFI or whatever Guile uses to
interact with the compiled libgit2 library to qualify as linking.

I feel like Guix' GPL would propagate, but you could ask
licens...@fsf.org what they think about it.


signature.asc
Description: PGP signature


Re: Error building with guix system image

2023-04-25 Thread Saku Laesvuori
> > (define %operating-system
> >   (operating-system
> >(host-name "image-test")
> >(bootloader (bootloader-configuration
> > (bootloader grub-bootloader)
> > (targets '("/dev/sdX"
> >(file-systems (cons*
> >   (file-system
> >(mount-point "/")
> >(device "/dev/sdX1")
> >(type "ext4"))
> >   %base-file-systems
> 
> Do you correctly substitute /dev/sdX for your real device name (e.g.,
> /dev/sda) ?

I did try with that too, but it failed with the same error. Today I
almost accidentally found out that this error was caused by a corrupt
store item and was fixed by running `guix gc --verify=contents,repair`.

The error message could certainly be improved (or rather, a error
message about a corrupt store could be added), but I didn't find the
actual failing check so that I can't send a patch.


signature.asc
Description: PGP signature


Error building with guix system image

2023-04-19 Thread Saku Laesvuori
Running `guix system image image-minimal.scm` fails with the following
build log:

```build log for partition.img.drv
copying 340 store items | [progress bar animation]
registering 337 items | [progress bar animation, fails before end]
Backtrace:
In ice-9/eval.scm:
619:8 19 (_ #(# # …))
In ./gnu/build/image.scm:
236:4 18 (initialize-root-partition "tmp-root" #:bootcfg _ # _ # …)
In ice-9/boot-9.scm:
   260:13 17 (for-each # …)
In ./gnu/build/image.scm:
167:6 16 (register-closure "tmp-root" "system" #:schema _ # _)
In ./guix/store/database.scm:
   111:20 15 (call-with-database "tmp-root/var/guix/db/db.sqlite" # # …)
In ./guix/progress.scm:
71:36 14 (call-with-progress-reporter #< sta…> …)
In srfi/srfi-1.scm:
634:9 13 (for-each # …)
In ./guix/store/database.scm:
   420:36 12 (_ #< item: "/gnu/store/8z1q7vjxylm6l4ibsyw…>)
In ./guix/store/deduplication.scm:
 42:4 11 (nar-sha256 "tmp-root/gnu/store/8z1q7vjxylm6l4ibsywd4h6…")
In ./guix/serialization.scm:
381:9 10 (dump "tmp-root/gnu/store/8z1q7vjxylm6l4ibsywd4h6m6jv6z…")
In srfi/srfi-1.scm:
634:9  9 (for-each # …)
In ./guix/serialization.scm:
   386:23  8 (_ "share")
381:9  7 (dump "tmp-root/gnu/store/8z1q7vjxylm6l4ibsywd4h6m6jv6z…")
In srfi/srfi-1.scm:
634:9  6 (for-each # …)
In ./guix/serialization.scm:
   386:23  5 (_ "locale")
381:9  4 (dump "tmp-root/gnu/store/8z1q7vjxylm6l4ibsywd4h6m6jv6z…")
In srfi/srfi-1.scm:
634:9  3 (for-each # …)
In ./guix/serialization.scm:
   386:23  2 (_ "ja")
   380:43  1 (dump "tmp-root/gnu/store/8z1q7vjxylm6l4ibsywd4h6m6jv6z…")
In srfi/srfi-1.scm:
   691:29  0 (filter-map # …)

srfi/srfi-1.scm:691:29: In procedure filter-map:
In procedure car: Wrong type argument in position 1 (expecting pair): #f
environment variable `PATH' set to 
`/gnu/store/zfiwdkwfs039q346nkynvhllxbra2rg8-e2fsprogs-1.46.4/bin:/gnu/store/zfiwdkwfs039q346nkynvhllxbra2rg8-e2fsprogs-1.46.4/sbin:/gnu/store/nj43wfbldxrwfmrk9vgvliz28iyl89dp-fakeroot-1.30.1/bin:/gnu/store/lpkpldxni8vab82kwq9qs032hni580ak-dosfstools-4.2/sbin:/gnu/store/131xfb6iz9vh7c8s7kv6nhvycrqcfad8-mtools-4.0.42/bin'
```

Does anyone have any pointers on how to debug or fix this? The operating
system builds nicely with `guix system vm`. Building
`gnu/system/examples/bare-bones.tmpl` with `guix system image` also
fails with a similar error and works correctly with `guix system vm`.


```image-minimal.scm
(use-modules
  (gnu)
  (gnu system image))

(define %operating-system
  (operating-system
   (host-name "image-test")
   (bootloader (bootloader-configuration
(bootloader grub-bootloader)
(targets '("/dev/sdX"
   (file-systems (cons*
  (file-system
   (mount-point "/")
   (device "/dev/sdX1")
   (type "ext4"))
  %base-file-systems

(image-with-os (raw-with-offset-disk-image)
   %operating-system)
```

Output of `guix describe` just in case, though the error also occured
with the latest guix version when I tested.

```channels.scm
(list (channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git;)
(branch "master")
(commit
  "5c893787be78a79433fe1343f5b70cd647e8f667")
(introduction
  (make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
  "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA")
```


signature.asc
Description: PGP signature


Re: Newbie: Why executing "guix home reconfigure" requires an Internet connection?

2023-03-15 Thread Saku Laesvuori
On Tue, Mar 14, 2023 at 11:49:41PM -0500, Rodrigo Morales wrote:
> Table of Contents
> _
> 
> 1. The context
> 2. The questions
> 
> 
> 1 The context
> =
> 
>   Currently, the only way I know how to make my laptop connect to the
>   Internet is via Ethernet, because the Wi-fi card of my laptop requires
>   nonfree firmware.
> 
>   Today, I had to use my laptop without Ethernet (i.e. no connection to
>   the Internet). While I was using it, I decided to run `guix home
>   reconfigure' because I thought that in contrast to installing a
>   package, `guix home reconfigure' seems to only act in local
>   files. However, it threw an error and it seemed it tried to connect to
>   the Internet. The following code block shows the error message.

While `guix home reconfigure` does create local symlinks, it still has
to build the packages it references and building packages requires an
internet connection for fetching substitutes or sources.

If you have not changed the packages referenced in your configuration or
ran `guix pull` after the last `guix home reconfigure`, I'd think it
shouldn't require an internet connection.


signature.asc
Description: PGP signature


Adding files to base-initrd

2022-11-26 Thread Saku Laesvuori
Is there a way to add extra files to base-initrd in guix system
configuration? The use case I have in mind is adding a key file for my
encrypted drive to the initrd so that I would only have to enter my
password once. Now I have to enter it once for GRUB and then once again
for linux.

- Saku Laesvuori


signature.asc
Description: PGP signature


Re: Store path in package definition

2022-08-28 Thread Saku Laesvuori
> Modulo typos, and indentation being weird because 'phone,
> 
> (arguments
>  (list
>   #:make-flags
>   #~(list (string-append "HELLO=" #$output "/bin/hello"))
>   #:phases
>   #~(modify-phases %standard-phases
>  (add-after 'unpack 'option-one
>   (lambda _
>(substitute* "foo.c"
> (("hello")
>  (string-append #$output "/bin/hello")
>  (add-after 'unpack 'option-two
>   (lambda* (#:key outputs #:allow-other-keys
>(let ((out (assoc-ref outputs "out")))
> (substitute* "foo.c"
>  (("hello")
>  (string-append out "/bin/hello"))

Thanks all. I got that part working. Unfortunately I found out that
firefox/icecat tries to find native messaging manifests only from a
hardcoded /usr/lib/... path so packaging a native messaging host
manifest is impossible without patching the browser (as far as I know).

- Saku Laesvuori


signature.asc
Description: PGP signature


Re: Am I doing it all wrong?

2022-08-28 Thread Saku Laesvuori
> > Also, that should probably be "$@", just in case.
> 
> I don't think it'll make any difference; if, say, "foo" "bar" "baz" is
> passed, both $@ and "$@" will expand to "foo" "bar" "baz" (yes, bypassing
> the quotes).
> 
> According to POSIX.1-2017's specification of `sh`:
> 
>   When the expansion occurs within double-quotes, the behavior is unspecified
>   unless one of the following is true:
> 
>   + Field splitting [...] would be performed if the expansion were not within
> double-quotes [...].
> 
>   + [...]
> 
> So, $@ == "$@".

It does actually make a difference if the arguments have spaces. Given
arguments "foo" and "foo bar", $@ expands to "foo" "foo" "bar" and "$@"
expands to "foo" "foo bar".

- Saku Laesvuori


signature.asc
Description: PGP signature


Store path in package definition

2022-08-25 Thread Saku Laesvuori
Hi,

I'm writing a package definition for
[passff-host](https://github.com/passff/passff-host) which requires a
file to reference another file with an absolute path (passff.json must
reference passff.py). How can I get the resulting store path to patch it
to the file? I would assume I have to do something with gexps but
couldn't figure it out by reading the documentation.

- Saku Laesvuori


signature.asc
Description: PGP signature


Re: Substitute not being used

2022-08-19 Thread Saku Laesvuori
> > I'm trying to install telegram-desktop and I *think* guix should be able
> > to substitute it, but instead it tries to build it. (which then
> > consistently fails, which is why I started looking into it)
> 
> Do you have allowed  substitutes?

Yes. The build failure was caused by not having enough memory and was
fixed by adding swap space.

> However, as you noticed, the ungrafted version seems substituable and
> not the grafted one.

That explains it, thanks! I didn't realize grafting could affect
substituting (or be different on the same commit).

- Saku Laesvuori


signature.asc
Description: PGP signature


Substitute not being used

2022-07-25 Thread Saku Laesvuori
I'm trying to install telegram-desktop and I *think* guix should be able
to substitute it, but instead it tries to build it. (which then
consistently fails, which is why I started looking into it)

$ guix describe
Generation 11   Jul 25 2022 10:15:41(current)
  guix 2367469
repository URL: https://git.savannah.gnu.org/git/guix.git
commit: 236746900f062b34c857c4aab21709bcf1448ac7

There is a build for telegram-desktop for x86_64-linux
(https://ci.guix.gnu.org/build/1119886/details) that is part of an
evaluation on the same commit that my guix is on.

One confusing thing I've noticed while looking into this is that when
guix starts building telegram-desktop it says it's building

/gnu/store/aqhqhza58lzkvzxrspzbf8v9ssqvkxri-telegram-desktop-2.9.3.drv

but the derivation on ci.guix.gnu.org is

/gnu/store/gz50dz1rfaik7s33d22r2lmyzwd7f7bm-telegram-desktop-2.9.3.drv

Can someone explain what's happening here and what I have misunderstood?


signature.asc
Description: PGP signature