# ExFreeBSD

Helping [Elixir mix releases]( become [FreeBSD packages](, since 2022.

Documentation: <>

## Installation

You DO need `elixir` to build your release and package. You can install it with `pkg install elixir`.

You DO NOT need `elixir` to run your app, assuming your mix release configures `include_erts: true` (which is the default).

Add `freebsd` to your list of dependencies in `mix.exs`:

def deps do
    {:freebsd, "~> 0.4.1", runtime: false}

1. `mix freebsd.gen.pkg`
2. Edit `freebsd/*.eex` as desired (particularly desc in `freebsd/MANIFEST.eex`
3. Add a `freebsd` key to `mix.exs` project config.

  def project do
      # ExFreeBSD requires these standard keys:
      app: :freebsd,
      version: "0.4.1",
      description: description(),
      homepage_url: "",
      # and adds this one:
      freebsd: freebsd()

  defp freebsd do
      maintainer: "",
      description: description() # can be a multi-line string instead

## Usage

`env MIX_ENV=prod mix freebsd.pkg` will produce a FreeBSD .pkg file under freebsd/ which you can then install as usual.

`freebsd/rc.eex` produces `/usr/local/etc/rc.d/<appname>` which provides the following commands:

- `start`
- `stop`
- `restart`
- `status`
- `pid`
- `remote`
- `eval`
- `rpc`

Run them using [`service(8)`](

After installing the package, you should define application-specific environment variables in `/usr/local/etc/<appname>.conf`.

## Roadmap

- list dependencies
- auto-name package w/ CI suffix: `<app>-ci-<branch>-<version>p<timestamp>`
- MANIFEST conflict for `<app> <app>-ci-*`
- run as non-privileged user