At some point during the development process you typically want to build your application so that it can be distributed or run.
Flox aims to be the one tool that you need for the entire software development lifecycle, so let’s see how you can not only develop your software with Flox, but build it with Flox as well.
Let’s start by creating a simple Go project.
We’ll create a directory called myproject and create a Flox environment inside of it so we can install our tools.
$ mkdir myproject$ cd myproject$ flox init⚡︎ Created environment 'myproject' (aarch64-darwin)Next: $ flox search <package> <- Search for a package $ flox install <package> <- Install a package into an environment $ flox activate <- Enter the environment $ flox edit <- Add environment variables and shell hooks
Since we’re using Go, we’ll want to install Go:
$ flox install go✔ 'go' installed to environment 'myproject'$ # let's see what version of Go we have$ flox listgo: go (1.24.1)
Now let’s add some very minimal code so that we have something to build.
For now this will be a very simple “hello world” application.
Start by activating the environment so that we have our Go application available.
$ flox activate✔ You are now using the environment 'myproject'.To stop using this environment, type 'exit'flox [myproject] $ go mod init hellogo: creating new go.mod: module helloflox [myproject] $ touch main.go
Now let’s ensure that we can build the hello program:
flox [myproject] $ go buildflox [myproject] $ # ensure that 'hello' was builtflox [myproject] $ ls -al.rw-r--r-- 24 zmitchell 27 Mar 14:31 go.mod.rwxr-xr-x 2.4M zmitchell 27 Mar 14:32 hello.rw-r--r-- 77 zmitchell 27 Mar 14:32 main.go
We can build the program, so let’s verify that we can run it:
flox [myproject] $ # ensure that 'hello' runsflox [myproject] $ ./helloHello World
Everything appears to be in working order, so now we can discuss what it looks like to build the program with Flox instead of running the build commands ourselves.
In order to define a Flox build, we add an entry to the [build] section of the manifest.
Every name added to the build section creates a new package.
In our case the package will be the compiled Go program, but you can use Flox to build all kinds of things.
See the builds page for more examples of what you can build with Flox.All that’s necessary to define a build is a short script that does two things:
Runs any commands necessary to build the program
Copies the program to a directory called $out
The $out shell variable holds the path to a temporary directory where your build package should be placed (again, “package” in our case means the compiled hello program).
The $out directory adheres to the Filesystem Hierarchy Standard (FHS), which is just the formal name for the convention of placing executable files in /bin, libraries in /lib, etc.
For this hello program we’ll want to place it in $out/bin since hello is an executable program, and that’s where the FHS says to put those types of files.
Flox expects you to put executables there, and if you put them somewhere else you may experience unexpected behavior.Let’s now define our build.
Run flox edit so that you can edit your manifest, and add the following section:
[build.hello]description = "My custom program printing hello world in Go"command = ''' mkdir -p $out/bin go build # produces the ./hello executable file cp hello $out/bin/hello'''
It’s the moment of truth, let’s run flox build to have Flox build our hello program for us:
flox [myproject] $ flox buildRendering hello build script to /var/folders/qn/77rf0syj2s7djp588bzp5vkm0000gn/T//d6f2efa3-hello-build.bashBuilding hello-0.0.0 in local mode00:00:00.004571 + go build00:00:00.205192 + mkdir -p /tmp/store_d6f2efa321a606aebf3b41d0d96ace1d-hello-0.0.0/bin00:00:00.207584 + cp hello /tmp/store_d6f2efa321a606aebf3b41d0d96ace1d-hello-0.0.0/bin/hellothis derivation will be built: /nix/store/g3z03h4p2xa9rf6y78d0xamryggawvha-hello-0.0.0.drvbuilding '/nix/store/g3z03h4p2xa9rf6y78d0xamryggawvha-hello-0.0.0.drv'...hello-0.0.0> patching script interpreter paths in /nix/store/2hc9mjxs6wqcd8cscw9ll650jv1k6wn1-hello-0.0.0/bin/helloCompleted build of hello-0.0.0 in local mode⚡︎ Build completed successfully. Output created: ./result-hello
It worked!
The last line of output tells us that the built output was created in our current directory and called result-hello.
Every build output has the name result-<name> where <name> is the name you used in the [build] section of your manifest (for example [build.hello]).This result-hello file is actually a symbolic link to the final destination of the $out directory.
That means we can’t run result-hello directly, and instead we need to run result-hello/bin/hello.
Let’s do that now:
flox [myproject] $ ./result-hello/bin/helloHello World
It’s possible to define more than one build for your Flox environment.
Why would you want to do that?
In our case we have a Go program, and by default the Go compiler optimizes for fast builds, but not necessarily fast or small executables.
This makes development nice because you get the fastest possible feedback cycle when developing your software, but in production you probably want a more optimized program.
We can define one build for development, and another build for our “production” hello program, both using the same source code and tools!Run flox edit to edit your manifest again, and add this new build:
[build.hello-opt]command = ''' go build -ldflags="-s -w" -gcflags="-l=4" mkdir -p $out/bin cp hello $out/bin/hello'''description = "A program that greets you, very quickly"version = "1.0.0"
This build produces a version of our hello program with some optimizations applied.
Now if you run flox build it will run both the hello and hello-opt builds, or we could specify just the hello-opt build with flox build hello-opt:
flox [myproject] $ flox build hello-optRendering hello-opt build script to /var/folders/qn/77rf0syj2s7djp588bzp5vkm0000gn/T//60dfcc45-hello-opt-build.bashBuilding hello-opt-1.0.0 in local mode00:00:00.004522 + go build '-ldflags=-s -w' -gcflags=-l=400:00:00.155021 + mkdir -p /tmp/store_60dfcc45203ccd97815dbc9aecc6d84d-hello-opt-1.0.0/bin00:00:00.157435 + cp hello /tmp/store_60dfcc45203ccd97815dbc9aecc6d84d-hello-opt-1.0.0/bin/hellothis derivation will be built: /nix/store/k6za2nx7jla6rwzs7lj1qm4rc03v9z7q-hello-opt-1.0.0.drvbuilding '/nix/store/k6za2nx7jla6rwzs7lj1qm4rc03v9z7q-hello-opt-1.0.0.drv'...hello-opt-1.0.0> signing /nix/store/nbykbq9fy0z67hhlf1kvf8wk7wb29x59-hello-opt-1.0.0hello-opt-1.0.0> patching script interpreter paths in /nix/store/nbykbq9fy0z67hhlf1kvf8wk7wb29x59-hello-opt-1.0.0/bin/helloCompleted build of hello-opt-1.0.0 in local mode⚡︎ Build completed successfully. Output created: ./result-hello-opt
This is a Flox for Teams featureThis is a paid feature included with Flox for Teams.
Now that the package is built, we can send it somewhere.
Every user has a private catalog that they can publish packages to.
In order to share packages with other people you must create an organization.
This is a paid feature, and if you would like access to it you should contact Flox directly.
See the organizations page for more details.Now that you’ve built the package you can publish it to your private catalog via the flox publish command.
This command has a few requirements to make sure that the package you’re publishing can be built by other people reproducibly:
The Flox environment must be in a git repository.
All tracked files in the repository must be clean.
The repository must have a remote configured.
The current revision must be pushed to the remote.
The Flox environment must contain at least one package so that the published package can be attached to a point in time in the Base Catalog (where our go package came from).
Let’s say that we’ve done all of that so that we can publish our hello program:
flox [myproject] $ flox publish hello
The flox publish command performs a clean build of the package in a temporary directory to ensure that the build doesn’t depend on anything outside of the git repository.
This is a Flox for Teams featureThis is a paid feature included with Flox for Teams.
Now that you’ve published the package, it will show up in flox search and flox show, and can be installed via flox install.
The package will appear with your username or organization name prefixed to the package name.
Let’s say your username is myuser and the package name is hello, in which case the published package will appear as myuser/hello in flox show, flox search, and flox install.
Let’s see that in action with flox search:
flox [myproject] $ flox search hellomyuser/hello My custom program printing hello world in Gohello Program that produces a familiar, friendly greetinghello-go Simple program printing hello world in Gohello-cpp Basic sanity check that C++ and cmake infrastructure are workingnwg-hello GTK3-based greeter for the greetd daemon, written in pythonhello-unfree Example package with unfree license (for testing)hello-wayland Hello world Wayland clientsbclPackages.hello-clog <no description provided>texlivePackages.othello Modification of a Go package to create othello boardssbclPackages.hello-builder <no description provided>Showing 10 of 23 results. Use `flox search hello --all` to see the full list.Use 'flox show <package>' to see available versions
You can see that our myuser/hello package is the first result.
Now that we know it’s available, let’s install it:
With Flox you have an integrated experience where the same tool you use to develop software is also used to build it, publish it, and eventually consume it.
The story doesn’t end here though.
In this guide we’ve shown you how to build and distribute programs, but you can also use it to distribute configuration files (or any other file).
See the builds concept page for examples of what else you can build and publish with Flox.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Flox","colors":{"primary":"#8D45FF","light":"#B080FF","dark":"#6F2BFF"},"logo":{"light":"https://mintcdn.com/flox/TGd54292LI04fuY9/logo/light.svg?fit=max\u0026auto=format\u0026n=TGd54292LI04fuY9\u0026q=85\u0026s=a68dffe97384d4c4af5850b2c4ab2d6c","dark":"https://mintcdn.com/flox/TGd54292LI04fuY9/logo/dark.svg?fit=max\u0026auto=format\u0026n=TGd54292LI04fuY9\u0026q=85\u0026s=68e026fe8b554722bc75b10ffd73d7aa"},"favicon":"https://mintcdn.com/flox/TGd54292LI04fuY9/favicon.ico?fit=max\u0026auto=format\u0026n=TGd54292LI04fuY9\u0026q=85\u0026s=07df64850f2e53778fafc31eb4a4cfbc","api":{"playground":{"proxy":false}},"appearance":{"default":"light"},"navbar":{"primary":{"type":"button","label":"Go to FloxHub","href":"https://hub.flox.dev"}},"footer":{"socials":{"github":"https://github.com/flox/flox","x":"https://twitter.com/floxdevelopment","linkedin":"https://www.linkedin.com/company/floxdev","youtube":"https://www.youtube.com/@floxdev","slack":"https://go.flox.dev/slack"}},"seo":{"metatags":{"canonical":"https://flox.dev/docs"}},"fonts":{"heading":{"family":"Geist"},"body":{"family":"Geist"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"flox","hasAudioNarration":false,"actualSubdomain":"flox","customDomains":["flox.dev"],"gitSource":{"type":"github","owner":"flox","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"edits":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aeced083e2056ea29579166","clientVersion":"0.0.4087","searchFilterCounts":[{"language":"default","tag":"Documentation","count":70},{"language":"default","tag":"CLI reference","count":37},{"language":"default","tag":"Concepts","count":27},{"language":"default","tag":"Tutorials","count":17},{"language":"default","tag":"Imageless Kubernetes","count":10},{"language":"default","tag":"Languages","count":7},{"language":"default","tag":"Build \u0026 Publish","count":7},{"language":"default","tag":"Packages","count":7},{"language":"default","tag":"Installation","count":5},{"language":"default","tag":"Environments","count":5}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[],"googleFontsInlined":true},"customCss":[],"page":{"pagePath":"tutorials/build-and-publish","slug":"/tutorials/build-and-publish","pageMetadata":{"title":"Build and publish packages","description":"Building and publishing custom packages with Flox","href":"/tutorials/build-and-publish"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Building and publishing custom packages with Flox\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`At some point during the development process you typically want to build your application so that it can be distributed or run.\nFlox aims to be the one tool that you need for the entire software development lifecycle, so let’s see how you can not only `,_jsx(_components.em,{children:`develop`}),` your software with Flox, but `,_jsx(_components.em,{children:`build`}),` it with Flox as well.`]}),`\n`,_jsx(Heading,{level:`2`,id:`prepare-a-project`,children:`Prepare a project`}),`\n`,_jsxs(_components.p,{children:[`Let’s start by creating a simple Go project.\nWe’ll create a directory called `,_jsx(_components.code,{children:`myproject`}),` and create a Flox environment inside of it so we can install our tools.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`$ mkdir myproject`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`$ cd myproject`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`$ flox init`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`⚡︎ Created environment 'myproject' (aarch64-darwin)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Next:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` $ flox search \u003cpackage> \u003c- Search for a package`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` $ flox install \u003cpackage> \u003c- Install a package into an environment`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` $ flox activate \u003c- Enter the environment`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` $ flox edit \u003c- Add environment variables and shell hooks`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Since we’re using Go, we’ll want to install Go:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`$ flox install go`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`✔ 'go' installed to environment 'myproject'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`$ # let's see what version of Go we have`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`$ flox list`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`go: go (1.24.1)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Now let’s add some very minimal code so that we have something to build.\nFor now this will be a very simple “hello world” application.\nStart by activating the environment so that we have our Go application available.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`$ flox activate`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`✔ You are now using the environment 'myproject'.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`To stop using this environment, type 'exit'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ go mod init hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`go: creating new go.mod: module hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ touch main.go`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Now edit `,_jsx(_components.code,{children:`main.go`}),` to have the following contents:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`go`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`go`,children:_jsxs(_components.code,{language:`go`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`package`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` main`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`fmt`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` main`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` fmt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Println`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello World\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Now let’s ensure that we can build the `,_jsx(_components.code,{children:`hello`}),` program:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ go build`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ # ensure that 'hello' was built`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ ls -al`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`.rw-r--r-- 24 zmitchell 27 Mar 14:31 go.mod`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`.rwxr-xr-x 2.4M zmitchell 27 Mar 14:32 hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`.rw-r--r-- 77 zmitchell 27 Mar 14:32 main.go`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`We can build the program, so let’s verify that we can run it:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ # ensure that 'hello' runs`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ ./hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Hello World`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Everything appears to be in working order, so now we can discuss what it looks like to build the program with Flox instead of running the build commands ourselves.`}),`\n`,_jsx(Heading,{level:`2`,id:`define-a-build`,children:`Define a build`}),`\n`,_jsxs(_components.p,{children:[`In order to define a Flox build, we add an entry to the `,_jsx(_components.a,{href:`/man/manifest.toml#build`,children:_jsx(_components.code,{children:`[build]`})}),` section of the manifest.\nEvery name added to the `,_jsx(_components.code,{children:`build`}),` section creates a new package.\nIn our case the package will be the compiled Go program, but you can use Flox to build all kinds of things.\nSee the `,_jsx(_components.a,{href:`/concepts/builds`,children:`builds`}),` page for more examples of what you can build with Flox.`]}),`\n`,_jsx(_components.p,{children:`All that’s necessary to define a build is a short script that does two things:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Runs any commands necessary to build the program`}),`\n`,_jsxs(_components.li,{children:[`Copies the program to a directory called `,_jsx(_components.code,{children:`$out`})]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`$out`}),` shell variable holds the path to a temporary directory where your build package should be placed (again, “package” in our case means the compiled `,_jsx(_components.code,{children:`hello`}),` program).\nThe `,_jsx(_components.code,{children:`$out`}),` directory adheres to the `,_jsx(_components.a,{href:`https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard`,children:`Filesystem Hierarchy Standard (FHS)`}),`, which is just the formal name for the convention of placing executable files in `,_jsx(_components.code,{children:`/bin`}),`, libraries in `,_jsx(_components.code,{children:`/lib`}),`, etc.\nFor this `,_jsx(_components.code,{children:`hello`}),` program we’ll want to place it in `,_jsx(_components.code,{children:`$out/bin`}),` since `,_jsx(_components.code,{children:`hello`}),` is an executable program, and that’s where the FHS says to put those types of files.\nFlox expects you to put executables there, and if you put them somewhere else you may experience unexpected behavior.`]}),`\n`,_jsxs(_components.p,{children:[`Let’s now define our build.\nRun `,_jsx(_components.a,{href:`/man/flox-edit`,children:_jsx(_components.code,{children:`flox edit`})}),` so that you can edit your manifest, and add the following section:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`toml`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`toml`,children:_jsxs(_components.code,{language:`toml`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`build`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`hello`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`description`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"My custom program printing hello world in Go\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`command`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'''`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mkdir -p $out/bin`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` go build # produces the ./hello executable file`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cp hello $out/bin/hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'''`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`perform-a-build`,children:`Perform a build`}),`\n`,_jsxs(_components.p,{children:[`It’s the moment of truth, let’s run `,_jsx(_components.a,{href:`/man/flox-build`,children:_jsx(_components.code,{children:`flox build`})}),` to have Flox build our `,_jsx(_components.code,{children:`hello`}),` program for us:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ flox build`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Rendering hello build script to /var/folders/qn/77rf0syj2s7djp588bzp5vkm0000gn/T//d6f2efa3-hello-build.bash`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Building hello-0.0.0 in local mode`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`00:00:00.004571 + go build`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`00:00:00.205192 + mkdir -p /tmp/store_d6f2efa321a606aebf3b41d0d96ace1d-hello-0.0.0/bin`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`00:00:00.207584 + cp hello /tmp/store_d6f2efa321a606aebf3b41d0d96ace1d-hello-0.0.0/bin/hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`this derivation will be built:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` /nix/store/g3z03h4p2xa9rf6y78d0xamryggawvha-hello-0.0.0.drv`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`building '/nix/store/g3z03h4p2xa9rf6y78d0xamryggawvha-hello-0.0.0.drv'...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`hello-0.0.0> patching script interpreter paths in /nix/store/2hc9mjxs6wqcd8cscw9ll650jv1k6wn1-hello-0.0.0/bin/hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Completed build of hello-0.0.0 in local mode`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`⚡︎ Build completed successfully. Output created: ./result-hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`It worked!\nThe last line of output tells us that the built output was created in our current directory and called `,_jsx(_components.code,{children:`result-hello`}),`.\nEvery build output has the name `,_jsx(_components.code,{children:`result-\u003cname>`}),` where `,_jsx(_components.code,{children:`\u003cname>`}),` is the name you used in the `,_jsx(_components.code,{children:`[build]`}),` section of your manifest (for example `,_jsx(_components.code,{children:`[build.hello]`}),`).`]}),`\n`,_jsxs(_components.p,{children:[`This `,_jsx(_components.code,{children:`result-hello`}),` file is actually a symbolic link to the final destination of the `,_jsx(_components.code,{children:`$out`}),` directory.\nThat means we can’t run `,_jsx(_components.code,{children:`result-hello`}),` directly, and instead we need to run `,_jsx(_components.code,{children:`result-hello/bin/hello`}),`.\nLet’s do that now:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ ./result-hello/bin/hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Hello World`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`define-a-second-build`,children:`Define a second build`}),`\n`,_jsxs(_components.p,{children:[`It’s possible to define more than one build for your Flox environment.\nWhy would you want to do that?\nIn our case we have a Go program, and by default the Go compiler optimizes for fast builds, but not necessarily fast or small executables.\nThis makes development nice because you get the fastest possible feedback cycle when developing your software, but in production you probably want a more optimized program.\nWe can define one build for development, and another build for our “production” `,_jsx(_components.code,{children:`hello`}),` program, both using the same source code and tools!`]}),`\n`,_jsxs(_components.p,{children:[`Run `,_jsx(_components.code,{children:`flox edit`}),` to edit your manifest again, and add this new build:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`toml`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`toml`,children:_jsxs(_components.code,{language:`toml`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`build`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`hello-opt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`command`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'''`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` go build -ldflags=\"-s -w\" -gcflags=\"-l=4\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mkdir -p $out/bin`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cp hello $out/bin/hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'''`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`description`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"A program that greets you, very quickly\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`version`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1.0.0\"`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`This build produces a version of our `,_jsx(_components.code,{children:`hello`}),` program with some optimizations applied.\nNow if you run `,_jsx(_components.code,{children:`flox build`}),` it will run both the `,_jsx(_components.code,{children:`hello`}),` and `,_jsx(_components.code,{children:`hello-opt`}),` builds, or we could specify just the `,_jsx(_components.code,{children:`hello-opt`}),` build with `,_jsx(_components.code,{children:`flox build hello-opt`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ flox build hello-opt`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Rendering hello-opt build script to /var/folders/qn/77rf0syj2s7djp588bzp5vkm0000gn/T//60dfcc45-hello-opt-build.bash`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Building hello-opt-1.0.0 in local mode`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`00:00:00.004522 + go build '-ldflags=-s -w' -gcflags=-l=4`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`00:00:00.155021 + mkdir -p /tmp/store_60dfcc45203ccd97815dbc9aecc6d84d-hello-opt-1.0.0/bin`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`00:00:00.157435 + cp hello /tmp/store_60dfcc45203ccd97815dbc9aecc6d84d-hello-opt-1.0.0/bin/hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`this derivation will be built:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` /nix/store/k6za2nx7jla6rwzs7lj1qm4rc03v9z7q-hello-opt-1.0.0.drv`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`building '/nix/store/k6za2nx7jla6rwzs7lj1qm4rc03v9z7q-hello-opt-1.0.0.drv'...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`hello-opt-1.0.0> signing /nix/store/nbykbq9fy0z67hhlf1kvf8wk7wb29x59-hello-opt-1.0.0`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`hello-opt-1.0.0> patching script interpreter paths in /nix/store/nbykbq9fy0z67hhlf1kvf8wk7wb29x59-hello-opt-1.0.0/bin/hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Completed build of hello-opt-1.0.0 in local mode`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`⚡︎ Build completed successfully. Output created: ./result-hello-opt`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`publish-the-package`,children:`Publish the package`}),`\n`,_jsxs(Tip,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`This is a Flox for Teams feature`})}),_jsx(_components.p,{children:`This is a paid feature included with Flox for Teams.`})]}),`\n`,_jsxs(_components.p,{children:[`Now that the package is built, we can send it somewhere.\nEvery user has a private catalog that they can publish packages to.\nIn order to share packages with other people you must create an organization.\nThis is a paid feature, and if you would like access to it you should contact Flox directly.\nSee the `,_jsx(_components.a,{href:`/concepts/organizations`,children:`organizations`}),` page for more details.`]}),`\n`,_jsxs(_components.p,{children:[`Now that you’ve built the package you can `,_jsx(_components.a,{href:`/concepts/publishing`,children:`publish`}),` it to your private catalog via the `,_jsx(_components.a,{href:`/man/flox-publish`,children:_jsx(_components.code,{children:`flox publish`})}),` command.\nThis command has a few requirements to make sure that the package you’re publishing can be built by other people reproducibly:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`The Flox environment must be in a git repository.`}),`\n`,_jsx(_components.li,{children:`All tracked files in the repository must be clean.`}),`\n`,_jsx(_components.li,{children:`The repository must have a remote configured.`}),`\n`,_jsx(_components.li,{children:`The current revision must be pushed to the remote.`}),`\n`,_jsxs(_components.li,{children:[`The Flox environment must contain at least one package so that the published package can be attached to a point in time in the Base Catalog (where our `,_jsx(_components.code,{children:`go`}),` package came from).`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Let’s say that we’ve done all of that so that we can publish our `,_jsx(_components.code,{children:`hello`}),` program:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ flox publish hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`flox publish`}),` command performs a clean build of the package in a temporary directory to ensure that the build doesn’t depend on anything outside of the git repository.`]}),`\n`,_jsx(Heading,{level:`2`,id:`install-the-package`,children:`Install the package`}),`\n`,_jsxs(Tip,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`This is a Flox for Teams feature`})}),_jsx(_components.p,{children:`This is a paid feature included with Flox for Teams.`})]}),`\n`,_jsxs(_components.p,{children:[`Now that you’ve published the package, it will show up in `,_jsx(_components.a,{href:`/man/flox-search`,children:_jsx(_components.code,{children:`flox search`})}),` and `,_jsx(_components.a,{href:`/man/flox-show`,children:_jsx(_components.code,{children:`flox show`})}),`, and can be installed via `,_jsx(_components.a,{href:`/man/flox-install`,children:_jsx(_components.code,{children:`flox install`})}),`.\nThe package will appear with your username or organization name prefixed to the package name.\nLet’s say your username is `,_jsx(_components.code,{children:`myuser`}),` and the package name is `,_jsx(_components.code,{children:`hello`}),`, in which case the published package will appear as `,_jsx(_components.code,{children:`myuser/hello`}),` in `,_jsx(_components.code,{children:`flox show`}),`, `,_jsx(_components.code,{children:`flox search`}),`, and `,_jsx(_components.code,{children:`flox install`}),`.\nLet’s see that in action with `,_jsx(_components.code,{children:`flox search`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ flox search hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`myuser/hello My custom program printing hello world in Go`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`hello Program that produces a familiar, friendly greeting`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`hello-go Simple program printing hello world in Go`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`hello-cpp Basic sanity check that C++ and cmake infrastructure are working`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`nwg-hello GTK3-based greeter for the greetd daemon, written in python`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`hello-unfree Example package with unfree license (for testing)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`hello-wayland Hello world Wayland client`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`sbclPackages.hello-clog \u003cno description provided>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`texlivePackages.othello Modification of a Go package to create othello boards`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`sbclPackages.hello-builder \u003cno description provided>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:\"Showing 10 of 23 results. Use `flox search hello --all` to see the full list.\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Use 'flox show \u003cpackage>' to see available versions`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`You can see that our `,_jsx(_components.code,{children:`myuser/hello`}),` package is the first result.\nNow that we know it’s available, let’s install it:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`flox [myproject] $ flox install myuser/hello`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`✔ 'myuser/hello' installed to environment 'myproject'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`conclusion`,children:`Conclusion`}),`\n`,_jsxs(_components.p,{children:[`With Flox you have an integrated experience where the same tool you use to develop software is also used to build it, publish it, and eventually consume it.\nThe story doesn’t end here though.\nIn this guide we’ve shown you how to build and distribute programs, but you can also use it to distribute configuration files (or any other file).\nSee the `,_jsx(_components.a,{href:`/concepts/manifest-builds#example-configuration-files`,children:`builds`}),` concept page for examples of what else you can build and publish with Flox.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Build and publish packages","description":"Building and publishing custom packages with Flox","href":"/tutorials/build-and-publish"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Prepare a project","slug":"prepare-a-project","depth":2,"children":[]},{"title":"Define a build","slug":"define-a-build","depth":2,"children":[]},{"title":"Perform a build","slug":"perform-a-build","depth":2,"children":[]},{"title":"Define a second build","slug":"define-a-second-build","depth":2,"children":[]},{"title":"Publish the package","slug":"publish-the-package","depth":2,"children":[]},{"title":"Install the package","slug":"install-the-package","depth":2,"children":[]},{"title":"Conclusion","slug":"conclusion","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/flox/d4dc44fc16caa8e0/amplitude.js","/docs/_mintlify/custom/flox/7a15237175dc5cb4/hubspot.js","/docs/_mintlify/custom/flox/2c0cb21cf2c0757c/plausible.js"],"subdomain":"flox","siteName":"Flox","title":"Build and publish packages - Flox","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-05-13T12:28:10.267Z","originalFileLocation":"tutorials/build-and-publish.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Building and publishing custom packages with Flox\">\u003cmeta data-mint-head name=\"application-name\" content=\"Flox\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Build and publish packages - Flox\">\u003cmeta data-mint-head property=\"og:description\" content=\"Building and publishing custom packages with Flox\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Flox\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://flox.dev/docs/tutorials/build-and-publish\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://flox.mintlify.site/docs/_mintlify/api/og/v2?division=Tutorials\u0026amp;title=Build+and+publish+packages\u0026amp;description=Building+and+publishing+custom+packages+with+Flox\u0026amp;theme=499e841fe95ca0b9c8be2d34\u0026amp;signature=da83b8c68f9e2156fcf5f64db19f6c1234b72a3b489d1278a0c4cf99c26b0ce0\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Build and publish packages - Flox\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Building and publishing custom packages with Flox\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://flox.mintlify.site/docs/_mintlify/api/og/v2?division=Tutorials\u0026amp;title=Build+and+publish+packages\u0026amp;description=Building+and+publishing+custom+packages+with+Flox\u0026amp;theme=499e841fe95ca0b9c8be2d34\u0026amp;signature=da83b8c68f9e2156fcf5f64db19f6c1234b72a3b489d1278a0c4cf99c26b0ce0\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/flox/GZA6Gh0WLJjYFtuZ/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Flox\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#8D45FF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://flox.dev/docs/tutorials/build-and-publish\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/tutorials/build-and-publish.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://flox.dev/#organization\",\"name\":\"Flox\",\"url\":\"https://flox.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/flox/TGd54292LI04fuY9/logo/light.svg?fit=max\u0026auto=format\u0026n=TGd54292LI04fuY9\u0026q=85\u0026s=a68dffe97384d4c4af5850b2c4ab2d6c\"}},{\"@type\":\"WebSite\",\"@id\":\"https://flox.dev/docs#website\",\"name\":\"Flox\",\"url\":\"https://flox.dev/docs\",\"publisher\":{\"@id\":\"https://flox.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://flox.dev/docs/tutorials/build-and-publish#webpage\",\"url\":\"https://flox.dev/docs/tutorials/build-and-publish\",\"name\":\"Build and publish packages\",\"description\":\"Building and publishing custom packages with Flox\",\"dateModified\":\"2026-05-13T12:28:10.267Z\",\"isPartOf\":{\"@id\":\"https://flox.dev/docs#website\"},\"breadcrumb\":{\"@id\":\"https://flox.dev/docs/tutorials/build-and-publish#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://flox.dev/docs/tutorials/build-and-publish#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tutorials\",\"item\":\"https://flox.dev/docs/tutorials/creating-environments\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build and publish packages\",\"item\":\"https://flox.dev/docs/tutorials/build-and-publish\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://flox.dev/docs/tutorials/build-and-publish#article\",\"headline\":\"Build and publish packages\",\"name\":\"Build and publish packages\",\"description\":\"Building and publishing custom packages with Flox\",\"url\":\"https://flox.dev/docs/tutorials/build-and-publish\",\"mainEntityOfPage\":{\"@id\":\"https://flox.dev/docs/tutorials/build-and-publish#webpage\"},\"dateModified\":\"2026-05-13T12:28:10.267Z\",\"publisher\":{\"@id\":\"https://flox.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://flox.dev/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Flox\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Flox","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Introduction","pages":[{"title":"Introduction","href":""}]},{"group":"Install Flox","pages":[{"title":"Install Flox","href":"/install-flox/install"},{"title":"Uninstall Flox","href":"/install-flox/uninstall"},{"title":"Troubleshooting installation","href":"/install-flox/troubleshooting"},{"title":"Extensions","href":"/install-flox/ide-extensions"}]},{"group":"Quickstart","pages":[{"title":"Flox in 5 minutes","href":"/flox-5-minutes"}]},{"group":"Tutorials","pages":[{"title":"Creating environments","href":"/tutorials/creating-environments"},{"title":"The default environment","href":"/tutorials/default-environment"},{"title":"Example default environments","href":"/tutorials/default-environment-examples"},{"title":"Sharing your environments","href":"/tutorials/sharing-environments"},{"title":"Layering multiple environments","href":"/tutorials/layering-multiple-environments"},{"title":"Customizing the shell environment","href":"/tutorials/customizing-environments"},{"title":"Designing cross-platform environments","description":"Creating environments that run on different systems.","href":"/tutorials/multi-arch-environments"},{"title":"Build and publish packages","href":"/tutorials/build-and-publish"},{"title":"Using a newer version of a package","description":"Override the build recipe of a package from the Flox Catalog to install a newer version that is not yet available.","href":"/tutorials/overriding-packages"},{"title":"Running Flox in CI/CD","href":"/tutorials/ci-cd"},{"title":"Reusing and combining developer environments","href":"/tutorials/composition"},{"title":"Selecting package outputs","href":"/tutorials/package-outputs"},{"title":"Flox + CUDA tutorial","href":"/tutorials/cuda"},{"title":"Flox and systemd","href":"/tutorials/flox-and-systemd"},{"title":"Installing Flox from its repository on Debian and Red Hat","href":"/tutorials/installing-from-repo"},{"group":"Migration guides","pages":[{"title":"Homebrew","href":"/tutorials/migrations/homebrew"},{"title":"Node Version Manager (nvm)","href":"/tutorials/migrations/nvm"}]}]},{"group":"Imageless Kubernetes","pages":[{"title":"Imageless Kubernetes Introduction","href":"/imageless-kubernetes/intro"},{"title":"Tech","href":"/imageless-kubernetes/tech"},{"group":"Installation","pages":[{"title":"Amazon EKS","href":"/imageless-kubernetes/install/eks"},{"title":"Self-managed Kubernetes","href":"/imageless-kubernetes/install/self-managed"},{"title":"Troubleshooting","href":"/imageless-kubernetes/install/troubleshooting"},{"title":"Upgrading","href":"/imageless-kubernetes/install/upgrading"},{"title":"Uninstall","href":"/imageless-kubernetes/install/uninstall"}]},{"group":"Examples","pages":[{"title":"GitLab CI","href":"/imageless-kubernetes/examples/gitlab-ci"},{"title":"Web server with Redis on kind","href":"/imageless-kubernetes/examples/kind-demo"}]},{"title":"Configuration","href":"/imageless-kubernetes/config"}]},{"group":"Concepts","pages":[{"title":"What is a Flox environment?","href":"/concepts/environments"},{"title":"Activating environments","href":"/concepts/activation"},{"title":"Auto-activation","href":"/concepts/auto-activation"},{"title":"Compatibility policy","href":"/concepts/compatibility"},{"title":"What is FloxHub?","href":"/concepts/floxhub"},{"title":"FloxHub environments","href":"/concepts/floxhub-environments"},{"title":"What is a generation?","href":"/concepts/generations"},{"title":"What is the Flox Catalog?","href":"/concepts/packages-and-catalog"},{"title":"Package Groups","href":"/concepts/package-groups"},{"title":"What is the Base Catalog?","href":"/concepts/base-catalog"},{"title":"CUDA packages in the Flox Catalog and binary cache","href":"/concepts/cuda-catalog-and-cache"},{"title":"Services","href":"/concepts/services"},{"title":"Composing environments","href":"/concepts/composition"},{"title":"Authentication","href":"/concepts/authentication"},{"title":"What Flox collects","href":"/concepts/data-collection"},{"title":"Understanding Organizations in FloxHub","href":"/concepts/organizations"},{"title":"Enterprise SSO","href":"/concepts/enterprise-sso"},{"title":"Service accounts","href":"/concepts/service-accounts"},{"title":"Personal access tokens","href":"/concepts/personal-access-tokens"},{"title":"Builds","href":"/concepts/builds"},{"title":"Manifest Builds","href":"/concepts/manifest-builds"},{"title":"Nix expression builds","href":"/concepts/nix-expression-builds"},{"title":"Catalog imports","href":"/concepts/catalog-imports"},{"title":"Publishing","href":"/concepts/publishing"},{"title":"Secrets management","href":"/concepts/secrets-management"},{"title":"Plugins","href":"/concepts/plugins"},{"title":"Flox vs. container workflows","href":"/concepts/flox-vs-containers"}]},{"group":"Languages","pages":[{"title":"C/C++","href":"/languages/c"},{"title":"Go","href":"/languages/go"},{"title":"JVM","href":"/languages/jvm"},{"title":"Node.js","href":"/languages/nodejs"},{"title":"Python","href":"/languages/python"},{"title":"Ruby","href":"/languages/ruby"},{"title":"Rust","href":"/languages/rust"}]},{"group":"Customer","pages":[{"title":"Catalog Store","href":"/customer/catalog-store"},{"title":"Known issues","href":"/customer/known-issues"},{"title":"Signing keys","href":"/customer/signing-keys"}]}]},{"tab":"CLI reference","pages":[{"title":"CLI reference","href":"/man/flox"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog"}]}]},"basePath":"","title":"Build and publish packages - Flox","buildId":"dpl_BSPUBxEoKhhK7HzXVDPxdPvWx4xc","deploymentId":"dpl_BSPUBxEoKhhK7HzXVDPxdPvWx4xc","dynamics":[],"chunks":[]}