PHPackages                             stephank/composer-plugin-nixify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. stephank/composer-plugin-nixify

ActiveComposer-plugin[DevOps &amp; Deployment](/categories/devops)

stephank/composer-plugin-nixify
===============================

Composer plugin to help with Nix packaging

v1.1.0(4y ago)1710.5k↓34.2%2BSD-2-ClausePHP

Since Sep 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/stephank/composer-plugin-nixify)[ Packagist](https://packagist.org/packages/stephank/composer-plugin-nixify)[ Docs](https://github.com/stephank/composer-plugin-nixify)[ RSS](/packages/stephank-composer-plugin-nixify/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (9)Used By (0)

composer-plugin-nixify
======================

[](#composer-plugin-nixify)

Generates a [Nix](https://nixos.org) expression to build a [Composer](https://getcomposer.org) project.

- A default configure-phase that runs `composer install` in your project. (May be all that's needed to build your project.)
- A default install-phase that creates executables for you based on `"bin"` in your `composer.json`, making your package readily installable.
- Granular fetching of dependencies in Nix, speeding up rebuilds and potentially allowing downloads to be shared between projects.
- Preloading of your Composer cache into the Nix store, speeding up local `nix-build`.
- Automatically keeps your Nix expression up-to-date as you `composer require`/ `composer update` dependencies.
- **No Nix installation required** for the plugin itself, so it should be safe to add to your project even if some developers don't use Nix.

Related projects:

- [composer2nix](https://github.com/svanderburg/composer2nix): Does a similar job, but as a separate command. By comparison, this plugin tries to automate the process and make things easy for Nix and non-Nix devs alike.
- [yarn-plugin-nixify](https://github.com/stephank/yarn-plugin-nixify): Similar solution for Node.js with Yarn v2.

Usage
-----

[](#usage)

The Nixify plugin should work fine with Composer versions all the way back to 1.3.0, and also supports Composer 2.0.

To use the plugin:

```
# Install the plugin
composer require stephank/composer-plugin-nixify

# Build your project with Nix
nix-build
```

Running Composer with this plugin enabled will generate two files:

- `composer-project.nix`: This file is always overwritten, and contains a basic derivation for your project.
- `default.nix`: Only generated if it does not exist yet. This file is intended to be customized with any project-specific logic you need.

This may already build successfully! But if your project needs extra build steps, you may have to customize `default.nix` a bit. Some examples of what's possible:

```
{ pkgs ? import  { } }:

let

  # Example of providing a different source tree.
  src = pkgs.lib.cleanSource ./.;

  project = pkgs.callPackage ./composer-project.nix {

    # Example of selecting a specific version of PHP.
    php = pkgs.php74;

  } src;

in project.overrideAttrs (oldAttrs: {

  # Example of overriding the default package name taken from composer.json.
  name = "myproject";

  # Example of adding packages to the build environment.
  buildInputs = oldAttrs.buildInputs ++ [ pkgs.imagemagick ];

  # Example of invoking a build step in your project.
  buildPhase = ''
    composer run lint
  '';

})
```

Settings
--------

[](#settings)

Some additional settings are available which can be set in the `"extra"` object in your `composer.json`:

- `nix-expr-path` can be set to customize the path where the Nixify plugin writes `composer-project.nix`. For example, if you're also using [Niv](https://github.com/nmattia/niv) in your project, you may prefer to set this to `nix/composer-project.nix`.
- `generate-default-nix` can be set to `false` to disable generating a `default.nix`. This file is only generated if it doesn't exist yet, but this flag can be useful if you don't want a `default.nix` at all.
- `enable-nix-preload` can be set to `false` to disable preloading Composer cache into the Nix store. This preloading is intended to speed up a local `nix-build`, because Nix will not have to download dependencies again. Preloading does mean another copy of dependencies on disk, even if you don't do local Nix builds, but the size is usually not an issue on modern disks.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~57 days

Recently: every ~69 days

Total

7

Last Release

1716d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a28bcd38b7e38ebbeab20781ecd5746829ae5811587a41ba710dd260786fc0e?d=identicon)[stephank](/maintainers/stephank)

---

Top Contributors

[![stephank](https://avatars.githubusercontent.com/u/89950?v=4)](https://github.com/stephank "stephank (12 commits)")[![tristanpemble](https://avatars.githubusercontent.com/u/2466322?v=4)](https://github.com/tristanpemble "tristanpemble (3 commits)")

### Embed Badge

![Health badge](/badges/stephank-composer-plugin-nixify/health.svg)

```
[![Health](https://phpackages.com/badges/stephank-composer-plugin-nixify/health.svg)](https://phpackages.com/packages/stephank-composer-plugin-nixify)
```

###  Alternatives

[johnpbloch/wordpress-core-installer

A custom installer to handle deploying WordPress with composer

22110.8M47](/packages/johnpbloch-wordpress-core-installer)[civicrm/composer-compile-plugin

Define a 'compile' event for all packages in the dependency-graph

12488.2k15](/packages/civicrm-composer-compile-plugin)[enumag/no-thanks

Prevents symfony/flex from printing thanks reminder.

3315.6k](/packages/enumag-no-thanks)[inpsyde/vip-composer-plugin

A Composer plugin to ease deployment to wordpress.com VIP servers alongside Composer-based development.

1258.2k](/packages/inpsyde-vip-composer-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
