> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# eld/nix

The Nix orb is for installing the Nix package manager. This orb does one thing and one thing well; it installs Nix.
Check out the Cachix orb for wiring up remote binary caches hosted on Cachix.


## Commands

### install

This command installs Nix using the DeterminateSystems nix-installer


| Parameter | Type | Default | Description |
|---|---|---|---|
| `channels` | string |  | Channel(s) to add (e.g. `nixpkgs=https://nixos.org/channels/nixpkgs-unstable`) |
| `extra-conf` | string |  | Extra configuration lines for `/etc/nix/nix.conf`
By default, this appends `trusted-users = root $USER` to the extra config so the CI user can configure binary caches.
 |
| `init` | enum |  | The init systems to configure, requires `planner: linux-multi` (allowing the choice between `none` or `systemd`) |
| `logger` | enum |  | The logger used for the install (e.g. `pretty`, `json`, `full`, `compact`) |
| `mac-case-sensitive` | boolean | false | Use a case sensitive volume (`planner: macos` only) |
| `mac-encrypt` | boolean | false | Force encryption on the volume (`planner: macos` only) |
| `mac-root-disk` | string |  | The root disk of the target (`planner: macos` only) |
| `mac-volume-label` | string |  | The label for the created APFS volume (`planner: macos` only) |
| `modify-profile` | boolean | false | Modify the user profile to automatically load nix |
| `nix-build-group-id` | integer | -1 | The nix build group GID |
| `nix-build-group-name` | string |  | The Nix build group name |
| `nix-build-user-base` | integer | -1 | The Nix build user base UID (ascending) |
| `nix-build-user-count` | integer | -1 | Number of build users to create |
| `nix-build-user-prefix` | string |  | The Nix build user prefix (user numbers will be postfixed) |
| `nix-package-url` | string |  | The Nix package URL |
| `planner` | string |  | A planner to use |
| `reinstall` | boolean | false | Force a reinstall if an existing installation is detected (consider backing up `/nix/store`) |
| `start-daemon` | string |  | If the daemon should be started, requires `planner: linux-multi` |

### install-cachix

This command installs `cachix` for use to configure binary caches
For private caches, you must have a context containing a `CACHIX_AUTH_TOKEN` environment variable.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `cachix-installable` | string | github:nixos/nixpkgs/nixpkgs-unstable#cachix | The installable path for Cachix
Defaults to `github:nixos/nixpkgs-unstable#cachix`
 |

### with-cachix

This command wraps the specified parameters with Cachix's `watch-exec` command to watch changed paths and upload them to your Cachix cache.
In order to write to the cache, you must have a context containing a `CACHIX_AUTH_TOKEN` environment variable.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `cache-name` | string |  | The cache to use before running the `watch-exec` subcommand |
| `cachix-user` | string |  | The user/cache to use and authenticate against |
| `nix-command` | string |  | The nix command to wrap with the `watch-exec` command |

## Examples

### example

Example of using the Nix orb to install Nix on a Linux or macOS executor


```yaml
version: '2.1'
orbs:
  nix: eld/nix@1.0.0
jobs:
  install-nix:
    machine:
      image: ubuntu-2004:202111-02
    steps:
      - nix/install
workflows: null
```