internal

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeToAwkball

func EncodeToAwkball(entrypoint string, modules []*NixOSModule) string

Encode encodes the NixOS modules in awkball format, with each file separated by a `#### path` marker. An awkball can be decoded to files using an awk one-liner.

#### configuration.nix
content
#### modules/a.nix
content

The first module is considered the entrypoint and assigned the given entrypoint filename. Others are organized under modules. Imports are modified to match.

func NewOSFS

func NewOSFS() fs.FS

func NewOverlayFS

func NewOverlayFS(overlay map[string]string) fs.FS

Types

type NixOSModule

type NixOSModule struct {
	Path    string
	Content string
	Imports []*NixOSModuleImport
}

NixOSModule represents info from a NixOS module.

func CollectModules

func CollectModules(filesystem fs.FS, path string) ([]*NixOSModule, error)

CollectModules parses NixOS module import blocks recursively.

func ParseContent

func ParseContent(content string) (*NixOSModule, error)

ParseContent parses NixOS Module imports.

func (*NixOSModule) RewriteImports

func (m *NixOSModule) RewriteImports(prefix string) string

Rewrite imports returns the NixOS module content with imports rewritten for a remote system.

type NixOSModuleImport

type NixOSModuleImport struct {
	// contains filtered or unexported fields
}

type StringFile

type StringFile struct {
	// contains filtered or unexported fields
}

func NewStringFile

func NewStringFile(content string) *StringFile

func (*StringFile) Close

func (f *StringFile) Close() error

Close implements the fs.File interface

func (*StringFile) Read

func (f *StringFile) Read(p []byte) (int, error)

Read implements the io.Reader interface

func (*StringFile) Stat

func (f *StringFile) Stat() (fs.FileInfo, error)

Stat implements the fs.File interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL