Documentation
¶
Index ¶
- Variables
- func InitNixyFile(parent context.Context, dest string) error
- func ProfileCreate(ctx context.Context, name string) error
- func ProfileEdit(ctx context.Context, name string) error
- func ProfileList(ctx context.Context) ([]string, error)
- func XDGDataDir() string
- type Build
- type Context
- type ExecutorArgs
- type ExecutorMountPath
- type InShellNixy
- type Mode
- type NixPackage
- type NixPkgsMap
- type Nixy
- type NixyMount
- type NixyWrapper
- type NormalizedPackage
- type Profile
- type RuntimePaths
- type URLAndSHA
- type URLPackage
- type WorkspaceFlakeGenParams
Constants ¶
This section is empty.
Variables ¶
var ( ProfileSandboxMountPath = "/profile" WorkspaceDirSandboxMountPath = "/workspace" WorkspaceFlakeSandboxMountPath = "/workspace-flake" )
Functions ¶
func ProfileCreate ¶
ProfileCreate creates a new profile with the given name
func ProfileEdit ¶
ProfileEdit opens the profile's nixy.yml in the user's editor
func ProfileList ¶
ProfileList returns all available profiles
func XDGDataDir ¶
func XDGDataDir() string
Types ¶
type Build ¶
type Build struct {
Packages []*NormalizedPackage `yaml:"packages"`
Paths []string `yaml:"paths"`
}
type Context ¶
type Context struct {
context.Context
NixyProfile string
NixyMode Mode
NixyUseProfile bool
NixyBinPath string
InNixyShell bool
PWD string
// Nixy Constants
NixyDataDir string
}
func (*Context) IsLocalMode ¶
type ExecutorArgs ¶
type ExecutorArgs struct {
NixBinaryMountedPath string
ProfileDirMountedPath string
FakeHomeMountedPath string
NixDirMountedPath string
WorkspaceFlakeDirHostPath string
WorkspaceFlakeDirMountedPath string
EnvVars executorEnvVars
}
func UseBubbleWrap ¶
func UseBubbleWrap(ctx *Context, runtimePaths *RuntimePaths) (*ExecutorArgs, error)
func UseDocker ¶
func UseDocker(ctx *Context, runtimePaths *RuntimePaths) (*ExecutorArgs, error)
func UseLocal ¶
func UseLocal(ctx *Context, runtimePaths *RuntimePaths) (*ExecutorArgs, error)
type ExecutorMountPath ¶
type InShellNixy ¶
func LoadInNixyShell ¶
func LoadInNixyShell(parent context.Context) (*InShellNixy, error)
type NixPackage ¶
type NixPkgsMap ¶ added in v1.4.0
func (NixPkgsMap) DefaultCommit ¶ added in v1.4.0
func (m NixPkgsMap) DefaultCommit() string
func (NixPkgsMap) List ¶ added in v1.4.0
func (m NixPkgsMap) List() []string
type Nixy ¶
type Nixy struct {
NixPkgs NixPkgsMap `yaml:"nixpkgs"`
Packages []*NormalizedPackage `yaml:"packages"`
Libraries []string `yaml:"libraries,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
OnShellEnter string `yaml:"onShellEnter,omitempty"`
// OnShellExit is not used as of now, will try to use it in future
OnShellExit string `yaml:"onShellExit,omitempty"`
Builds map[string]Build `yaml:"builds,omitempty"`
// Mount is applicable only on bubblewrap and docker modes
Mounts []NixyMount `yaml:"mounts,omitempty"`
// contains filtered or unexported fields
}
func (*Nixy) SyncToDisk ¶
SyncToDisk writes the nixy config to disk. When rawNode is set, it preserves the original YAML structure (comments, ordering). When rawNode is nil, it encodes the struct with deduplication (for new files).
type NixyWrapper ¶ added in v1.5.0
type NixyWrapper struct {
Context *Context
sync.Mutex `yaml:"-"`
Logger *slog.Logger `yaml:"-"`
PWD string
*Nixy
// contains filtered or unexported fields
}
func LoadFromFile ¶
func LoadFromFile(parent context.Context, f string) (*NixyWrapper, error)
func (*NixyWrapper) Build ¶ added in v1.5.0
func (nixy *NixyWrapper) Build(ctx *Context, target string) error
func (*NixyWrapper) PrepareShellCommand ¶ added in v1.5.0
type NormalizedPackage ¶
type NormalizedPackage struct {
*NixPackage
*URLPackage
}
func (*NormalizedPackage) MarshalYAML ¶
func (p *NormalizedPackage) MarshalYAML() (any, error)
func (*NormalizedPackage) UnmarshalYAML ¶
func (p *NormalizedPackage) UnmarshalYAML(value *yaml.Node) error
type Profile ¶
type Profile struct {
Name string
NixPkgsCommitHash string `json:"nixpkgs,omitempty"`
ProfilePath string // ~/.local/share/nixy/profiles/<name>
ProfileNixyYAMLPath string
}
Profile represents a user profile configuration (only used when NIXY_USE_PROFILE=true)
func GetProfile ¶
GetProfile loads an existing profile from disk
func NewProfile ¶
func NewProfile(ctx *Context, name string, runtimePaths *RuntimePaths) (*Profile, error)
NewProfile creates a new profile instance (only used when NIXY_USE_PROFILE=true)
type RuntimePaths ¶ added in v1.5.0
type RuntimePaths struct {
Name string // profile name (used for directory organization)
BasePath string // ~/.local/share/nixy/profiles/<name>
WorkspacesDir string // directory for workspace flakes
FakeHomeDir string // fake home directory for sandboxing
NixDir string // nix store directory
StaticNixBinPath string // path to static nix binary
}
RuntimePaths represents the filesystem paths needed for nixy runtime execution. These paths are always created and used regardless of NIXY_USE_PROFILE setting.
func NewRuntimePaths ¶ added in v1.5.0
func NewRuntimePaths(name string) (*RuntimePaths, error)
NewRuntimePaths creates and initializes the runtime paths for a given profile name. This is always called regardless of NIXY_USE_PROFILE setting.
func (*RuntimePaths) CreateDirs ¶ added in v1.5.0
func (rp *RuntimePaths) CreateDirs() error
CreateDirs creates all necessary directories for the runtime paths
type URLPackage ¶
type WorkspaceFlakeGenParams ¶
type WorkspaceFlakeGenParams struct {
NixPkgs NixPkgsMap
WorkspaceDirPath string
Packages []*NormalizedPackage
Libraries []string
Builds map[string]Build
EnvVars map[string]string
}