How to run a Docker service in Guix

Scenario

I need a service like Writefreely, which is lacking a Guix package definition. I have no time or skill to port it to Guix.

As temporary workaround, I can use Docker: install Writefreely inside a Docker container; declare it using a normal (i.e. declarative) Guix system definition; export it to the web, using the Nginx proxy-service on the Guix host.

Read full post gblog_arrow_right

Bcachefs on Guix

At least until 2024-11-10, Guix support for bcachefs is not optimal.

I patched Guix for supporting multi-device specifications.

I mount the file-system in this way:

  (file-systems (cons*
          (file-system
             (mount-point "/")
             (device (uuid "c1b801d4-ab86-4e62-b0d2-f8ef7d424879"))
             (type "btrfs")
             (options "compress=zstd"))

          (file-system
             (mount-point "/mnt/bcachefs")
             (type "bcachefs")
             (device "/dev/sdb:/dev/sdc:/dev/sdd")
             (mount-may-fail? #t) ; TODO temporary hack, otherwise the Guix boot process can be blocked in case of errors on some device
             (options "degraded") ; accept also recoverable errors,
                                  ; otherwise the system is blocked
          )

          %base-file-systems)))
  • bcachefs on root file-system is not yet supported, so I use btrfs;
  • the boot process in Guix must read the gnu store, that it is on btrfs;
  • I created symbolic links from the root btrfs file-system to the bcachefs file-system mounted on /mnt/bcachefs, e.g. /home, /srv, /var/opt;
  • I didn’t touched system directory needed at boot, like /var/lib;
  • I disabled the calling of bcachefs fsck from bcachefs-tools, because it is automatically done from the kernel bcachefs, and there can be mismatch between the versions of the two;

Guix and Guile error messages

Sometime Guile and Guix error messages are confusing. I will collect here some of them, as case study. Don’t get me wrong: Guile is wonderful and it is OSS.

Guile limitations

  • Racket uses contracts, so the error is signaled at the exact point where something of unexpected is happening, while in Guile one should travel the stack-trace for identifying the real source of the problem;
  • Typed Racket recognizes many errors at compile-time, while in Guile mainly at run-time;
  • CL has more type annotations in libraries, and (at least in SBCL) they are signaled as warnings during compilation;
  • CL run-time uses a stack, while Scheme has continuations, so sometime a proper stack-trace is missing;
  • in CL you can inspect also the parameters passed to functions, so it is easier figuring out the problem;

Guix system reconfigure

sudo guix system reconfigure ...

mnt/bcachefs/home/mzan/lavoro/admin/guix/think/config-nonguix.scm:439:10: error: device '/dev/sdb:/dev/sdc:/dev/sdd' not found: No such file or directory
error: Recipe system-reconfigure failed with exit code 1

The signaled problem is in this part of the configuration

Read full post gblog_arrow_right

How to develop with Common Lisp in Guix

I create a Guix project in a directory like /home/mzan/fun-projects/snow.

This is the guix.scm file

(use-modules
  ((guix licenses) #:prefix license:)
  (guix packages)
  (guix download)
  (guix gexp)
  (guix git-download)
  (guix build-system asdf)
  (guix build-system gnu)
  (guix utils)
  (gnu packages)
  (gnu packages bash)
  (gnu packages admin)
  (gnu packages autotools)
  (gnu packages base)
  (gnu packages lisp)
  (gnu packages lisp-xyz)
  (gnu packages commencement))

(define %source-dir (dirname (current-filename)))

(package
    (name "snow-assembler")
    (version "0.1")
    (source (local-file %source-dir #:recursive? #t))
    (build-system asdf-build-system/sbcl)
    (native-inputs
     (list
        sbcl
        sbcl-slynk
        sbcl-agnostic-lizard

        sbcl-defstar
        sbcl-trivia
        sbcl-alexandria
        sbcl-trivial-types
        sbcl-cl-str
        sbcl-parse-float
        sbcl-iterate
        sbcl-let-plus
        sbcl-array-operations
        sbcl-sdl2
        sbcl-trivial-benchmark
        sbcl-random-state))
    (outputs '("out" "lib"))
    (synopsis "Generate a fractal image")
    (description
     "Generate a fractal image.")
    (home-page "")
    (license license:lgpl3+))

Note that all used Common Lisp packages are defined in the project, and that the sbcl-sdl2 package will take care to install also the external (i.e. C) library. sbcl-... packages are needed only for development inside Emacs.

Read full post gblog_arrow_right

How to maintain a private Guix fork

Rationale

The usual way for customizing Guix is creating a custom channel.

I choose to fork Guix default channel, in a private branch for these reasons:

  • it is easier to customize system level settings like mounting of bcachefs and symilar things, and use them directly in my working environment (i.e. “eating your own dog food”);
  • I can send patches directly to Guix upstream, while in a channel I need to transform them;

Preparation

I installed Guix from source code, as described here.

Read full post gblog_arrow_right