NixOS

Support

Reach out to the community using the Mailing Lists or IRC at #zfsonlinux on Libera Chat.

If you have a bug report or feature request related to this HOWTO, please file a new issue and mention @ne9z.

Installation

Note: this is for installing ZFS on an existing NixOS installation. To use ZFS as root file system, see below.

Live image ships with ZFS support by default.

Note that you need to apply these settings even if you don’t need to boot from ZFS. The kernel module ‘zfs.ko’ will not be available to modprobe until you make these changes and reboot.

  1. Import separate configration file for ZFS options:

    vim /etc/nixos/configuration.nix
    ##add './zfs.nix' to 'imports'
    # imports = [ ./zfs.nix ];
    
  2. Configure ZFS options:

    tee -a /etc/nixos/zfs.nix <<EOF
    { config, pkgs, ... }:
    
    { boot.supportedFilesystems = [ "zfs" ];
      networking.hostId = (builtins.substring 0 8 (builtins.readFile "/etc/machine-id"));
    }
    EOF
    
  3. Apply configuation changes:

    nixos-rebuild switch
    

Root on ZFS

ZFS can be used as root file system for NixOS. An installation guide is available.

Start from “Preparation”.

Contribute

  1. Fork and clone this repo.

  2. Launch an ephemeral nix-shell with the following packages:

    nix-shell -p python39 python39Packages.pip gnumake \
        python39Packages.setuptools
    
  3. Create python virtual environment and install packages:

    cd openzfs-docs
    python -m venv .venv
    source .venv/bin/activate
    
    pip install -r docs/requirements.txt
    
  4. Make your changes.

  5. Test:

    make html
    sensible-browser _build/html/index.html
    
  6. git commit --signoff to a branch, git push, and create a pull request. Mention @ne9z.