News for hackers. Stuff that matters.
Re:The guide to software development with Guix by coldblues on Thursday June 08, 2023 @06:28AM (#36239618)
I much prefer GNU Guile over Nix. Anyone else? I saw some progress being made towards making NixOS compatible with other programming languages.
Re:The guide to software development with Guix by bjoli on Thursday June 08, 2023 @07:27AM (#36240087)
Well. One is a language that hate metasyntaxtic abilities and a decent standard library. One is not. Defining a package in guix is a lot nicer than in nix
Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @07:43AM (#36240233)
I find Nix to be very close to the perfect DSL for what it does, and I like it quite a lot. But then I never bothered to look at Guix closely -- is its DSL at least lazy? Are there any honest comparisons wrt verbosity and awkwardness of Nix and Guix for stuff both are supposed to be good at?

No idea what "making NixOS compatible with other programming languages" is supposed to mean. On the face of it the phrase is, well, baffling. Would you care to elaborate?

Re:The guide to software development with Guix by rekado on Thursday June 08, 2023 @08:08AM (#36240509)
> its DSL at least lazy

This keeps getting asked and it's baffling to me. Any programming language can delay evaluation by wrapping values in thunks where that makes sense, so it seems odd to me to give so much importance to whether values are evaluated strictly or delayed by default.

Guix package definitions declare other package values as inputs, and evaluation of these inputs is in fact delayed.

Verbosity: in Guix we don't generally run shell snippets as part of a build; the build phases are compiled into a Guile builder script, so in the absence of helpful abstractions build phases do not generally have the conciseness of shell scripts. On the other hand abstractions are easily fashioned, so some things are more concise and clearer than the shell equivalent.

Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @08:20AM (#36240651)
> Any programming language can delay evaluation by wrapping values in thunks where that makes sense

Indeed. I was simply asking whether the macros used for programming Guix are lazy, how is that baffling?

Re:The guide to software development with Guix by rekado on Thursday June 08, 2023 @08:38AM (#36240884)
It's baffling because the question is too vague to produce a meaningful answer. What does it mean for macros in Guix to be lazy? The expansion of some macros may be (and is) lazy. For some things lazy evaluation is sensible (e.g. for declaring dependencies because you don't necessarily want to go evaluate the whole graph whenever you evaluate a single package value), for others it is not.
Re:The guide to software development with Guix by ParetoOptimal on Thursday June 08, 2023 @10:53AM (#36242859)
> > its DSL at least lazy

> This keeps getting asked and it's baffling to me. Any programming language can delay evaluation by wrapping values in thunks where that makes sense, so it seems odd to me to give so much importance to whether values are evaluated strictly or delayed by default.

At least in Haskell laziness increases composability.

I can't think of any examples in Nix, but maybe it's the same reason?

Re:The guide to software development with Guix by t0astbread on Thursday June 08, 2023 @01:55PM (#36245915)
One use case for lazy evaluation in NixOS is that you can reference other parts of the system configuration, possibly even defined in other modules, as long as you don't produce cyclic references. For example, I use stuff like the following often to avoid accidentally specifying a username that does not exist:

  { config, ... }:
  {
   systemd.services.foobar = {
    enable = true;
    serviceConfig.User = config.users.users.foobar.name;
    # etc...
   };
  }
Another use case is being able to keep everything as plain values. For example, I can run `import <nixpkgs> { }` without evaluating all of `nixpkgs`. You can accomplish that in a language with eager evaluation by wrapping values in functions but I prefer the everything-is-a-value way.

Of course, this is just a matter of preference. Like most Guix vs. Nix aspects, as far as I can tell.

Re:The guide to software development with Guix by civodul on Thursday June 08, 2023 @04:17PM (#36248247)
The "service" mechanism in Guix System is designed in part as a reaction against those the NixOS module design you're describing: I think the ambient authority, free-style extension mechanism of NixOS modules makes it hard to reason about it (any module can change the config of any other module), and it makes it easy to shoot oneself in the foot (with infinite recursion in particular, as you write).

In Guix System, services extend one another, forming a directed acyclic graph of extensions. When a service extends another service, that connection is explicitly declared, there's no surprise.

To see what it means in practice, check out the Explorer: https://notabug.org/civodul/guix-explorer

Re:The guide to software development with Guix by t0astbread on Thursday June 08, 2023 @08:09PM (#36251213)
Nix bombs out when it runs into a cyclic reference, so at least infinite recursion doesn't hang without any output. Likewise, it also rejects multiple definitions for a value (though to be fair some values like attribute sets are mergeable and it can be hard to wrap one's head around that).

The service model in Guix looks pretty neat! I've long been thinking it would be nice to have a configuration system for NixOS that uses isolated components with a defined (type-safe) interface. The current modules are kind of that, except it all gets squashed down into a single nested attribute set, so it's not really isolated and (understandably) can be confusing. How does Guix System handle multiple services competing for the same global resource (port allocation, file in /etc, ...)?

Re:The guide to software development with Guix by civodul on Friday June 09, 2023 @04:34AM (#36254985)
There's nothing to prevent multiple services from using the same port at this stage. For files in /etc, the "etc" service should detect that the same file appears more than once and error out--that is, it won't instantiate a "broken" system.

There are other things that are detected statically and prevent you from instantiating a broken system: missing modules in the initrd, invalid file system label/UUID, references to non-existent Shepherd services, etc. All this is possible because there are well-defined data types and semantics for the different components of the system.

Re:The guide to software development with Guix by t0astbread on Friday June 09, 2023 @11:43AM (#36259535)
Fair enough, NixOS doesn't completely solve this either (other than the aforementioned possibility to reference other parts of the system config and some integrity checks). I was just wondering if that's an area where more static checks are possible.

That sounds pretty good though, thanks! Maybe I'll try out Guix System some day.

Re:The guide to software development with Guix by civodul on Thursday June 08, 2023 @08:21AM (#36240665)
One thing that's often overlooked with Nix (the language) is that it does not let you define new data types. For example, there's no "package" type in Nix and Nixpkgs; instead there are only functions that are passed "attribute sets" (key/value dictionaries).

That Nix can't tell what's a package and what's not is a hindrance for its user interface (e.g., it's hard to look up packages by name/version or to iterate over them) and for packagers (e.g., easy to end up with package definitions that don't follow the informal "schema").

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @08:06AM (#36240478)
Guix uses Guile, which is a general purpose scheme/lisp dialect, allowing for lazy evaluation
Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @08:13AM (#36240571)
I know quite well what Guile and Scheme are; I was asking about the specific DSL/library/whatever combo that Guix is programmed in. The code snippets on the page which this thread is about, for example, mostly use macros that seem to mimic their Nix equivalents very closely but are marginally more verbose. I would very much like to see a compelling example where the fact that Guile has macros makes a practical difference.

(Note that Nix's laziness is not an unalloyed good either, for example it is notoriously difficult to debug. But let's limit ourselves to pure expressiveness for now)

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @08:34AM (#36240819)
Well I mean look at the docs. To each their own but I find Guile much more palatable than Nix. Moreover, I would rather spend time learning Guile then an obscure language like Nix. But for you Nix is a perfect DSL so i think we would probably be bashing our heads against the wall debating which is better.

As regards macros, Guile allows you to write your own macros in a pretty straight forward way that is just not the case in Nix

Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @08:57AM (#36241111)
I'm not trying to "debate" anything here.

I do note that those Guix people that are feeling competitive towards Nix for whatever reason tend to over-rely on two arguments that just do not work too well when examined closely.

The first is "Nix is obscure the way Guile is not". I would argue both are equally obscure and neither is obscure enough for its quality or UX to suffer for it. And does expertise in Guile (base Scheme is trivial) carry over anywhere interesting?

The second is "Macros!", where the implied idea is that unrestricted syntactic extensibility is Good. Well, I like Lisp (more partial to CL then Scheme, but who cares at this resolution), and I find unrestricted syntactic extensibility to be more of a hazard than a benefit; plus the expressivity of a non-strict FP language really gets you close enough for practical purposes.

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @09:17AM (#36241371)
Besider Guix, Guile is also the default extension language for the GNU project. Moreover by learning Guile you learn a lisp which some people find quite enlightening. What do you gain from learning Nix, asside from Nix?

Moreover, "macros are good" in the sense that they are powerful and grant the user freedom to construct software in ways that are just not possible with languages that try to herd their users into a specific mode of behavioir. It is the old freedom and responsibility problem. Again, I believe it is a matter of choice and personal preference

Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @09:41AM (#36241731)
Oh boy.

> Guile is also the default extension language for the GNU project.

AFAIK Guix is the only project that uses Guile and has any actual users (I'm not counting Shepherd because outside GuixSD it is nothing). Guile is like 30 years old, and has been envisioned as "the default extension language for the GNU project" all that time (I was an active contributor for a while, so I should know). Guile is not even used by Emacs; Guile extensibility support in GDB is not even commonly built by distros. Guile is a nice and very competent Scheme implementation and I'd love for it to be useful outside Guix, but that's just not the case, and repeating that slogan won't change it. Seriously, just stop.

> It is the old freedom and responsibility problem

No, it is not. Software development is a social and technical field, not a branch of philosophy.

Re:The guide to software development with Guix by lagniappe on Thursday June 08, 2023 @09:47AM (#36241827)
regardless of who is right, the fervent opinions and bless-your-hearts in this thread tell me that I'm better off using neither. Purity tests are fucking dumb, escalating goalposts are fucking dumb, worrying about how others compute is fucking dumb. We're all nerds here, there's no need for this level of emotional investment into other people's opinions..
Re:The guide to software development with Guix by umanwizard on Thursday June 08, 2023 @09:49AM (#36241867)
You're absolutely right, but if that makes you not try something you might be missing out. For example, Rust is probably my favorite programming language (definitely my favorite native-code-producing one) even though I find some of the community extremely off-putting.
Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @10:17AM (#36242259)
Oh boy, you didn't even answer my question about Nix. I guess you can't in a way that doesn't concede to my point - guile is definitely not obscure in the sense that nix is.

For what its worth, here is at least one recent funded project that is using Guile:

https://spritely.institute/goblins/

You also seem to think that I am some kind of Guix/Guile evangelist. No (I actually also prefer CL). I just happen to think that Guix is a better solution than Nix and that it uses a much better language.

> No, it is not. Software development is a social and technical field, not a branch of philosophy.

And I guess you get to say what's good and bad in field? Lol

Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @10:33AM (#36242514)
> you didn't even answer my question about Nix.

Your question was basically "is this DSL generally useful outside the domain it's been designed for?", so I thought it was rhetorical. That said, the domain of building, configuring and packaging software is not exactly tiny and is only getting bigger as time goes on (which is more bad than good in itself, but beside the point)!

How useful is the DSL implemented by Guix outside Guix itself? What's the comparative mental footprint of that vs. base Guile? Things get interesting when you think them through honestly and avoid stale slogans.

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @11:06AM (#36243090)
DSL implemented by Guix? Whatever do you mean?

Anyway, most people that I've come across who've used both nix and guix say that the learning curve for the latter is much less. HOWEVER, they usually stayed with nix because it had easier access to non-gnu stuff

Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @11:25AM (#36243458)
> DSL implemented by Guix? Whatever do you mean?

From what I've seen (which matches my expectations going in), Guix relies on macros heavily enough to be considered a DSL on top of Guile (as opposed to "library" or "framework"). I could be wrong, of course.

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @12:22PM (#36244453)
Having macros does not equal having a DSL. In fact for me a big benefit of Guix is precisely that it doesn't use a DSL, but uses a well established and maleable language like Scheme
Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @05:51PM (#36249700)
> Having macros does not equal having a DSL.

Any set of non-trivial non-standard macros is a DSL, by definition. You have to know what a macro does and what it is for in order to even understand which of its similar-looking keyword or positional arguments are evaluated and which are not, how they relate to each other, etc, etc. I really don't see what you are arguing about here, or to what end.

Re:The guide to software development with Guix by medo-bear on Friday June 09, 2023 @02:46AM (#36254204)
> Any set of non-trivial non-standard macros is a DSL, by definition.

thats not entirely correct but even with that definition you should think about the non-standard part. guix uses standard guile syntax and has the whole guile language available to it.

anyway i think you are trying way too hard to equate nix and guile in a way thats simply doesnt click with me. maybe you invested too much time learning nix to concede that there is something better and simpler out there

Re:The guide to software development with Guix by cmm on Friday June 09, 2023 @03:28AM (#36254517)
> guix uses standard guile syntax and has the whole guile language available to it.

I feel I'm not getting through here. Let me try again: Guile is base Scheme plus some SRFIs plus some more extensions. None of this is useful outside the Guix bubble, because it is not really used for anything outside that bubble. I suppose pointing at a hundred Texmacs users who picked it up after being exposed to Guix would prove me wrong, but good luck with that.

> maybe you invested too much time learning nix

Maybe armchair psychoanalysis is extremely bad form. Note that I'm not trying to argue against Guix (or Guile, or GNU, or whatever) -- for all I know Guix is just great, and I know Guile is great (shall I rephrase and repeat this disclaimer again until it "clicks"?). I just tend to be triggered by idiotic sloganeering argumentation, especially when it is repeatedly reflexively employed as if it can substitute for a honest technical comparison.

Re:The guide to software development with Guix by medo-bear on Friday June 09, 2023 @04:22AM (#36254896)
> Guile is base Scheme plus some SRFIs plus some more extensions. None of this is useful outside the Guix bubble, because it is not really used for anything outside that bubble.

"idiotic sloganeering argumentation"?

> honest technical comparison

let me spell it out for you in another way

nix is developed in cpp (which itself is a huge collection of dsls) and you use its own (poorly documented) dsl to interact with it

guix is developed in guile and you use guile to interact with it

this alone implies that you get far more from just learning guile than nix dsl if all you want to do is package management

as for a one to one technical comparison, it is just a google search away: https://gist.github.com/abcdw/e54807b0a25e61fe2cf1bf8991410f...

>I suppose pointing at a hundred Texmacs users who picked it up after being exposed to Guix would prove me wrong, but good luck with that.

you keep sloganeering that guile is useless outside of guix. i find it pretty funny how willing you are to twist the picture of reality in order for it to fit your world view. i already pointed you to another significant project that uses guile. here is the part in their documentaion spelling out their choice for guile: https://spritely.institute/static/papers/spritely-core.html#...

as for texmacs, i dont know where you are pulling your numbers from, but i for one used texmacs for writing papers before even considering taking on software development professionally. so please forgive me if i dont take your claim at face value

Re:The guide to software development with Guix by cmm on Friday June 09, 2023 @04:59AM (#36255154)
> another significant project that uses guile.

That looks like a typical academic project that is overwhelmingly likely to die as soon as the grants run out, what am I missing? Where are the users?

> nix is developed in cpp

Who cares?

> its own (poorly documented) dsl to interact with it

Nix documentation is not by any means ideal and is kind of scattered, but calling it "poor" is a blatant misrepresentation.

> guix is developed in guile and you use guile to interact with it > this alone implies that you get far more from just learning guile than nix dsl > if all you want to do is package management

Argument by repetition, wonderful.

> as for a one to one technical comparison, it is just a google search away

That is... not good. And when a commenter pointed out its biases and misleading generalizations, the author invited them to go listen to a stream, lol, nope.

> you keep sloganeering that guile is useless outside of guix.

That's because it is, no need to get so defensive about it. It does not detract from its technical qualities! In any case, the goalpost got moved way far from the original "Guile iS tHe OfFiCiAl eXtEnSiOn LaNgUaGe Of ThE gNu PrOjEcT", wouldn't you say?

> forgive me if i dont take your claim at face value

"Guile is for all practical purposes useless outside the Guix ecosystem" is my null hypothesis here and so far I stand by it. "Proving" that would be proving a negative, so I don't intend to even attempt that. It should, however, be fairly easy to disprove if you have data. Show us how learning Guile (or any Lisp that is not Elisp really -- sad!) is likely to be worthwhile for a "normal person" apart from using it for Guix.

Re:The guide to software development with Guix by medo-bear on Friday June 09, 2023 @09:02AM (#36257219)
if you know nix DSL but dont know cpp (whatever it means to know cpp) then the whole nix internals are just a black box to you. this is simply not the case with guix. if you cant see the benefit of guix/guile relationship here then there is not much more i can say to you

anyway as i said at the start this whole thing is just heads banging against a wall. i have no problems with you holding your views. it just happens that i disagree with them. if you expect of me to promote the virtues of lisp to you then im sorry but thats not gonna happen. you can do your own discovery. if you dont know then you dont know :)

Re:The guide to software development with Guix by cmm on Friday June 09, 2023 @09:46AM (#36257738)
> the whole nix internals are just a black box to you.

Yes, and just as well. Modern software is a barely-holding-together tower of abstractions as it is. Do you find yourself looking at the C source of Guile's runtime often? Or Glibc? The Linux kernel? Intel microcode? Aren't you glad you don't have to?

(Nixpkgs, on the other hand, is very accessible and many parts of it make for great reading)

> if you expect of me to promote the virtues of lisp to you then im sorry but thats not gonna happen.

No, I hope (in vain, looks like) that you'll start making some sense and stop using and then desperately defending stupid arguments.

Re:The guide to software development with Guix by medo-bear on Friday June 09, 2023 @12:23PM (#36260175)
lol so now you think that looking at nix internals is like looking at intel microde. my hat goes off to you :)
Re:The guide to software development with Guix by cmm on Friday June 09, 2023 @12:39PM (#36260399)
Looking at Nix internals would, over at the Guix land, be more like looking at the Guile compiler, or garbage collector -- all Nix-the-tool implements is the language and the primitive derivation machinery. Could certainly be educational, but neither is nor should be required of anyone _using_ the abstraction in question.

Do you have any more deliberate obtuseness to share, or shall we stop?

Re:The guide to software development with Guix by medo-bear on Friday June 09, 2023 @08:08PM (#36266071)
> Looking at Nix internals would, over at the Guix land, be more like looking at the Guile compiler, or garbage collector

huh? nope. looking at guix internals would just mean looking up guile documentation :)

Re:The guide to software development with Guix by cmm on Friday June 09, 2023 @05:39AM (#36255456)
And let me make some further general observations here, while I'm unfortunately procrastinating.

People use software to solve their problems. The way you "sell" (in whatever sense) software to people is by showing them which of their problems it solves (they don't even have to be explicitly aware they have those problems in the first place, BTW) and how.

Nix(OS) is adopted first and foremost because it clearly solves some pressing problems. It allows you to have many development environments that don't stomp on each other, without managing a zoo of containers or VMs. It allows you to specify the operating system (or even just the user environment) you use, over as many machines as you need, deterministically and while ensuring that once you solve a problem it stays solved.

Those are real pain points, and since Nix solves them it would be used by people regardless of those people feel about Nix-the-language, because language appreciation is not the main reason people use it -- pain is.

Some goes for Guix, obviously.

So if your goal (whatever your motivation may be) is to explain to a Nix user how Guix is better, you need to point out something that is relevant to the person you are "selling" to and is fundamentally painful with Nix and painless with Guix. And, well, reaching first thing for "Guile is the official extension language of the GNU Project" does not do your marketing effort any favors.

Re:The guide to software development with Guix by medo-bear on Friday June 09, 2023 @09:03AM (#36257226)
> So if your goal (whatever your motivation may be) is to explain to a Nix user how Guix is better

I never said that that is my goal

Re:The guide to software development with Guix by lejalv on Thursday June 08, 2023 @10:28AM (#36242432)
> AFAIK Guix is the only project that uses Guile and has any actual users

TeXmacs (https://texmacs.org) uses Guile, Gimp uses a Scheme, and learning Guile for Guix should be transferable with little changes to other Schemes.

Re:The guide to software development with Guix by BeetleB on Thursday June 08, 2023 @10:33AM (#36242503)
> Moreover by learning Guile you learn a lisp which some people find quite enlightening. What do you gain from learning Nix, asside from Nix?

This thread is baffling. cmm is asking a fairly simple question. He's not trying to make a point. If people don't have the answer, they need not respond! There are so many responses to him - none answering his question.

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @10:41AM (#36242641)
lol everyone seems to be baffled in this thread. i am just adressing his claim that guile and nix are equally obscure. which to me is just plain silly
Re:The guide to software development with Guix by BeetleB on Thursday June 08, 2023 @11:02AM (#36243010)
If you're into Lisp/Scheme, it sounds silly.

If you're part of the 99% who know little of Lisp languages, he is correct. There's not much of a difference between 0.001% and 0.01%, when you're working in numbers like 20+%.

Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @11:26AM (#36243495)
And even more than that: I think Guile specifically would long have been abandoned and forgotten about if not for Guix.
Re:The guide to software development with Guix by davexunit on Thursday June 08, 2023 @12:05PM (#36244178)
While Guix is the Guileverse's biggest and most successful project, a lot of the compiler/VM work that happens in Guile happens pretty independently because Andy Wingo just likes to hack on Guile. Guile would still be here, but the community would be smaller.
Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @11:34AM (#36243649)
what are these numbers? i think any person with a cs education would at least recognise lisp syntax
Re:The guide to software development with Guix by BeetleB on Thursday June 08, 2023 @12:28PM (#36244571)
> i think any person with a cs education would at least recognise lisp syntax

The discussion wasn't on Lisp, but Guile. They may recognize Lisp syntax, but the majority will not have heard of Guile (let alone Scheme).

And you are referring to recognizing Lisp syntax, which is not what I was referring to when I said "know little of Lisp languages". Sure - most know it exists and has a lot of parentheses.

BTW, many if not most programmers don't have a CS education. And many who do don't encounter Lisp in their curriculum. I just checked my undergrad's required courses - the PL course has Java, SML, Prolog and Python - no Lisp. Anecdotally, in all the teams I've worked in for my career, there was only one team where people had an idea of Lisp. In the other teams, they didn't even know that it's the language with a lot of parentheses (as in they'd look at Lisp code and have no idea which language it was).

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @04:17PM (#36248251)
it would make more sense to write "majority will not have heard of Scheme (let alone Guile)"

still who knows Nix?

Re:The guide to software development with Guix by BeetleB on Thursday June 08, 2023 @05:47PM (#36249659)
Does it matter?
Re:The guide to software development with Guix by medo-bear on Friday June 09, 2023 @02:47AM (#36254207)
yes
Re:The guide to software development with Guix by tomn on Thursday June 08, 2023 @11:41AM (#36243770)
> What do you gain from learning Nix, asside from Nix?

Nix is a small and approachable lazy pure-functional language. You can learn a fair bit of functional programming by reading nixpkgs, which is frequently recommended even if you never use it in the real world -- exactly the same way as you

> by learning Guile you learn a lisp which some people find quite enlightening.

By learning nix you learn a FP language which some people find quite enlightening.

Personally I can't find any software which I would want to contribute or extend which uses guile (except GDB which can also be extended with python), so the "you ain't gonna need it" argument holds for guix too.

It's just such an odd argument for a relatively minor difference between the two ecosystems.

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @01:17PM (#36245366)
What you say would be the case if Nix uses Haskell or Guix uses some obscure purpouse made lisp
Re:The guide to software development with Guix by tomn on Thursday June 08, 2023 @02:22PM (#36246342)
again, you said

> by learning Guile you learn a lisp which some people find quite enlightening

so learning a lisp is enlightening, but learning a FP language is not

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @02:52PM (#36246781)
FP is a paradigm. lisp is a language. you can use lisp to learn FP

if i wanted to learn pure FP i would probably pick many things over Nix

Re:The guide to software development with Guix by tomn on Thursday June 08, 2023 @03:06PM (#36246986)
> if i wanted to learn pure FP i would probably pick many things over Nix

of course, but that wasn't the question:

> What do you gain from learning Nix, asside from Nix?

Re:The guide to software development with Guix by medo-bear on Thursday June 08, 2023 @04:13PM (#36248171)
but if you wanted to learn lisp/scheme Guile is a very good choice whereas if you wanted to learn FP Nix is a pretty crappy choice
Re:The guide to software development with Guix by umanwizard on Thursday June 08, 2023 @09:47AM (#36241830)
> does expertise in Guile (base Scheme is trivial) carry over anywhere interesting?

If you ever want to embed a dynamic language in a native code program for configuring/scripting the latter, Guile is a great choice.

Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @10:00AM (#36242010)
It is, but there already are other choices that are not worse and that are more established
Re:The guide to software development with Guix by umanwizard on Thursday June 08, 2023 @10:02AM (#36242035)
What, for example? The only other one I can think of is Lua and IMO it’s quite debatable whether that is more established than Guile.
Re:The guide to software development with Guix by cmm on Thursday June 08, 2023 @10:07AM (#36242127)
It is at least used outside of the GNU Project...
Re:The guide to software development with Guix by tomn on Thursday June 08, 2023 @11:58AM (#36244081)
please compare:

https://archlinux.org/packages/extra/x86_64/lua/#pkgreqs https://archlinux.org/packages/core/x86_64/guile/#pkgreqs

(lua at least is under-counted as there is luajit, lua51, and various packages which embed their own version, e.g. pandoc)

Re:The guide to software development with Guix by mongol on Thursday June 08, 2023 @12:55PM (#36245003)
This presentation I think was a fair attempt to compare, or at least to look at Guix from a Nix perspective

https://youtu.be/bDGzCXr6VYU

Re:The guide to software development with Guix by pmoriarty on Thursday June 08, 2023 @08:12AM (#36240569)
I'm in love with Scheme, so would much rather use Guile/Guix for this than learn Nix's DSL that's not even lispy and that's not used anywhere else.
Re:The guide to software development with Guix by Filligree on Thursday June 08, 2023 @11:43AM (#36243812)
These days those aren't the only options; you can also use Nickel: https://github.com/nickel-lang/nickel-nix

Which isn't fully baked, no, but here's hoping.

Re:The guide to software development with Guix by ducktective on Thursday June 08, 2023 @08:30AM (#36240778)
I think with the introduction of Nickel [1], Nix packages would be rewritten in it over time, which may be a good thing (types) or a bad thing (another fragmentation after flakes) depending on your point of view.

On the other hand, Guile is not a DSL but a general purpose language or a Lisp (Scheme to be exact), so it's not actually a downside compared to a DSL in my view.

I myself am torn between these two. Nix community is larger and they have more packages. Guix, being a GNU project, obsessing over ""non-free"" sure won't help in its adoption. Even debian folks toned down their stance on this, why couldn't Guix do so too?

[1]: https://github.com/tweag/nickel

Re:The guide to software development with Guix by rekado on Thursday June 08, 2023 @08:36AM (#36240850)
> Guix, being a GNU project, obsessing over nON-fReE

As a long time contributor to Guix I find that the "obsessing" is regularly done by others when talking about GNU. There's enough useful free software out there that needs packaging, and that's what I do. I don't need the extra headache of special snowflake licenses or custom restrictions.

For nonfree software that doesn't have a popular alternative I contribute to guix-science-nonfree. It's barely an inconvenience for users to expressly add another channel to their Guix installation.

Re:The guide to software development with Guix by accelbred on Thursday June 08, 2023 @09:00AM (#36241147)
When I used Guix, I needed nonfree for Firefox and the upstream Linux kernel. I also prefer to only use free software, and also like them not including proprietary software.

Needing a channel was a huge inconvenience as you would often pull your channels and stuff would break, as guix was updated but non-guix wasn't. Managing channel manifests was a pain. Firefox would often be months out of date as well.

Moved to NixOS, didn't enable allowUnfree, and had an actually up to date and simple to maintain system. Flakes solves the channels problems too. I had put a lot of effort into making Guix work, but it just had too many usabiltity issues, and the policy on firefox was a major one.

Re:The guide to software development with Guix by davexunit on Thursday June 08, 2023 @09:28AM (#36241536)
Counter anecodate: I use guix + the nonguix channel for firefox, linux, etc. and it has been smooth sailing for quite some time.
Re:The guide to software development with Guix by Kalq on Thursday June 08, 2023 @10:43AM (#36242678)
I'm not sure how long ago you used Guix, but in my experience, modern day nonguix is very up to date with Firefox and upstream Linux. Combined with things like Guix shell, time machine, and pinning specific commits, I find things have not broken for me in ways that I couldn't easily resolve in a few minutes in a long time.
Re:The guide to software development with Guix by nyberg on Thursday June 08, 2023 @11:02AM (#36243027)
I've been using guix since 0.15.0 and haven't seen it as much of an issue. Sure, channels will sometimes be out of sync with the latest commit but that's to be expected given that you're likely not following a version cut but rather the latest commit. It's easy enough to bump the package locally (inherit, etc) or contribute an update which solves this for everyone.

Needing channels for non-free is a feature as the system will be pure by default and can make progress towards fully reproducible builds for all packages rather than having several blessed non-free blobs around that drain maintainance time.

For the record, I use linux-nonfree, amdgpu, iwlwifi, firefox, and steam.

Re:The guide to software development with Guix by b3n on Thursday June 08, 2023 @03:05PM (#36246977)
Guix comes with a service for using Nix packages[1], if that's what you want. It's very simple to setup, and would allow you to use Nix's Firefox package without any issue.

[1] https://guix.gnu.org/manual/en/html_node/Miscellaneous-Servi...

Re:The guide to software development with Guix by ryan77627 on Thursday June 08, 2023 @11:42AM (#36243788)
I've been using Guix for a bit over 2 months at this point and honestly the whole 'non-free' software thing has not been an issue in the slightest. Use the System Crafters installation iso [1] to get around driver issues on install, and then the only time I've ever had the system complain to me was it warning me one of my hardware components wouldn't work (which it did, since the System Crafters ISO uses the standard Linux kernel). Afterwards, just add nonguix (and I even added Nix as well, so I get the best of both worlds!) If a package isn't in Guix and I don't want to make a package definition, I simply pull it using Nix home-manager. May not be the best or 'proper' setup, but I find it works well enough. [2]

[1]: https://github.com/SystemCrafters/guix-installer/releases

[2]: https://g.stationery.lol/ryan77627/guix-dotfiles

Re:The guide to software development with Guix by ducktective on Thursday June 08, 2023 @12:49PM (#36244914)
For installation and setting up something as basic as drivers, we should follow a non-official guide?
Re:The guide to software development with Guix by orbital-decay on Thursday June 08, 2023 @01:20PM (#36245396)
Yes if your only connection is wi-fi with drivers that require nonfree firmware, which is missing from the official ISO. You're supposed to discuss nonfree software in some non-official place too. That's what been stopping me as well; the system seems technically superior to Nix and not nearly as chaotic, but hardcore FOSS idealism makes it impractical sometimes.
Re:The guide to software development with Guix by ryan77627 on Thursday June 08, 2023 @06:07PM (#36249891)
I will admit, I was hesitant as well, but so far it's been fine. The #guix community on libera.chat is very active and has been nothing short of amazing in helping me understand the ins and outs of Guix. For any non-free software I use, #nonguix in libera.chat exists. It's less active but still pretty active (plus I pop in occasionally).
Re:The guide to software development with Guix by ryan77627 on Thursday June 08, 2023 @06:05PM (#36249867)
No, feel free to use the official guide, it's still very, very, very helpful. Yes, you do need to use an unofficial image, but that's just if you have hardware that requires non-free drivers (or blobbed drivers, Guix uses Linux-Libre by default).

Not the best of circumstances, I know, but it works (plus if you really wanted to, they give the derivation details in the release notes so you could just spin up a Guix VM which runs fine with the default image and generate the image yourself).

Re:The guide to software development with Guix by pxc on Thursday June 08, 2023 @02:01PM (#36246006)
> I myself am torn between these two.

As a regular Nix user and occasional Guix dabbler, I think you really can't go wrong either way. I feel that Guix often gets short shrift here on HN, but at the end of the day it's a really thoughtfully designed project with a capable community and great documentation.

Re:The guide to software development with Guix by t0astbread on Thursday June 08, 2023 @02:06PM (#36246094)
For the record, Nix doesn't let you install unfree packages by default either. You have to flip a flag to allow it and you can also supply a predicate to conditionally approve unfree packages (https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree).
Re:The guide to software development with Guix by grumbel on Thursday June 08, 2023 @10:43AM (#36242682)
Opposite for me. Nix syntax is much more pleasant to use and while Nix error messages are by no means perfect, still more fun than digging through multiple layers of Scheme.

Does Guix have anything similar to Nix flakes yet?

Re:The guide to software development with Guix by civodul on Thursday June 08, 2023 @10:49AM (#36242788)
I believe the use of Guix channels shown in the article is comparable to Flakes.
Re:The guide to software development with Guix by grumbel on Thursday June 08, 2023 @11:00AM (#36242992)
From what I understand, channels can be used to extend Guix, but don't quite work like Flakes, more like the old Nix channels. The thing that makes Flakes special is that they allow you to treat Git repositories like software packages. No more need for a distribution to package the software, you can just drop a 'flake.nix' file into the Git repository and that makes it behave like a package that users can install and other Flakes can depend on. I am really fond of the ability to just run software straight from Git, e.g.:

   nix run github:ggerganov/llama.cpp
Makes it really easy to switch versions, fork, patch or otherwise customize things.
Re:The guide to software development with Guix by rekado on Thursday June 08, 2023 @11:15AM (#36243282)
The blog post in this submission makes the same point: a git repo can be a channel, you just need to add a file for it.
Re:The guide to software development with Guix by rowanG077 on Thursday June 08, 2023 @11:41AM (#36243761)
I personally prefer Nix greatly. I just find Guile expressions totally unreadable.
Re:The guide to software development with Guix by gglitch on Thursday June 08, 2023 @12:28PM (#36244573)
Genuine question, not trying to create or sustain a debate: are there more brackets in scheme than in json? I don't use json much, but the example I find in the "Syntax" section of the Wikipedia article on json [0], looks almost identical to how I'd structure the same data in Scheme, though with more quotation marks [1]. Is this just a bad example?

[0] - https://en.wikipedia.org/wiki/JSON#Syntax

[1] - Edit: more quotation marks, commas, and colons

Re:The guide to software development with Guix by grumbel on Thursday June 08, 2023 @02:59PM (#36246881)
The difference is that name/value pairs have a dedicated syntax in JSON and Nix, in Scheme everything is (), doesn't matter if it's a function call, list, assignment, macro or whatever. Makes it very hard to understand what is going on at first glance. Worse yet, the normal Scheme syntax is so ugly that people constantly write macros to hide it. Take this package definition in Guix:

  (package
    ...
    (build-system gnu-build-system)
    (arguments '(#:configure-flags '("--enable-silent-rules")))
    (inputs (list gawk))
Looks like a list with name/value pairs, but it's not, that's just the (package)-macro making that thing behave that way. And it's all quite arbitrary, '#:configure-flags' there is a name/value list too, but constructed completely differently. And the next line with (inputs) constructs a list with (list) instead of with a ' quote, as otherwise the list would contain the symbol 'gawk' instead of the value.

Scheme is basically: "Here is the a bunch of Lego, go build yourself a programming language". Other language have syntax that forces at least a minimum of consistency.

Re:The guide to software development with Guix by rowanG077 on Thursday June 08, 2023 @03:48PM (#36247713)
It's about specialization. In JSON brackets have dedicated meaning. In scheme it's () galore. And () doesn't give me any meaning of what's actually there. Not that JSON or the Nix language is perfect, or even good, but this point makes it a lot better then a Lisp for me.

Essentially quickly scanning over lisp code doesn't give me any inclination about the structure at all, which I think is very important. I admit I haven't written a ton of lisp so maybe that's the problem.

Re:The guide to software development with Guix by gglitch on Thursday June 08, 2023 @04:30PM (#36248483)
I read you. I think Guile's native syntax for keywords, though more explicit, probably makes it worse. I imagine this would be clearer for a non-Lisper? Valid CL, but not Guile without a configuration change.

  '(:firstName "John"
    :lastName "Smith"
    :isAlive t
    :age 27
    :address (:streetAdddress "21 2nd Street"
              :city "New York"
              :state "NY"
              :postalCode "10021-3100")
    :phoneNumbers ((:type "home"
                    :number "212 555-1234")
                   (:type "office"
                    :number "646 555 4597"))
    :children ("Catherine"
               "Thomas"
               "Trevor")
    :spouse nil)
...or, indented more like Wiki's JSON example:

  '(
    :firstName "John"
    :lastName "Smith"
    :isAlive t
    :age 27
    :address (
      :streetAdddress "21 2nd Street"
      :city "New York"
      :state "NY"
      :postalCode "10021-3100"
    )
    :phoneNumbers (
      (
       :type "home"
       :number "212 555-1234"
      )
      (
       :type "office"
       :number "646 555 4597"
      )
    )  
    :children (
      "Catherine"
      "Thomas"
      "Trevor"
    )
    :spouse nil
   )
Re:The guide to software development with Guix by grumbel on Friday June 09, 2023 @05:25AM (#36255358)
The core issue that you can't escape is that Scheme creates a lot of ambiguity between data and code, since both use the same syntax. There is nothing wrong with using plain s-expressions for data, quite the opposite, I find them quite nice to look at, no need for keyboards here:

    (person
     (firstName "John")
     (lastName "Smith")
     (isAlive t)
     (age 27)
     (address
      (streetAdddress "21 2nd Street")
      (city "New York")
      (state "NY")
      (postalCode "10021-3100")
      )
    )
But that's not something you can put in a Scheme file directly, you have to quote it and then you have to use quasiquotes, macros or other hacks to get parts of that data structure executable. It's also not even the proper way to do a name/value pairs in Scheme, which would be the alist of the form ((name . value) ...).

In Nix you do not have any of those ambiguities {} is a set, [] is a list, 5+5 is an expression, a = 5; is an assignment. And you can freely mix them without all that quoting, so it's { a = 5 + 5; }, not `((a . ,(+ 5 5))).