The garn devlog

garn is an effort to give a Typescript-based alternative to Nix, and an easier CLI interface. It’s been discussed before, but development is happening very quickly, so I thought I’d create a devlog thread here. If you don’t want to hear more about it, you can mute it, and if you do, you can follow it.

5 Likes

Version 0.0.18 has been released.

Highlights:

export const project = haskell.mkHaskellProject({
  description: "",
  compiler: "ghc94",
  src: ".",
  executables: ["foo"],
  // This is new
  overrideDependencies: {
    "string-conversions": "0.3.0.3",
  },
})

And you get the correponding version from Hackage, rather than the default one from the package set. This is as easy as Stack, but with the power of Nix.

  • garn enter top-level Environments. Previously Environments, unlike everything else, didn’t really work at the top-level, and instead had to be part of a Project.
2 Likes

And a new release, with the ability to easily import local and remote flakes. E.g.:

const flake = garn.importFromGithub({
  repo: "martinvonz/jj",
  revOrRef: "v0.11.0",
});

export const devEnv = garn.emptyEnvironment.withDevTools([
  flake.getPackage("default"),
]);

This should help incrementally moving over if that’s your thing.

Full blog post: garnix | the nix CI

1 Like

Seems interesting. The CLI is written in TS, yes? How do you like TS for CLI work?

It’s actually written in Haskell! The CLI has to be a different program than the garn.ts file users write (since, among other reasons, otherwise syntax errors in the file would leave you with a completely unusable garn; and things like garn init wouldn’t be available). Mostly for reasons of familiarity, we wrote it in Haskell. But it kind of really is just the CLI - all the more substantive logic is in TS.

1 Like