Gradual types for Nix.
Add types where they help, keep the rest dynamic, and ship plain .nix with zero runtime.
curl -fsSL https://tynix.dev/install.sh | shnix profile install github:ubugeeei-prod/tynixtype User = { name :: String; admin :: Bool; };
let
greet :: User -> String;
greet = (user :: User):
if user.admin
then "Welcome back, ${user.name}."
else "Hello, ${user.name}!";
in greet { name = "Ada"; admin = true; }let
greet = user: if user.admin
then "Welcome back, ${user.name}."
else "Hello, ${user.name}!";
in greet {
name = "Ada";
admin = true;
}Amber is type-only syntax: tynix checks it, then erases it. Misspell user.nmae and you get [TC0009] missing field `nmae` before Nix evaluates anything.
Types that fit the Nix you already write
.tynix is Nix plus annotations. Attribute sets, lambdas, with, rec, inherit and imports work exactly as they do in Nix, and the type layer never changes what runs.
Zero runtime
Annotations, aliases, declarations and casts are erased at build time. The output is ordinary Nix with the same layout and semantics.
Structural records
Attribute sets are compared by shape, with width subtyping, literal types, unions and errors that name the field.
Gradual by design
dynamic, unknown and any are three distinct escape hatches. Adopt one file at a time and tighten as you go.
Type existing .nix
Describe modules you will not rewrite with .d.tynix declarations, the way DefinitelyTyped describes JavaScript.
Generics and conditional types
forall, higher-kinded aliases, extends and infer, and Vec / Matrix shapes, checked by a kind-aware engine.
Editor and CI ready
A language server with hover, inlay hints and diagnostics, plus stable diagnostic codes and JSON reports for CI.
How it works
One binary checks your files and compiles them back to Nix. Your flake, your builds and nix eval only ever see .nix.
Write
Annotate a .tynix file, or describe a .nix file you keep with a .d.tynix declaration.
tynix initCheck
Type-check one file or the whole project. Every diagnostic has a stable code and a precise location.
tynix check-projectShip
Erase every type and emit plain .nix next to the declarations other projects can import.
tynix build- VS Code
- Cursor
- VSCodium
- Zed
- Neovim
- Helix
Run tynix ide install to set up the language server in any of them. See Editors for what each one gets.
Ready in fifteen minutes
Install tynix, type your first file, and finish with a checked flake.