Live data from Hacker News

Garn, a TypeScript-based Nix front end

garnix.io

11–20 of 23 posts

Re: Garn, a TypeScript-based Nix front end

#12
post #8

Earlier quoted context omitted.

It’s to allow interpolation of packages and environments. But in practice we don’t use it that often, so we were thinking of switching the main function to using just a second string argument. (In other words, I agree.)

That seems reasonable! I can’t really locate any examples of that functionality. Could you show me what that would look like?

One working example is this:

  import * as garn from "https://garn.io/ts/v0.0.14/mod.ts";
  import * as pkgs from "https://garn.io/ts/v0.0.14/nixpkgs.ts";

  export const main: garn.Executable = garn.shell`${pkgs.jq}/bin/jq --version`;
Put that in a 'garn.ts' file and run 'garn run main' and you should see the version of 'jq' that you can get from our 'nixpkgs' module.

But yeah, I completely agree with the sentiment here. This is a rather cumbersome syntax to support a use-case that we don't even have examples for. So clearly the normal usage shouldn't force you to use template strings.

Re: Garn, a TypeScript-based Nix front end

#13

Earlier quoted context omitted.

That seems reasonable! I can’t really locate any examples of that functionality. Could you show me what that would look like?

One working example is this: import * as garn from "https://garn.io/ts/v0.0.14/mod.ts"; import * as pkgs from "https://garn.io/ts/v0.0.14/nixpkgs.ts"; export const main: garn.Executable = garn.shell`${pkgs.jq}/bin/jq --version`; Put that in a 'garn.ts' file and run 'garn run main' and you should see the version of 'jq' that you can get from our 'nixpkgs' module. But yeah, I completely agree with the sentiment here. T…

I can definitely the utility of it.

Perhaps a standalone function (like nixRaw) could work to enable this.

Re: Garn, a TypeScript-based Nix front end

#15
Great to see this. I've been interested in Nix for a long time, but have never been able to really commit to it for many of the reasons called out in the blog article. Garn seems like it could be a major improvement. Looking forward to trying it out.

Re: Garn, a TypeScript-based Nix front end

#16
Such an exciting project.

Nix truly is a game changer, but the UX is not getting better in any meaningful way. I do think it will be a fantastic foundation for an abstraction layer on top.

Note: for anyone else trying Nix but bouncing off of it (especially flakes), Home Manager is where I'd recommend starting.

It lets you declaratively manage all your packages, home files, shell configs etc from inside a single text file, using Nix derivations. Without having to deal with much Nix language or its shell interface

Re: Garn, a TypeScript-based Nix front end

#17

Such an exciting project. Nix truly is a game changer, but the UX is not getting better in any meaningful way. I do think it will be a fantastic foundation for an abstraction layer on top. Note: for anyone else trying Nix but bouncing off of it (especially flakes), Home Manager is where I'd recommend starting. It lets you declaratively manage all your packages, home files, shell configs etc from inside a single text…

Home Manager and nix-darwin was the gateway drug for me. Now I have a flake based setup that manages nix-darwin as well as my NixOS home servers.

Spinning up a new Mac takes minutes, Linux server most time is deciding if there are any unique packages/config just for it. Everything else the same.

Love it.

Re: Garn, a TypeScript-based Nix front end

#18

I'm interested to know if this finally will help me to enter nix world, I tried so many times but failed.

My Nix origin story is like that. Tried nixos a few times, gave up every time.

Each time learning a little bit more.

Then just used nix-darwin as a Homebrew replacement for a while.

Then adopted Home Manager. Spent a day learning the Nix language, finally.

Tried flakes, couldn’t figure it out. Tried again later, cargo culting someone else’s config. Learnt the language again. Rewrote their config from scratch, from first principles, testing inside VMs.

This is where I’m at now. Don’t spend much time on it any more, just periodically add a package or tweak my config.

Works well enough for me now. And I basically never experience “everything broken after Homebrew update” any more.

Re: Garn, a TypeScript-based Nix front end

#20
post #10

I use the syntax of nix (and SML derived languages in general) as a reminder to myself that those who complain about the syntax of Lisp probably just have different taste than me, because there are people out there who prefer the syntax of nix to that of Lisp.

Yes. I couldn’t get comfortable with Guile for Guix, but having touch PureScript, Haskell, OCaml, Nix feels at home (other than the need for dymanic types).
Post reply on HN