Trying Guix: A Nixer's Impressions (tazj.in)
from HaraldvonBlauzahn@feddit.org to linux@lemmy.ml on 22 Jul 06:11
https://feddit.org/post/16116378

One aspect of Guix I found to be really fascinating: That there is basically no conceptual difference between defining a package as a private build script, and using a package as part of the system.

Let me explain: Say you wrote a little program in Python which uses a C library (or a Rust library with C ABI) which is in the distribution. Then, in Guix you would put that librarie’s name and needed version into a manifest.scm file which lists your dependency, and makes it available if you run guix shell in that folder. It does not matter whether you run the full Guix System, or just use Guix as s package manager.

Now, if you want to install your little python program as part of your system, you’ll write an install script or package definition, which is nothing else than a litle piece of Scheme code which contains the name of your program, your dependency, and the information needed to call python’s build tool.

The point I am making is now that the only thing which is different between your local package and a distributed package in Guix is that distributed packages are package definitions hosted in public git repos, called ‘channels’. So, if you put your package’s source into a github or codeberg repo, and the package definition into another repo, you now have published a package which is a part of Guix (in your own channel). Anybody who wants to install and run your package just needs your channel’s URL and the packages name. It is a fully decentral system.

In short, in Guix you have built-in something like Arch’s AUR, just in a much more elegant and clean manner - and in a fully decentralized way.

#linux

threaded - newest

HaraldvonBlauzahn@feddit.org on 22 Jul 06:27 next collapse

I’d argue that using Scheme as a configuration language is not such a steep barrier. Any Emacs user has surely done a little bit of configuration setup by pasting bits of configuration statements into a file called .emacs . Well, the configuration language he or she was using is actually Emacs Lisp. There is no border between configuring Emacs by text file, and writing code in Lisp.

msherburn33@lemmy.ml on 22 Jul 13:34 collapse

The biggest problem with Scheme as config language is that it is sloooooowwwww. Nix is already quite sluggish when it comes to configuration changes, in Guix it’s a lot worse, and it’s unlikely to change anytime soon, given that Scheme allows macros and other hacks that might make it difficult to properly cache or index the package database.

HaraldvonBlauzahn@feddit.org on 22 Jul 15:19 collapse

It depends on the implementation, but Schemes and Lisps are in general not that slow - some use JIT compilation to native code - and Guile is not a slow Scheme.

balsoft@lemmy.ml on 22 Jul 07:38 next collapse

One aspect of Guix I found to be really fascinating: That there is basically no conceptual difference between defining a package as a private build script, and using a package as part of the system.

This is true for Nix as well.

The two main advantages of Guix are the language (which is well-known and comes with lots of good tooling and other support) and the package bootstrapping.

Shareni@programming.dev on 22 Jul 07:57 next collapse

The main disadvantages I’ve faced when trying it a few years ago:

  • non-free packages need to use a non-official channel
  • I had to install guixos through the iso provided by systemcrafters to have non-free drivers
  • I couldn’t get any help from the official guix irc because I used the modified iso, even though the issue had absolutely nothing to do with it
  • there’s significantly less packages in both than in nix, and they’re usually seriously outdated (the docker package was behind Debian for example)
  • even when I enabled downloading precompiled bins, some packages like firefox and chromium would still compile all night long

At the time it was a great concept, but essentially useless for anything not Emacs/Haskell related.

balsoft@lemmy.ml on 22 Jul 08:22 next collapse

Yep. I feel like Guix is surprisingly awesome and polished in a couple places, but mostly it’s a very DIY distro, much more so than even NixOS.

HaraldvonBlauzahn@feddit.org on 22 Jul 08:38 next collapse

  • non-free packages need to use a non-official channel
  • I had to install guixos through the iso provided by systemcrafters to have non-free drivers

Yeah. See, drivers are part of the hardware abstraction layer which in a Linux system is the Kernel. The kernel is GPL, so it is hard to get support for hardware with drivers without GPL, it does not conform Linux’ license.

I, too, had also nothing but hassle with an NVidia graphics card in Debian. It was a happy day when I finally ditched it for a supported card and had a fully supported system!

The other thing… let’s turn the question around. Would you:

  • expect from Apple that you get your Mac with The Gimp pre-installed?
  • From Microsoft that they pre- install LibreOffice and provide it for free in their app store?
  • Expect from IBM or Brother that they develop and give you free drivers for their competitor’s hardware?
  • Expect from Google that they give you free LaTeX support?
  • Expect from Adobe that they host and staff tje Linux Kernel Mailing List for free?

If not - why do some people expect equivalent things from free software projects?

Shareni@programming.dev on 22 Jul 11:03 collapse

The kernel is GPL, so it is hard to get support for hardware with drivers without GPL, it does not conform Linux’ license.

It’s a violation that’s not enforced, as almost all distros provide proprietary blobs. They balance ideology with usability, since they realised most people aren’t going to use a librebooted ThinkPad from the 90s. If everyone enforced libre purism like GNU, desktop Linux would’ve been completely dead long ago. If you need proof, check usage statistics for any of the free distros.

I, too, had also nothing but hassle with an NVidia graphics card in Debian.

And did you need to install a modified iso to have WiFi? Did maybe Debian provide those nvidia drivers?

The other thing… let’s turn the question around. Would you:

How is any of that relevant? This is not a question of additional software or services, but basic usability. Guixos as is, is for example essentially useless on a laptop unless you’re willing to carry an external WiFi card in your pocket.

If not - why do some people expect equivalent things from free software projects?

The only expectation I have for an OS is to work on my devices, guixos does not. And even when I jumped through all of the hoops to get it working, I still needed to use nix to install most packages I need to work. So why would I use guixos+nix+flatpak instead of just running nixos?

HaraldvonBlauzahn@feddit.org on 22 Jul 15:25 collapse

The only expectation I have for an OS is to work on my devices

So maybe Guix System is not a good choice for you?

It has top-priority goals like reproducibility, capability to inspect and verify all source code, and providing a fully free system. These specific goals are not compatible with providing nonfree binary blobs in Guix-core. For example, depending on non-free binary blobs will block exactly reconstructing a system years later if these binaries are not available any more. Guix has scientific applications where reproducibility absolutely matters.

Also, I can unterstand if companies are hating it which just want to have a free ride and monetize efforts of other people. But for users, there are many many other options and distributions available. Why not chose one that matches your need better?

beyond@linkage.ds8.zone on 22 Jul 15:56 next collapse

This

I use Guix as my “default” distro because I value software-freedom and reproducibility. It fits my needs very well, and I make sure to buy hardware that works with it instead of expecting it to work with whatever I throw at it. For my Windows gaming machine I use PopOS as the replacement OS instead of trying to beat Guix into serving that purpose, because PopOS is better suited for that role, and I have different expectations for it.

It’s okay if something doesn’t meet your needs, that doesn’t make it bad, just means it’s not the right thing for you. There’s like hundreds of distros for Windows gamers, let us free software zealots have ours too please.

HaraldvonBlauzahn@feddit.org on 22 Jul 16:54 collapse

I make sure to buy hardware that works with it instead of expecting it to work with whatever I throw at it.

This is the way. Trying to get unsupported hardware to work under Linux in general is such a useless expense of time. In my experience, it is almost never worth it.

paequ2@lemmy.today on 23 Jul 06:03 collapse

1,000 times this.

looks at laptops with hidpi displays 👀

Shareni@programming.dev on 22 Jul 16:21 collapse

Also, I can unterstand if companies are hating it which just want to have a free ride and monetize efforts of other people. But for users, there are many many other options and distributions available. Why not chose one that matches your need better?

Why get mad about people comparing nix and guix, in a thread comparing nix and guix? Pointing out legitimate disadvantages is not hating. Maybe get off the internet for a bit and touch grass.

It has top-priority goals like reproducibility, capability to inspect and verify all source code, and providing a fully free system that is not compatible with providing nonfree binary blobs.

So does nix, nobody is forcing you to opt-in into non-free packages. And guix most certainly is compatible with non-free blobs, as that’s how most people are using it. The only difference is that nix is supporting non-free packages instead of banning even talking about them.

HaraldvonBlauzahn@feddit.org on 22 Jul 16:51 collapse

And guix most certainly is compatible with non-free blobs, as that’s how most people are using it […]

I am not sure about that one and somewhat doubt there is hard data showing that. The 2024 user survey shows that a lot of people are using Guix as a package manager on top of another distribution, like Arch or Ubuntu or even NixOS. . If you have hardware that is not directly supported, this fixes the driver problem.

paequ2@lemmy.today on 23 Jul 06:07 next collapse

non-free packages need to use a non-official channel

It’s very easy to add additional channels and non-official channels integrate pretty well into everything. I don’t really notice if a package comes from an “official” channel or “non-official” channel.

Shareni@programming.dev on 23 Jul 06:45 collapse

I didn’t like using AUR when I ran arch, let alone some random repo with absolutely no oversight.

greywolf0x1@lemmy.ml on 23 Jul 06:35 collapse

toys.where-is.social

Find different channels and substitute servers or create your own

Shareni@programming.dev on 23 Jul 07:34 collapse

Address not found.

Also, it doesn’t change the fact you’re depending on some random person’s repo that is not moderated in any way.

jackal@lemmy.ml on 26 Jul 11:18 collapse

toys.whereis.social is the correct link

msherburn33@lemmy.ml on 22 Jul 13:37 collapse

The two main advantages of Guix are the language

I wouldn’t call that an advantage for the average person. Nix is far nicer to work with. Some Lispers might disagree, but I, for one, can’t exactly see the beauty in trying to turn Scheme into a configuration language with macros and hacks. Also Guix puts Scheme everywhere, things you can do with plain old Bash in Nix, you’ll have to all do in Scheme in Guix, so there is a much steeper learning curve.

balsoft@lemmy.ml on 22 Jul 13:50 next collapse

Well, Nix language is also full of hacks, idiosyncrasies and stupid decisions. I say that as someone who’s writing it “professionally”, i.e. as part of my job. Scheme is way less “unexpected”. But there are other parts of Guix which are pretty weird or just bad, like the “channels”/“pins” management situation.

HaraldvonBlauzahn@feddit.org on 22 Jul 17:07 collapse

Plus, if one compares the full bash man page with an introduction to Scheme - I love the quick introduction into racket with pictures - one can come to the conclusion that Schemes are both a lot simpler and more powerful.

In the end, it is pretty much a matter of taste, previous experience, and practical needs what one prefers.

HaraldvonBlauzahn@feddit.org on 22 Jul 16:26 next collapse

Some Lispers might disagree, but I, for one, can’t exactly see the beauty in trying to turn Scheme into a configuration language with macros and hacks.

Scheme is a minimalistic Lisp dialect, and macros are central in Lisp. For example, they allow for both conditional evaluation (“if” is a macro, or more precisely, a “special form” that is used in other conditionals), and for delayed evaluation at run time, which matches a bit Nix being lazy.

Also, Scheme is designed as a not strictly but mostly functional language, favouring side-effect free functions, which matches well with the declarative task which is package definitions.

bash, in contrary, is not side-effect-free, it modifies its environment, and this is very much not desired in a functional package manager: it is at the core that package declarations are side-effect-free.

And Emacs shows that Lisp written in a declarative style is a superb configuration language. (There is now even a project to use a Scheme, Steel Scheme, to configure helix, a programmers text editor which has many many features stemming from vim!).

iopq@lemmy.world on 22 Jul 19:31 collapse

Bash is not a advantage, it’s a disadvantage

msherburn33@lemmy.ml on 22 Jul 19:57 collapse

You prefer:

     (add-after 'install 'remove-examples
       (lambda* (#:key outputs #:allow-other-keys)
         (with-directory-excursion
             (string-append (assoc-ref outputs "out") "/lib")
           (for-each delete-file
                     (list
                      "basic-server"
                      "helloworld"
                      "postcollector")))

over:

postInstall = ''
   rm  $out/lib/basic-server $out/lib/helloworld $out/lib/postcollector
''

?

HaraldvonBlauzahn@feddit.org on 23 Jul 05:28 next collapse

Yes, having programmed bash and its predecessors for 30 years and several lisps (Clojure, Racket, Guile, a little SBCL) in the last 15 years, I very much prefer the Scheme version in this place.

Why?

  • This code fragment is part of a much larger system, so readability and consistency counts
  • The Guile version supports a more powerful functionality, which is that evaluation of a package can have several extra results (called outputs). It is over a year that I read about that in the Guix documentation and yet I recognize it immediately.
  • the code tells me that it is removing examples.
  • the code fits neatly into a tidy system of several stages of build and packaging
  • the code uses a structured loop. Of course you can do that in shell as well - I am pointing this out because the bash version is a bit shorter because it does not use a loop.
  • Scheme has much safer and more robust string handling. The code will not do harmful things if a file name contains white space or happens to be equal to ‘echo a; rm -rf /etc/*’.
  • Scheme strings handle Unicode well
  • If there is an error, it will not be silently ignored as is the norm in shell scripts which are not written by experts, but will throw it.
  • the code has less redundancy. For example, the bash version mentions three times the subfolder “lib”, the Guile version only once. This makes it easier to refactor the code later.
HaraldvonBlauzahn@feddit.org on 23 Jul 05:31 next collapse

(And don’t get me wrong, Unix shells are great if you want to save on extra keys pressed in a terminal session. But there are reasons that the shell languages are not often used in larger programs.)

balsoft@lemmy.ml on 23 Jul 10:00 next collapse

I agree with your overall point, that having a single consistent functional language for package descriptions and build scripts is a great thing, and that bash is awful, but your reasoning is somewhat flawed. The main drawbacks of bash are somewhat rectified in Nix because bash is very much contained/sandboxed, which prevents arbitrary damage to the system, and there are some nice defaults in stdenv too.

The Guile version supports a more powerful functionality, which is that evaluation of a package can have several extra results (called outputs). It is over a year that I read about that in the Guix documentation and yet I recognize it immediately.

Nix also supports multiple outputs (in fact this is where the concept of outputs in Guix came from)

the code tells me that it is removing examples.

You could also do that with Nix in an easier and more declarative fashion, either by adding a comment, or by doing this:

postInstallPhases = [ "removeExamplesPhase" ];
removeExamplesPhase = ''
  rm -f "$out"/lib/{basic-server,helloworld,postcollector}
'';

Scheme has much safer and more robust string handling. The code will not do harmful things if a file name contains white space or happens to be equal to ‘echo a; rm -rf /etc/*’.

Bash is just two double quotes away from doing this too. See code above for an example

Scheme strings handle Unicode well

Bash also handles Unicode well

If there is an error, it will not be silently ignored as is the norm in shell scripts which are not written by experts, but will throw it.

Nixpkgs stdenv sets set -eu which has a similar effect. If that code fails, the entire build will fail too.

the code has less redundancy. For example, the bash version mentions three times the subfolder “lib”, the Guile version only once. This makes it easier to refactor the code later.

This is also really quite easy to rectify in bash, see code above.

iopq@lemmy.world on 25 Jul 00:15 collapse

Can’t you just define a macro called rm-f and pass a list of files to remove?

HaraldvonBlauzahn@feddit.org on 25 Jul 05:34 collapse

Of course, this would be no problem. Can also be a function. The expliciteness serves readability.

balsoft@lemmy.ml on 23 Jul 09:51 next collapse

Bash code should definitely be

rm -f "$out"/lib/{basic-server,helloworld,postcollector}
iopq@lemmy.world on 24 Jul 02:11 collapse

Yes, because the bash example is a string inside of nix so it will have string highlighting inside of my text editor

[deleted] on 22 Jul 10:18 next collapse

.

Drito@sh.itjust.works on 24 Jul 00:07 next collapse

Why Guix packages are unsuitable for graphical desktop apps ?

HaraldvonBlauzahn@feddit.org on 24 Jul 04:30 collapse

They aren’t?

Drito@sh.itjust.works on 25 Jul 13:29 collapse

They aren’t on my Arch linux with Guix package manager

samc@feddit.uk on 24 Jul 07:17 collapse

I had a go at using guix as a package manager on top of an existing distro (first an immutable fedora, which went terribly, then OpenSUSE). Gave up for a few reasons:

  • As mentioned in the article, guix pull is sloow.
  • Packages were very out of date, even Emacs. If I understand correctly, 30.1 was only added last month, despite having been available since February. I get that this isn’t the longest wait, but for the piece of software you can expect most guix users to be running, it doesn’t bode well.
  • The project I was interested in trying out (Gypsum) had a completely broken manifest. Seems like it worked on the dev’s machine though, which made me concerned about how well guix profiles actually isolate Dev environments. This was probably an error on the dev’s part, but I’d argue such errors should be hard to make by design.

All in all I love the idea of guix, but I think it needs a bigger community behind it. Of course I’m part of the problem by walking away, but 🤷

HaraldvonBlauzahn@feddit.org on 24 Jul 17:43 collapse

  • As mentioned in the article, guix pull is sloow.

This one has beem discussed on several forums discussing the original blog post, like here or also here on lobste.rs

Part of the reason for slow pulls is that the GNU projects savannah server, which Guix was using so far, is not fast, especially with git repos. Luckily, this is already being improved because Guix is moving to codeberg.org, a FOSS nonprofit org which is hosted in Europe. So if one changes the configured server URL, it is faster. (On top of that interested people might use the opportunity to directly take influence, and donate to codeberg so that they can afford even better hardware 😉).