Skip to content

Instantly share code, notes, and snippets.

@Munksgaard
Created May 16, 2025 07:20
Show Gist options
  • Save Munksgaard/b233ef27540f82aa6a3c305e852e4ba5 to your computer and use it in GitHub Desktop.
Save Munksgaard/b233ef27540f82aa6a3c305e852e4ba5 to your computer and use it in GitHub Desktop.
Building phoenix release using nix (the tailwind parts)

In general, follow the guides in the nixpkgs manual.

# config/config.exs
# Configure tailwind (the version is required)
config :tailwind,
  version: "3.4.12",
  # Use MIX_TAILWIND_PATH to find the tailwind binary
  path: System.get_env("MIX_TAILWIND_PATH"),
  default: [
    args: ~w(
      --config=tailwind.config.js
      --input=css/app.css
      --output=../priv/static/assets/app.css
    ),
    cd: Path.expand("../assets", __DIR__)
  ]
# flake.nix
# in the postBuild of your mixRelease
              MIX_ESBUILD_NODE_PATH="${mixFodDeps}/" \
                MIX_TAILWIND_PATH="${tailwindCss}/bin/tailwind" \
                MIX_ESBUILD_PATH="${pkgs.esbuild}/bin/esbuild" \
                mix assets.deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment