flake-explorer docs

@kriswill/flake-explorer


@kriswill/flake-explorer

Interfaces

ConfigData

Defined in: schema.ts:181

Properties

fileIndex

fileIndex: Record<string, FileOptionRefs>

Defined in: schema.ts:191

storePath (or "") -> indices into options, split by role. Precomputed so the SPA never scans thousands of options per click: defines = files that set a value, declares = files declaring the option.

id

id: string

Defined in: schema.ts:184

options

options: OptionEntry[]

Defined in: schema.ts:185

version

version: 1

Defined in: schema.ts:183

SCHEMA_VERSION at extraction time — the SPA rejects mismatched blobs.


ConfigRef

Defined in: schema.ts:164

Properties

dataFile

dataFile: string

Defined in: schema.ts:170

Data file relative to the data dir, e.g. "config/nixos.nebula.json".

durationMs?

optional durationMs?: number

Defined in: schema.ts:175

error?

optional error?: string

Defined in: schema.ts:172

extractedAt?

optional extractedAt?: string

Defined in: schema.ts:173

id

id: string

Defined in: schema.ts:166

"nixos/nebula", "darwin/k".

kind

kind: ConfigKind

Defined in: schema.ts:167

name

name: string

Defined in: schema.ts:168

optionCount?

optional optionCount?: number

Defined in: schema.ts:174

status

status: "pending" | "ok" | "error"

Defined in: schema.ts:171


DeclarationRef

Defined in: schema.ts:232

Properties

file

file: string

Defined in: schema.ts:233


DefinitionRef

Defined in: schema.ts:236

Properties

file

file: string

Defined in: schema.ts:237

value?

optional value?: unknown

Defined in: schema.ts:238

valueError?

optional valueError?: true

Defined in: schema.ts:239


FileEntry

Defined in: schema.ts:128

Properties

git?

optional git?: object

Defined in: schema.ts:137

Last commit touching this file; self files with a local checkout only.

commit

commit: string

date

date: string

subject

subject: string

id

id: string

Defined in: schema.ts:130

Stable id — see makeFileId/parseFileId above.

origin

origin: FileOrigin

Defined in: schema.ts:133

relPath

relPath: string

Defined in: schema.ts:132

Path relative to its origin root.

storePath

storePath: string

Defined in: schema.ts:135

Absolute /nix/store/... path — JOIN KEY to option file references.


FileOptionRefs

Defined in: schema.ts:194

Properties

declares

declares: number[]

Defined in: schema.ts:196

defines

defines: number[]

Defined in: schema.ts:195


FileSource

Defined in: schema.ts:143

Properties

text

text: string

Defined in: schema.ts:144

tokens

tokens: TokenRun[]

Defined in: schema.ts:146

Flat, non-overlapping tree-sitter highlight spans over text; [] if tokenizing failed.


FlakeInfo

Defined in: schema.ts:49

Properties

description?

optional description?: string

Defined in: schema.ts:54

narHash?

optional narHash?: string

Defined in: schema.ts:56

path

path: string

Defined in: schema.ts:53

self.outPath — the flake's own store path.

ref

ref: string

Defined in: schema.ts:51

Flake reference as given on the CLI.

rev?

optional rev?: string

Defined in: schema.ts:55


GraftInfo

Defined in: schema.ts:38

A top-level output detected as a graft onto an input's same-named namespace: ≥90% of the input's attr names reappear in the output. The UI shows only added and hides the inherited bulk.

Properties

added

added: string[]

Defined in: schema.ts:44

Keys the flake adds on top of the input's namespace.

inherited

inherited: number

Defined in: schema.ts:46

Count of keys inherited (by name) from the input.

input

input: string

Defined in: schema.ts:42

Direct input whose namespace it extends, e.g. "nixpkgs".

output

output: string

Defined in: schema.ts:40

Top-level output name, e.g. "lib".


ImportEdge

Defined in: schema.ts:157

Directed edge: from imports to (both FileEntry.id).

Properties

from

from: string

Defined in: schema.ts:158

to

to: string

Defined in: schema.ts:159


InputInfo

Defined in: schema.ts:67

Properties

follows?

optional follows?: string

Defined in: schema.ts:89

Present when this input follows another (value = followed node key).

lastModified?

optional lastModified?: number

Defined in: schema.ts:85

name

name: string

Defined in: schema.ts:72

Display name: the input attr for direct inputs, "parent/child" for transitive ones (deduped — a followed input appears once).

narHash?

optional narHash?: string

Defined in: schema.ts:84

nodeKey

nodeKey: string

Defined in: schema.ts:77

flake.lock node key (differs from name for deduped/followed nodes). Not rendered directly, but it is the join target follows points at.

ref?

optional ref?: string

Defined in: schema.ts:82

rev?

optional rev?: string

Defined in: schema.ts:83

storePath?

optional storePath?: string

Defined in: schema.ts:87

toString inputs..outPath — prefix-match key for file attribution.

transitive?

optional transitive?: true

Defined in: schema.ts:79

Present on inputs-of-inputs; the UI legend shows direct inputs only.

type

type: string

Defined in: schema.ts:80

url?

optional url?: string

Defined in: schema.ts:81


Manifest

Defined in: schema.ts:12

Properties

configurations

configurations: ConfigRef[]

Defined in: schema.ts:24

extractor

extractor: string

Defined in: schema.ts:15

files

files: FileEntry[]

Defined in: schema.ts:21

flake

flake: FlakeInfo

Defined in: schema.ts:16

generatedAt

generatedAt: string

Defined in: schema.ts:14

grafts

grafts: GraftInfo[]

Defined in: schema.ts:26

Outputs that extend an input's same-named namespace (lib = nixpkgs.lib.extend …).

importEdges

importEdges: ImportEdge[]

Defined in: schema.ts:23

file→file static import graph (self files only).

inputs

inputs: Record<string, InputInfo>

Defined in: schema.ts:20

Root-level inputs, keyed by input name.

outputNames

outputNames: Record<string, string[]>

Defined in: schema.ts:28

Top-level attr names per output — fills in where nix flake show says "unknown".

outputs

outputs: OutputNode

Defined in: schema.ts:18

Output tree from nix flake show --json, normalized.

version

version: 1

Defined in: schema.ts:13

warnings

warnings: string[]

Defined in: schema.ts:30

Non-fatal extraction problems, surfaced in the UI.


OptionEntry

Defined in: schema.ts:208

Properties

customized

customized: boolean

Defined in: schema.ts:219

isDefined && highestPrio < 1500 — a real definition beat the default.

declarations

declarations: DeclarationRef[]

Defined in: schema.ts:227

Declaring files.

default?

optional default?: unknown

Defined in: schema.ts:224

defaultText?

optional defaultText?: string

Defined in: schema.ts:225

definitions

definitions: DefinitionRef[]

Defined in: schema.ts:229

One entry per definition (options..definitionsWithLocations).

description?

optional description?: string

Defined in: schema.ts:213

highestPrio?

optional highestPrio?: number

Defined in: schema.ts:217

Winning definition priority; absent when !isDefined.

isDefined

isDefined: boolean

Defined in: schema.ts:215

loc

loc: string[]

Defined in: schema.ts:210

Option path, e.g. ["services", "nginx", "enable"].

readOnly

readOnly: boolean

Defined in: schema.ts:214

type?

optional type?: string

Defined in: schema.ts:212

type.description, e.g. "boolean" or "string matching ...".

value?

optional value?: unknown

Defined in: schema.ts:221

Merged value (scrubbed); absent for package-typed or throwing values.

valueError?

optional valueError?: true

Defined in: schema.ts:223

True when evaluating/serializing the value threw.


TokenRun

Defined in: schema.ts:149

Properties

end

end: number

Defined in: schema.ts:151

name

name: string

Defined in: schema.ts:153

Highlight-query capture name, e.g. "keyword", "string", "string.special.path".

start

start: number

Defined in: schema.ts:150

Type Aliases

ConfigKind

ConfigKind = "nixos" | "darwin"

Defined in: schema.ts:162


FileOrigin

FileOrigin = { kind: "self"; } | { input: string; kind: "input"; patched?: true; } | { group?: string; kind: "unknown"; }

Defined in: schema.ts:92

Union Members

Type Literal

{ kind: "self"; }


Type Literal

{ input: string; kind: "input"; patched?: true; }

patched: the file lives in a patched COPY of the input's source tree.


Type Literal

{ group?: string; kind: "unknown"; }

group: display bucket for unattributed store roots ("source@abc1234").


OutputNode

OutputNode = { children: Record<string, OutputNode>; kind: "attrset"; } | { description?: string; kind: "leaf"; name?: string; type: string; } | { kind: "omitted"; } | { kind: "unknown"; }

Defined in: schema.ts:59

Union Members

Type Literal

{ children: Record<string, OutputNode>; kind: "attrset"; }


Type Literal

{ description?: string; kind: "leaf"; name?: string; type: string; }


Type Literal

{ kind: "omitted"; }

nix flake show omitted this (other-system or eval failure).


Type Literal

{ kind: "unknown"; }

nix flake show could not classify it ({"unknown": true}).


ParsedFileId

ParsedFileId = { kind: "self"; relPath: string; } | { input: string; kind: "input"; relPath: string; }

Defined in: schema.ts:113

Variables

EXTRACTOR_VERSION

const EXTRACTOR_VERSION: "0.2.0" = "0.2.0"

Defined in: schema.ts:10

Extractor version — part of the cache key; bump on schema/extractor changes.


PRIO

const PRIO: object

Defined in: schema.ts:200

Well-known mk-priority values (lib.mkOverride n).

Type Declaration

mkDefault

readonly mkDefault: 1000 = 1000

mkForce

readonly mkForce: 50 = 50

optionDefault

readonly optionDefault: 1500 = 1500

The option's own declared default (lib.mkOptionDefault).

plain

readonly plain: 100 = 100


SCHEMA_VERSION

const SCHEMA_VERSION: 1 = 1

Defined in: schema.ts:7


UNKNOWN_FILE

const UNKNOWN_FILE: "<unknown-file>" = "<unknown-file>"

Defined in: schema.ts:243

Sentinel file string the module system uses for inline/anonymous modules.

Functions

displayLabel()

displayLabel(id): string

Defined in: schema.ts:124

Display label for a file id: its relPath; opaque (unknown-bucket) ids as-is.

Parameters

id

string

Returns

string


makeFileId()

makeFileId(origin, relPath): string

Defined in: schema.ts:106

FileEntry.id codec. The format ("self:" | "input::") is a client-server protocol — serve's /data/file/ route re-derives input files from the id — so every construction and parse site goes through these helpers. (resolveFile's "unknown:…"/"inline" buckets are app-internal and opaque: parseFileId returns null for them.)

Parameters

origin

{ kind: "self"; } | { input: string; kind: "input"; }

relPath

string

Returns

string


parseFileId()

parseFileId(id): ParsedFileId | null

Defined in: schema.ts:117

Parameters

id

string

Returns

ParsedFileId | null