Should travel with your code?

I’ve started putting together a ‘hello world’ habitat package to get the feel for it. One thing that immediately jumped out as unsettling was that habitat (or at least the docs) seems to discourage keeping your with your app code.

For example - I would expect to see the sitting in the root of my project’s repository. Now build, dependency, and runtime configuration is all sitting right there with the code.

However, because of how the source is downloaded and checksummed, it looks like you get a chicken-and-egg problem where your needs to contain the checksum for the tarball containing it.

Looking at how Chef itself handles the core packages, it looks like all the files are kept in their own separate repository. Is this considered the best practice going forward?

Hello -

You can definitely keep a plan with it’s source.

Our core components [0] keep all their own plans next to the source in a habitat subdirectory. For example, the hab command [1] keeps it’s plan right here [2].

Cheers -


You can change the behavior of how plans download and checksum packages to by overriding the do_download, do_verify, and do_unpack callbacks to return 0.

If your plan is in your project in a habitat/ directory, you can get to your project’s files at $PLAN_CONTEXT/.. in your plan.

See for an example.

I see - so it looks to me like the pkg_source and pkg_shasum variables are intended to be used for externally maintained packages that you just want to wrap in Habitat. Is that a fair assessment?

Thanks for your advise!

Yes that is a fair assessment. The exact way this works may change in the future and we figure out better patterns to make it easier to write plans, but this is how it currently works.

The script that builds the plans is here, if you care to take a closer look: