go
Skill1 starsChanged 9 months agoMITView on GitHub
Package a Go module for corepkgs. Use when writing or editing a buildGoModule derivation — covers vendorHash, ldflags, subPackages, checkFlags, and versionCheckHook.
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cmakeSkill
- ekala-cmake-nixSkill
- ekapkgs-repoSkill
- mesonSkill
- mk-many-variantsSkill
- nix-buildSkill
- nix-evalSkill
- packagingSkill
- portingSkill
- pythonSkill
- rustSkill
- structured-attrsSkill
- validationSkill
The file
Files
Go Packages
Go packages live in pkgs/<name>/default.nix using buildGoModule.
Minimal Example
{
lib,
buildGoModule,
fetchFromGitHub,
}:
buildGoModule (finalAttrs: {
pname = "example";
version = "1.0.0";
src = fetchFromGitHub {
owner = "example";
repo = "example";
tag = "v${finalAttrs.version}";
hash = "sha256-...";
};
vendorHash = "sha256-...";
meta = {
description = "Example Go tool";
license = lib.licenses.mit;
mainProgram = "example";
};
})Essential Attributes
vendorHash— SRI hash of vendored Go modules. Set tolib.fakeHashto get the correct value from the build error. Usenullwhen the repo vendors dependencies in-tree.ldflags— linker flags, commonly used for version injection:ldflags = [ "-s" "-w" "-X main.Version=v${finalAttrs.version}" ];subPackages— limit which packages get built (defaults to all):subPackages = [ "cmd/mytool" ];checkFlags— flags forgo test. Use-skipto disable specific tests:checkFlags = [ "-skip" "TestNetwork" ];
Auto-Generated Tests
buildGoModule automatically provides passthru.tests.build — a variant that re-runs with doCheck = true. User-supplied passthru.tests entries merge alongside it.
Version Check
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
doInstallCheck = true;Shell Completions
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installShellCompletion --cmd example \
--bash <($out/bin/example completion bash) \
--fish <($out/bin/example completion fish) \
--zsh <($out/bin/example completion zsh)
'';Complete Example
{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
versionCheckHook,
}:
buildGoModule (finalAttrs: {
pname = "age";
version = "1.3.1";
src = fetchFromGitHub {
owner = "FiloSottile";
repo = "age";
tag = "v${finalAttrs.version}";
hash = "sha256-...";
};
vendorHash = "sha256-...";
ldflags = [
"-s" "-w"
"-X main.Version=v${finalAttrs.version}"
];
nativeBuildInputs = [ installShellFiles ];
preInstall = ''
installManPage doc/*.1
'';
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
doInstallCheck = true;
checkFlags = [ "-skip" "TestScript/plugin" ];
meta = {
description = "Modern encryption tool with small explicit keys";
homepage = "https://age-encryption.org/";
license = lib.licenses.bsd3;
mainProgram = "age";
};
})Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

