Documentation
¶
Index ¶
- Constants
- func CurrentSystem() (currentSystem string, err error)
- func EvalTemplate(nixx *exec.CmdContext, temp string, data any, opts ...EvalOption) (string, error)
- func FlakeInstallable(flakePath string, attrPath string) string
- func GetFlakePackages(rootDir string, flakePath string) (packages map[string]Package, err error)
- func HardeningOptions() []string
- func HaveToolchain(toolchain string) bool
- func InBuild() bool
- func InShell() bool
- func NewCtxBuilder() exec.CmdContextBuilder
- func NewDevShellCtxBuilder(rootDir string, flakePath string, attrPath string) exec.CmdContextBuilder
- func NewDevShellCtxBuilderI(rootDir string, installable string) exec.CmdContextBuilder
- func ReplaceSystem(attrPath string) (string, error)
- func ToolchainInstallable(flakePath string, toolchain string) string
- func WrapOverDevShell(ctxBuilder exec.CmdContextBuilder, rootDir string, flakePath string, ...) exec.CmdContextBuilder
- func WrapOverDevShellI(ctxBuilder exec.CmdContextBuilder, rootDir string, installable string) exec.CmdContextBuilder
- type BuildCtx
- type EvalOption
- type NixEvalCtx
- type NixRunCtx
- type Package
Constants ¶
const QuitshToolchainEnvVar = "QUITSH_TOOLCHAINS"
Variables ¶
This section is empty.
Functions ¶
func CurrentSystem ¶
CurrentSystem reports the current system.
func EvalTemplate ¶
func EvalTemplate( nixx *exec.CmdContext, temp string, data any, opts ...EvalOption) (string, error)
EvalTemplate evaluates a Nix expression and returns the result.
func FlakeInstallable ¶
FlakeInstallable returns the attribute path `<flakePath>#<attrPath>`.
func GetFlakePackages ¶
GetFlakePackages gets all packages from the flake for the current system. This uses `nix eval <flakeOutputAttr>` Note: We cannot use `nix flake show` (sadly) because we use IFD (import from derivation inside `yaml.nix`) which is unfortunate (maybe we can later somehow convert the `.component.yaml`s to JSON) See also: https://github.com/NixOS/nix/issues/4265
func HardeningOptions ¶
func HardeningOptions() []string
HardeningOptions returns the set hardening options.
func HaveToolchain ¶
HaveToolchain tests if we are running inside a Nix shell/Nix build which has the toolchain `toolchain` available. A toolchain is just a set of tools we define. The Nix shells need to have a `QUITSH_TOOLCHAINS = "a,b,c"` set.
func NewCtxBuilder ¶
func NewCtxBuilder() exec.CmdContextBuilder
NewCtxBuilder returns a new Nix command context builder.
func NewDevShellCtxBuilder ¶
func NewDevShellCtxBuilder( rootDir string, flakePath string, attrPath string, ) exec.CmdContextBuilder
NewDevShellCtxBuilder returns a new command context builder which runs all commands over a Nix development shell.
func NewDevShellCtxBuilderI ¶
func NewDevShellCtxBuilderI(rootDir string, installable string) exec.CmdContextBuilder
NewDevShellCtxBuilderI, see `NewDevShellCtxBuilder`.
func ReplaceSystem ¶
ReplaceSystem replaces placeholder "${system}" in string `attrPath` with the current system.
func ToolchainInstallable ¶
ToolchainInstallable returns the `nix develop <toolchainref>` string for the given toolchain.
func WrapOverDevShell ¶
func WrapOverDevShell( ctxBuilder exec.CmdContextBuilder, rootDir string, flakePath string, attrPath string, ) exec.CmdContextBuilder
WrapOverDevShell wraps a command context builder over a dev shell with `NewDevShellCtxBuilder`.
func WrapOverDevShellI ¶
func WrapOverDevShellI( ctxBuilder exec.CmdContextBuilder, rootDir string, installable string, ) exec.CmdContextBuilder
WrapOverDevShellI, see `WrapOverDevShellI`.
Types ¶
type BuildCtx ¶
type BuildCtx struct {
*exec.CmdContext
}
func NewBuildCtx ¶
func NewBuildCtx( rootDir string, applyOpts ...func(b exec.CmdContextBuilder) exec.CmdContextBuilder) BuildCtx
NewBuildCtxBuilder returns a new `nix build` command context for flake builds.
type EvalOption ¶
func WithEvalImpure ¶
func WithEvalImpure() EvalOption
WithEvalImpure uses `impure` evaluation on `Eval`.
func WithEvalOutputJSON ¶
func WithEvalOutputJSON() EvalOption
WithEvalOutputRaw uses JSON output on `Eval`.
func WithEvalOutputRaw ¶
func WithEvalOutputRaw() EvalOption
WithEvalOutputRaw uses `raw` output on `Eval`.
type NixEvalCtx ¶
type NixEvalCtx struct {
*exec.CmdContext
}
func NewEvalCtx ¶
func NewEvalCtx( rootDir string, applyOpts ...func(b exec.CmdContextBuilder) exec.CmdContextBuilder, ) NixEvalCtx
NewEvalCtxBuilder returns a new `nix eval` command context for flake evaluations.
type NixRunCtx ¶
type NixRunCtx struct {
*exec.CmdContext
}
func NewRunCtx ¶
func NewRunCtx( rootDir string, applyOpts ...func(b exec.CmdContextBuilder) exec.CmdContextBuilder, ) NixRunCtx
NewEvalCtxBuilder returns a new `nix run` command context builder.