Skip to content
Menu
Open World News Open World News
  • Privacy Policy
Open World News Open World News
GNU Guix: Write package definitions in a breeze

GNU Guix: Write package definitions in a breeze

Posted on November 25, 2023 by Michael G

Author:
Source

More than 28,000 packages are available in Guix today, not counting
third-party channels. That’s a lot—the 5th largest GNU/Linux
distro
! But it’s nothing if the one package you
care about is missing. So even you, dear reader, may one day find
yourself defining a package for your beloved deployment tool. This post
introduces a new tool poised to significantly lower the barrier to
writing new packages.

Introducing Guix Packager

Defining
packages

for Guix is not all that hard but, as always, it’s much harder the first
time you do it, especially when starting from a blank page and/or not
being familiar with the programming environment of Guix. Guix
Packager
is a new
web user interface to get you started—try
it!
. It arrived
right in time as an aid to the packaging
tutorial

given last week at the Workshop on Reproducible Software Environments.

GNU Guix: Write package definitions in a breeze

The interface aims to be intuitive: fill in forms on the left
and it produces a correct, ready-to-use package definition on the right.
Importantly, it helps you avoid pitfalls that trip up many newcomers:

  • When you add a dependency in one of the “Inputs” fields, it adds the
    right variable name in the generated code and imports the right
    package
    module
    .
  • Likewise, you can choose a license and be sure the license field
    will refer to the right variable representing that license.
  • You can turn tests on and off, and add configure flags. These
    translate to a valid arguments field of your package, letting you
    discover the likes of keyword
    arguments

    and
    G-expressions
    without having to first dive into the manual.

Pretty cool, no?

Implementation

All the credit for this tool goes to co-worker and intrepid hacker
Philippe Virouleau. A unique combination of paren aversion and web
development superpowers—unique in the Guix community—led
Philippe to develop the whole thing in a glimpse (says Ludovic!).

The purpose was to provide a single view to be able to edit a package recipe,
therefore the application is a single-page application (SPA) written in
using the UI library Philippe is most comfortable with: React,
and MaterialUI for styling the components.
It’s built with TypeScript, and the library
part actually defines all the types needed to manipulate Guix packages and their
components (such as build systems or package sources).
One of the more challenging parts was to be able to provide fast and helpful “search as you
type” results over the 28k+ packages. It required a combination of
MaterialUI’s virtualized inputs,
as well as caching the packages data in the browser’s local storage,
when possible (packaging metadata itself is fetched from
https://guix.gnu.org/packages.json, a generic representation of the
current package set).

While the feature set provides a great starting point, there are still a few
things that may be worth implementing. For instance, only the GNU and
CMake build systems are supported so far; it would make sense to include
a few others (Python-related ones might be good candidates).

Running a local (development) version of the application can happen on
top of Guix, since—obviously—it’s been developed with the node
version packaged in Guix, using the quite standard packages.json for
JavaScript dependencies installed through npm. Contributions
welcome!

Lowering the barrier to entry

This neat tool complements a set of steps we’ve taken over time to make
packaging in Guix approachable. Indeed, while package definitions are
actually code written in the Scheme language, the package “language”
was designed from the get-go to be
fully declarative—think JSON with parens instead of curly braces and
semicolons. More recently we simplified the way package inputs are
specified
with an
eye on making package definitions less intimidating.

The guix import
command

also exists to make it easier to simplify packaging: it can generate a
package definition for anything available in other package
repositories such as PyPI, CRAN, Crates.io, and so forth. If your
preference goes to curly braces rather than parens, it can also convert
a JSON package
description

to Scheme code. Once you have your first .scm file, guix build
prints hints for common errors such missing module imports (those
#:use-module stanzas). We also put effort into providing reference
documentation
,
a video
tutorial
, and
a tutorial for more complex
packages
.

Do share your experience with us and
until then, happy packaging!

Acknowledgments

Thanks to Felix Lechner and Timothy Sample for providing feedback on an
earlier draft of this post.

About GNU Guix

GNU Guix is a transactional package manager and
an advanced distribution of the GNU system that respects user
freedom
.
Guix can be used on top of any system running the Hurd or the Linux
kernel, or it can be used as a standalone operating system distribution
for i686, x86_64, ARMv7, AArch64 and POWER9 machines.

In addition to standard package management features, Guix supports
transactional upgrades and roll-backs, unprivileged package management,
per-user profiles, and garbage collection. When used as a standalone
GNU/Linux distribution, Guix offers a declarative, stateless approach to
operating system configuration management. Guix is highly customizable
and hackable through Guile
programming interfaces and extensions to the
Scheme language.

Read more

Related Posts:

  • GNU Guix: Guix User and Contributor Survey 2024: The Results (part 1)
    GNU Guix: Guix User and Contributor Survey 2024: The…
  • GNU Guix: GNU Guix 1.4.0 released
    GNU Guix: GNU Guix 1.4.0 released
  • GNU Guix: From development environments to continuous integration—the ultimate guide to software development with Guix
    GNU Guix: From development environments to…
  • GNU Guix: Guix/Hurd on a Thinkpad X60
    GNU Guix: Guix/Hurd on a Thinkpad X60
  • Federated services made easier
    Federated services made easier
  • Gentle updates postponed
    Gentle updates postponed

Recent Posts

  • [TUT] LoRa & LoRaWAN – MikroTik wAP LR8 kit mit The Things Network verbinden [4K | DE]
  • Mercado aguarda Powell e olha Trump, dados e Haddad | MINUTO TOURO DE OURO – 11/02/25
  • Dan Levy Gets Candid About Learning How To Act Differently After Schitt’s Creek: ‘It’s Physically…
  • Building a Rock Shelter & Overnight Stay in Heavy Snow 🏕️⛰️
  • Les milliardaires Elon Musk et Xavier Niel s’insultent copieusement

Categories

  • Android
  • Linux
  • News
  • Open Source
©2025 Open World News | Powered by Superb Themes
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT