Guix for Development

(dthompson.us)

138 points | by clircle 18 days ago

16 comments

  • civodul 12 days ago
    On the same topic, check out this how-to on software development with Guix from the Cookbook (author here):

    https://guix.gnu.org/cookbook/en/html_node/Software-Developm...

    The idea was to show that there are several "levels" to take advantage of Guix for development, where the `guix.scm` file in David Thompson's blog post is the first level.

    • goranmoomin 12 days ago
      I feel like declarative container-like dev environments (e.g. nix shell or guix shell, and so on) will become much more popular in the following years with the rise of LLM agentic tools. It seems that the aformentioned tools provide much more value when they can get full access to the dev environment.

      Sprites[0], exe.dev[1], and more services seem to be focusing on providing instant VMs for these use cases, but for me it seems like it's a waste for users to have to ssh into a separate cloud server (and feel the latency) just to get a clean dev environment. I feel that a similar tool where you can get a clean slate dev environment from a declarative description locally, without all of the overhead and the weight of Docker or VMs would be very welcomed.

      (Note: I am not trying to inject AI-hype on a Guix-related post, I do realize that the audience of LLM tools and Guix would be quite different, this is just an observation)

      [0]: https://sprites.dev

      [1]: https://exe.dev

      • sdsd 12 days ago
        As a Guix lover and LLM tooling enthusiast, I complete agree. Administrating my system via Claude Code is so much easier. LLMs work better on a system that's hackable via text.
        • attila-lendvai 12 days ago
          random note: there's `guix shell --container --emulate-fhs`.
        • smnplk 12 days ago
          Guix looks really tempting to me because i find guile scheme so much more pleasant than nix. But i heard there are not that many packages in Guix. I wonder if some sort of transpiler from nix derivations to guix package definitions would be possible.
          • herewulf 12 days ago
            You can run Nix packages on Guix if there isn't a "native" package for it. Look at nix-service.

            https://guix.gnu.org/manual/1.5.0/en/html_node/Miscellaneous...

            I've never felt the need myself. If something is missing, I add it and I think that is the real fun in running Guix because creating your own well defined package or service is deeply rewarding.

            Anyway, you can find people using it in the wild either by search engine[1] or with Toys[2] which is also handy for finding examples of missing packages too.

            [1]: https://duckduckgo.com/?t=fpas&q=%22config.scm%22+nix-servic...

            [2]: https://toys.whereis.social

            • createaccount99 11 days ago
              You can stop recommending that flow (nix on guix), it's not good. You'll know if you try it.
              • mghackerlady 11 days ago
                is it good? of course not, but it is an option
              • smnplk 9 days ago
                Thanks, I'll check it out.
              • heavyset_go 12 days ago
                This is where I'm at after using Nix for a few years for different use cases. I never want to write it again, and would welcome a Scheme over Nix.
                • Zambyte 11 days ago
                  You can just visit https://repology.org/ and see that GNU Guix has the 5th largest repository, ahead of Fedora and Gentoo. This does not include any proprietary packages, which can be added using https://gitlab.com/nonguix/nonguix (though gitlab seems to be dying for me right now?)

                  I've been running GNU Guix for five years now, after lots of distro hopping, including to and from NixOS. I left Nix because I found the documentation (particularly regarding the language) to be a struggle to work with (though I imagine it's improved since then).

                  GNU Guix + nonguix + flatpak is perfectly suitable for everyday use.

                  • sidkshatriya 12 days ago
                    The nix language is maximally lazy. It does not evaluate things it does not need to. This is good because you don't want it to burn CPU building things (very expensive expressions!!) that it will ultimately not need for final derivation. I'm wondering if guix scheme is suited well for this task:

                    (a) evaluation is eager

                    (b) lots of variable mutation.

                    But perhaps lazy evaluation and lack of variable mutation in guix scheme is not such a problem after all for a nix _like_ system -- I don't know.

                    • helibom 12 days ago
                      I'm still new to both Guile and Guix, but I've been reading the Guile and Guix reference manuals recently and I think some of your concerns about eager vs. lazy evaluation of packages are addressed by Guile's quoting mechanism, more specifically "quasiquote" [1]. This quoting mechanism allows passing around references to package definitions and whatnot, without actually evaluating those expressions until build time. Guix extends quasiquote to create something called "G-expressions" [2], which are even more so fitted to something like the Guix/Nix build system.

                      1. https://www.gnu.org/software/guile/manual/html_node/Expressi...

                      2. https://guix.gnu.org/manual/1.5.0/en/guix.html#G_002dExpress...

                      • atiedebee 12 days ago
                        Im very familiar with Nix or the language, but why would interpreting guile scheme for package management be expensive? What are guix and nix doing that would require evaluating everything lazily for good enough performance?
                        • Hasnep 12 days ago
                          It's not the Nix/Guile that's expensive, it's situations like:

                              let chromium = pkgs.chromium; in 1 + 1
                          
                          In a maximally eager language you'd need to wait for the entirety of Chromium to build before you can find out what 1 + 1 is.
                          • atiedebee 12 days ago
                            I checked the spec and Scheme R5RS does have lazy evaluation in the form of promises using "delay" and "force", but I can see why explicitly having to put those everywhere isn't a good solution.
                        • attila-lendvai 12 days ago
                          "lots of variable mutation" is more like "variable mutation is no impossible, but not common".
                        • whompyjaw 12 days ago
                          Im with you. As an emacsen, i feel it’s natural for me to use Guix, but nix is so so much more popular… :/
                          • digiown 12 days ago
                            Guix being a GNU project the purism also doesn't help. Just look at this: https://github.com/nonguix/nonguix

                            I don't even disagree that nonfree software is bad, but blaming the users who often have no choice in the matter (e.g. drivers) is the wrong way to go.

                            • allan-a 12 days ago
                              nonguix is similar to debian's non-free sources. It's also maintained by many of the same contributors to guix. Enabling it is also similar to how you enable it for Debian. I have never seen anyone blamed or shamed for using nonfree drivers by the guix community, which I can say has been a very warm and welcoming community.
                              • attila-lendvai 12 days ago
                                it does happen, and it happened to me, too.

                                but the attitude has been changing recently from active shaming for even mentioning non-free stuff, to passive acceptance of pragmatically pointing a newcomer to nonguix.

                                • digiown 11 days ago
                                  That's nice to hear. I'm a big fan of lisp and I want to switch to nix or guix at some point in the future.
                                  • kevinrineer 11 days ago
                                    That's good to hear. The intolerance to non-guix (or, possibly, my perception that it was intolerance) made me shy away from the project. This was especially so because I use repaired devices with proprietary HW that would otherwise have been binned by their owners.
                                    • attila-lendvai 11 days ago
                                      we need to speak up for common sense. i did, maybe too much even, and it has cost me some standing with the project lead... but it must be done nevertheless!

                                      people need to understand what freedom means. sure, do inform others about the downsides of using non-free stuff... but it's very hard to help freedom by shaming and alienating people for trying to use hardware they already own.

                                • herewulf 12 days ago
                                  It's a little inconvenient but for example my Framework laptop Intel WiFi chip requires a binary blob and I want aware of this. Now that I am, I can make better hardware purchasing decisions. There are plenty of alternatives that don't require that blob and it's the only thing I need from the no free channel.
                                  • freeopinion 12 days ago
                                    Are there really a lot of alternative Wifi chips that don't require closed blobs? Do you have a list?

                                    Are they found in any laptop that is reasonably available on the market?

                                    I don't think that Guix is punishing users by not supporting non-libre hardware. They are making a choice in what they develop and anybody of similar mind can join their effort.

                                    The nonguix folks are practical. It just stinks that nothing ships with a Wifi chip that doesn't require nonguix pragmatism.

                                  • digiown 12 days ago
                                    I really don't think you can gain much realistic freedom going without the blob. The powers that be will never let you have a freely modifiable radio transceiver.

                                    The blob is better viewed as a part of the hardware in this case. What's most likely to happen to get rid of the blob is to just put it on the non-modifiable parts of the device. Viewed in this way, the blob is at least something you can practically inspect, unlike the firmware on the chip itself.

                                    See also the discussion on CPU microcode:

                                    https://lists.gnu.org/archive/html/info-gnu/2018-04/msg00002...

                                    • gf000 12 days ago
                                      Open hardware is mostly a lie.

                                      They all run proprietary blobs inside and out. It's ridiculous gatekeeping to say that on the kernel level it's bad, but below it I just put my head in the sand and disregard the millions of lines of closed-source code.

                                      • yencabulator 11 days ago
                                        IMHO the stupidest GNU policy is that if a proprietary blob is stored on a flash chip in a gadget, it's ok, but if it's transmitted to the gadget at startup, it's not.
                                  • arminiusreturns 12 days ago
                                    Now if we could just get people to combine Guix and other guile scheme packages that are awesome like mcron into their stacks, and then backfeed more fixes into the ecosystem, we have a real chance at helping GNUland!
                                    • benreesman 12 days ago
                                      I compile nix derivations to well-posed effect/coeffect/graded monad algebra so I can do real bill of materials and build on an action cache engine maintained by professionals, but that's mostly for long-tail stuff.

                                      These days with a la carte access to all of the container ecosystem primitives as nice, ergonomic, orthogonal operations I don't really see the value in nixpkgs. Don't really see the value in a container registry either: a correctly attested content addressable store with some DNS abbreviations is 100 lines of code because mostly it's git and an S3 shim.

                                      The category error at the heart of nixpkgs is that the environment in which software is compiled need resemble the environment in which it executes. Silly stuff. So whether you're a patchelf --rpath ... Person or an unshare --bind-mount Enjoyer (isomorphic), just remember, in 2026 the guy with the daemon that runs as root does not want you to have nice things.

                                    • davexunit 12 days ago
                                      Always interesting to see an older article come back around. I could probably update this a bit for 2026 but my workflow is just about the same now as it was then. Guix is good and just released 1.5.0, check it out.
                                    • pmarreck 12 days ago
                                      both guix and nix are 1000% better for setting up and managing per-project deps deterministically
                                      • tetris11 12 days ago
                                        I love Guile over Nix syntax, but the one killer feature Nix has that Guix doesn’t is making a single static binary of common programs and then deploying them elsewhere.

                                        In Nix, this is a single flag. In Guix, you either deploy with all libraries on a custom /guix path, or nothing.

                                        • dhon_ 12 days ago
                                          How do you do it in nix?
                                          • r14c 11 days ago
                                            Sounds like nix-bundle, but that's not a standard feature.
                                            • tetris11 11 days ago

                                                  nix build nixpkgs#pkgsStatic.emacs
                                              
                                              So, it's not so much a static build from a flag, as it is a large corpus of statically defined recipes independent from the other packages that you can build from
                                          • kwk1 11 days ago
                                            • tetris11 10 days ago
                                              No, it produces a tree of libraries that you have to untar on the host machine. If you dont have root, then unpacking to /gnu/store is impossible
                                              • kwk1 10 days ago
                                                I checked and it looks like the root-required issue has been addressed with a --relocatable flag, and there are a few options as well for needing to untar, e.g. producing an appimage format output.
                                                • tetris11 10 days ago
                                                  I think I tried with this flag, but either it was incompatible with a cross-compile target, or it did not support my target arch properly
                                          • esperent 12 days ago
                                            > Dockerfiles are clunky and the rather extreme level of isolation is usually unnecessary and makes things overly complicated

                                            I agree, for local development docker is often overkill.

                                            However, for production it's absolutely not overkill. And since pretty much all projects are intended for production at some point, they'll need a Dockerfile and docker compose or some other equivalent.

                                            And at that point, you're maintaining the Dockerfile anyway, so why not use it for local dev as well? That way your dev and production environments can be close to identical.

                                            Guix looks nice - probably nicer than docker for dev work. But is it nice enough to justify maintaining two separate systems and have your dev and production diverge?

                                            • dominicm 12 days ago
                                              While not directly mentioned in this article, guix pack[1] allows you to distribute your software in multiple formats, including Docker images.

                                              The general philosophy of Guix is to have a single definition for how to build your software and use it for the entire dev to production pipeline.

                                              [1]: https://guix.gnu.org/manual/1.5.0/en/html_node/Invoking-guix...

                                              • skavi 12 days ago
                                                In Nix (and, I’d assume, for Guix) you can go the other way around: https://mitchellh.com/writing/nix-with-dockerfiles.

                                                As a side benefit, the generated docker image can be very tiny.

                                                • valorzard 12 days ago
                                                  Yeah Guix has a Dockerfile export
                                                • dolmen 11 days ago
                                                  Your production deployment might be done with container images, but Dockerfile is not the only way to build them. Guix has builtin support to build container images without Dockerfile.
                                                  • otabdeveloper4 12 days ago
                                                    You'd be nuts to run the Docker daemon anywhere near production.
                                                    • afarviral 11 days ago
                                                      Why is that? I also used to hold this opinion, but we use it for 99% of our production deployments (or k8s where we need it) and it has been maximally reliable, and super convenient for fault-finding. Maybe I didn't understand your take.
                                                  • sohrob 12 days ago
                                                    I wanted to go all-in on Guix but the installation process was made too difficult due to the lack of non-free software available during install time. I wish they would take the Debian approach and leave it up to the user to decide which packages they would like installed on their system or not.
                                                    • icen 12 days ago
                                                      There’s nonguix for access to non free drivers and such. I think that system crafters have some installable images if you don’t have a current guix install to build one

                                                      It’s regrettable that this is necessary, but with so few Ethernet ports on laptops it’s harder to install these things without access to WiFi.

                                                    • rudhdb773b 12 days ago
                                                      I love Guix documentation, but unfortunately I've had to stick with Nix because its more polished with a large library of packages.

                                                      LLMs have also made writing syntacticly correct Nix scripts much easier, so I don't miss Guix's Guile that much.

                                                      • bflesch 12 days ago
                                                        How is the scheme syntax in any way an improvement over JSON? Can't they build the same thing but use JSON - which everyone already uses - instead of pushing a new verbose syntax?
                                                        • cess11 12 days ago
                                                          I think it would be tricky to develop a package manager in JSON.
                                                        • nickez 12 days ago
                                                          What if a piece of software isn't packaged, like for example the ARM GCC toolchain. In a Dockerfile I just need to curl and unpack it. How do I solve that with guix?
                                                          • KnightHawk3 11 days ago
                                                            I use nix, but I assume the same goes for guix, you write a package or run it with something that emulates a FHS (like steam-run, don't mind the name) and hope it works.

                                                            Writing a package is not as bad as it sounds, nix and guix have very little difference between "package maintainer" and "user" so most users probably can package software. Normally copying something from nixpkgs or similar will get you most the way there.

                                                          • arikrahman 12 days ago
                                                            Honestly I'm just glad that this declarative approach is steadily being realized. It hasn't hit mainstream adoption yet, but it gives me hope that this headline is making the rounds.

                                                            Docker is, as the article describes, just a bandaid and the symptom of unthoughful development foundations.

                                                            In the long term, Guix may win out. Probably not in my life time though. But it's a win for developers, and nix really isn't so bad with everyone vibecoding away it's complexity anyways.

                                                            • wswin 12 days ago
                                                              I think they're two different tools. Containers are great for production environments. Beside reproducibility, they also give control over resources and manage virtual devices. Things that are rather not needed during development.
                                                            • herewulf 12 days ago
                                                              You can even generate Docker images deterministically with Guix. :)
                                                            • pshirshov 12 days ago
                                                              But flakes are more sound and more convenient!
                                                              • r14c 11 days ago
                                                                I do wish guix had something like flakes
                                                              • anthk 12 days ago
                                                                Guix asking for donations from propietary websites it's a disgrace to GNU.

                                                                But i woudn't expect less from some hijackers.

                                                                https://guix.gnu.org/donate/

                                                                Proof:

                                                                https://donate.stripe.com/8x2bJ133ia2H3Zw4j38N201

                                                                https://donate.stripe.com/aFaeVd7jy7Uz1Ro02N8N204

                                                                https://donate.stripe.com/dRm5kD47m0s79jQ9Dn8N202

                                                                • davexunit 11 days ago
                                                                  Go away.
                                                                  • anthk 11 days ago
                                                                    Go cry me a river. How can I donate to some platforms advertised by Guix with just running free software as you state? Go on.

                                                                    Explain us.