install

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package install writes service-manager unit files (systemd, launchd) for pyry. Used by the `pyry install-service` subcommand.

The package never enables, starts, or otherwise activates the unit — it only writes the file and returns the path. The user runs the platform's own enable/start commands afterward, with the next-step instructions printed by the caller.

Index

Constants

This section is empty.

Variables

View Source
var ErrFileExists = errors.New("unit file already exists; pass --force to overwrite")

ErrFileExists is returned when the unit file already exists and Force is false.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Platform picks the service manager. PlatformAuto detects from GOOS.
	Platform Platform

	// Name is the instance name. Defaults to "pyry". Used in the unit's
	// filename, label, and (when non-default) baked into ExecStart as
	// -pyry-name <name> so the supervisor binds to ~/.pyry/<name>.sock.
	Name string

	// WorkDir is what gets baked into WorkingDirectory. Defaults to
	// "%h/pyry-workspace" for systemd (resolved by systemd at runtime) and
	// "$HOME/pyry-workspace" expanded for launchd.
	WorkDir string

	// Binary is the absolute path to the pyry binary. Defaults to
	// os.Executable() — the binary currently running.
	Binary string

	// PathEnv is the PATH environment variable baked into the unit. Defaults
	// to a conservative set of system + user-local bins.
	PathEnv string

	// ClaudeArgs, if non-empty, are baked into ExecStart after the pyry
	// flags. If empty, the unit is written with commented suggestions and
	// the user is expected to edit it before starting the service.
	ClaudeArgs []string

	// Force allows overwriting an existing file. Without it, [Install]
	// returns [ErrFileExists] if the destination is already a file.
	Force bool

	// HomeDir is the user's home directory. Defaults to os.UserHomeDir().
	// Exposed for testing.
	HomeDir string
}

Options for Install.

type Platform

type Platform int

Platform identifies which service manager the unit is for.

const (
	PlatformAuto Platform = iota
	PlatformSystemd
	PlatformLaunchd
)

func Install

func Install(opt Options) (path string, plat Platform, err error)

Install writes the unit file and returns the absolute path it was written to plus the resolved Platform. If the destination already exists and Options.Force is false, returns ErrFileExists without touching it.

func (Platform) Detect

func (p Platform) Detect() Platform

Detect resolves PlatformAuto to the right platform for the running OS. PlatformSystemd and PlatformLaunchd are returned unchanged.

func (Platform) String

func (p Platform) String() string

Jump to

Keyboard shortcuts

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