Language familiarity, first-class IDE experience, and TS's type system.
Garn, a TypeScript-based Nix front end
11–20 of 23 posts
Re: Garn, a TypeScript-based Nix front end
#12Earlier 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?
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
#13Earlier 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…
Perhaps a standalone function (like nixRaw) could work to enable this.
Re: Garn, a TypeScript-based Nix front end
#14Re: Garn, a TypeScript-based Nix front end
#15Re: Garn, a TypeScript-based Nix front end
#16Nix 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
#17Such 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…
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
#18I'm interested to know if this finally will help me to enter nix world, I tried so many times but failed.
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
#19I really like Guix & Nix, but I can see the appeal of this. Language familiarity, first-class IDE experience, and TS's type system.
Re: Garn, a TypeScript-based Nix front end
#20I 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.