MCPcopy Index your code
hub / github.com/JRMurr/tix

github.com/JRMurr/tix @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
2,811 symbols 11,025 edges 116 files 878 documented · 31%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Tix

Docs

A type checker for Nix, built on MLsub/SimpleSub — Hindley-Milner extended with subtyping, union types, and intersection types.

The goal is to have inference do as much of the work as possible but when it gets really nasty allow manually specified types through doc comments.

TLDR: try to be typescript for nix

Its currently still in progress so you might see weird type errors but has been decently usable on real projects

Quick Start

Installation

nix run (try without installing)

nix run github:JRMurr/tix -- inspect my-file.nix

Flake (NixOS / Home Manager / nix profile)

Add tix to your flake inputs:

{
  inputs.tix.url = "github:JRMurr/tix";
}

Then add the package to your config, e.g. in NixOS:

# configuration.nix
{ inputs, pkgs, ... }:
{
  environment.systemPackages = [
    inputs.tix.packages.${pkgs.system}.default
  ];
}

Or install imperatively with nix profile:

nix profile install github:JRMurr/tix

Without flakes (traditional NixOS / nix-env)

Add to a traditional NixOS configuration via fetchTarball:

# configuration.nix
let
  tix = import (builtins.fetchTarball "https://github.com/JRMurr/tix/archive/main.tar.gz") {};
in
{
  environment.systemPackages = [
    tix.packages.${builtins.currentSystem}.default
  ];
}

Pin to a specific revision for reproducibility:

let
  tix = import (builtins.fetchTarball {
    url = "https://github.com/JRMurr/tix/archive/<rev>.tar.gz";
    sha256 = "<hash>";  # nix-prefetch-url --unpack <url>
  }) {};
in
  tix.packages.${builtins.currentSystem}.default

Or install imperatively with nix-env:

nix-env -f https://github.com/JRMurr/tix/archive/main.tar.gz -iA packages.x86_64-linux.default

Type-check a file

tix inspect my-file.nix

Use the LSP

tix lsp

Works with any editor that supports LSP. Provides hover types, completions, go-to-definition, rename, inlay hints, and more.

CLI flags

tix inspect <file.nix> [--stubs path/to/stubs/] [--no-default-stubs] [--config tix.toml]
tix stubs generate nixos [--flake .] [--hostname myhost] [-o nixos.tix]
tix stubs generate home-manager [--flake .] [--username jr] [-o hm.tix]

What does it do?

Given a Nix file like:

let
  add = a: b: a + b;
  result = add 1 2;
  greeting = if result > 0 then "positive" else null;
in
{ inherit add result greeting; }

Tix infers:

add     :: int -> int -> int
result  :: int
greeting :: string | null

Union types fall out naturally — if-then-else with different branch types, heterogeneous lists, etc. all just work.

Documentation

Full docs (type system, stubs, configuration, internals): jrmurr.github.io/tix

To build locally:

cd docs && mdbook serve

Links

Extension points exported contracts — how you extend this code

SyntaxProvider (Interface)
Provides syntax-phase data for a file. The coordinator calls this to get the prerequisites for inference. Implementation [4 …
crates/lang_check/src/coordinator.rs
RefType (Interface)
just to make it easy to share the constraints... [1 implementers]
crates/lang_ty/src/lib.rs

Core symbols most depended-on inside this repo

iter
called by 471
crates/lang_ast/src/nameres.rs
collect
called by 350
crates/lang_ty/src/arbitrary.rs
push
called by 288
crates/lang_ty/src/arena.rs
intern
called by 199
crates/lang_ty/src/arena.rs
get
called by 189
crates/lang_check/src/aliases.rs
get
called by 165
crates/lang_ty/src/arena.rs
parse_tix_file
called by 125
crates/comment_parser/src/lib.rs
len
called by 120
crates/lang_check/src/storage.rs

Shape

Function 2,048
Method 526
Class 164
Enum 71
Interface 2

Languages

Rust99%
Python1%

Modules by API surface

crates/lang_check/src/tests.rs381 symbols
crates/cli/src/gen_stubs.rs145 symbols
crates/lang_check/src/collect.rs122 symbols
crates/lsp/src/completion.rs115 symbols
crates/lang_check/src/aliases.rs82 symbols
crates/lang_check/src/lib.rs72 symbols
crates/lang_ty/src/arena.rs70 symbols
crates/comment_parser/src/tix_collect.rs69 symbols
crates/comment_parser/src/lib.rs63 symbols
crates/lang_ast/src/narrow.rs58 symbols
crates/cli/src/init.rs53 symbols
crates/lang_check/src/coordinator.rs52 symbols

For agents

$ claude mcp add tix \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact