feat: project structure and nix build setup
- Add CLI entry point with urfave/cli/v2 (serve, index, list, search commands) - Add database interface and implementations for PostgreSQL and SQLite - Add schema versioning with automatic recreation on version mismatch - Add MCP protocol types and server scaffold - Add NixOS option types - Configure flake.nix with devShell and buildGoModule package Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
45
internal/nixos/types.go
Normal file
45
internal/nixos/types.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// Package nixos contains types and logic specific to NixOS options.
|
||||
package nixos
|
||||
|
||||
// RawOption represents an option as parsed from options.json.
|
||||
// The structure matches the output of `nix-build '<nixpkgs/nixos/release.nix>' -A options`.
|
||||
type RawOption struct {
|
||||
Declarations []string `json:"declarations"`
|
||||
Default *OptionValue `json:"default,omitempty"`
|
||||
Description string `json:"description"`
|
||||
Example *OptionValue `json:"example,omitempty"`
|
||||
ReadOnly bool `json:"readOnly"`
|
||||
Type string `json:"type"`
|
||||
Loc []string `json:"loc,omitempty"`
|
||||
}
|
||||
|
||||
// OptionValue wraps a value that may be a literal or a Nix expression.
|
||||
type OptionValue struct {
|
||||
// Text is the raw JSON representation of the value
|
||||
Text string
|
||||
}
|
||||
|
||||
// OptionsFile represents the top-level structure of options.json.
|
||||
// It's a map from option name to option definition.
|
||||
type OptionsFile map[string]RawOption
|
||||
|
||||
// AllowedExtensions is the default set of file extensions to index.
|
||||
var AllowedExtensions = map[string]bool{
|
||||
".nix": true,
|
||||
".json": true,
|
||||
".md": true,
|
||||
".txt": true,
|
||||
".toml": true,
|
||||
".yaml": true,
|
||||
".yml": true,
|
||||
}
|
||||
|
||||
// ChannelAliases maps friendly channel names to their git branch/ref patterns.
|
||||
var ChannelAliases = map[string]string{
|
||||
"nixos-unstable": "nixos-unstable",
|
||||
"nixos-stable": "nixos-24.11", // Update this as new stable releases come out
|
||||
"nixos-24.11": "nixos-24.11",
|
||||
"nixos-24.05": "nixos-24.05",
|
||||
"nixos-23.11": "nixos-23.11",
|
||||
"nixos-23.05": "nixos-23.05",
|
||||
}
|
||||
Reference in New Issue
Block a user