Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Controlling overlays.flakoboros

overlays.flakoboros overview

The current flake overlays.flakoboros output is generated by:

  • overrideAttrs, pyOverrideAttrs, rosOverrideAttrs
  • overrides, pyOverrides, rosOverrides
  • packages, pyPackages, rosPackages

Packages attrs overrides

The common and recommended case is when your package is already defined in nixpkgs, nix-ros-overlay, nur, or any kind of already available nix package collection. In that case, you can simply override very few of its attrs:

overrideAttrs.foo = {
  src = lib.cleanSource ./.;
};

Note

This is just syntactic sugar that will generate overlays.flakoboros as

pkgs-final: pkgs-prev: {
  foo = pkgs-prev.foo.overridAttrs (drv-final: drv-prev: {
    src = lib.cleanSource ./.;
  });
}

If you need more control, you can use a callable form:

overrideAttrs.foo =
  { pkgs-final, pkgs-prev, drv-final, drv-prev }:
  {
    src = lib.cleanSource ./.;
    nativeBuildInputs = drv-prev.nativeBuildinputs ++ [ pkgs-final.ninja ];
  };

Tip

when you don’t need all of the inputs, something like { pkgs-final, drv-prev, ... } is more appropriate

If your package is in pythonPackages, you’ll need pyOverrideAttrs instead. In that case you can also use python-final and python-prev.

And if it scoped by ROS distribution, rosOverrideAttrs will generate one override for each rosDistros. And you get ros-final and ros-prev.

Packages overrides

In the same way, you may need to override some of the inputs of a package (or python / ROS package), eg.:

pyOverrides.django = { withGdal = true; };

Note

This example would configure overlays.flakoboros as

pkgs-final: pkgs-prev: {
  pythonPackagesExtensions = pkgs-prev.pythonPackagesExtensions ++ [
    (
      python-final: python-prev: {
        django = python-prev.django.override { withGdal = true; };
      }
    )
  ];
}

Important

You can use both overrideAttrs.foo and overrides.foo simultaneously.

Behind the hood, overlays.flakoboros is a lib.composeManyExtensions including an overlay with all overrides first, and overlay with all overrideAttrs afterwards.

New packages definitions

Finally, if your package is not available in your inputs, you can use an usual package.nix kind of file:

packages.foo = ./package.nix

Or you could inline its definition:

pyPackages.pyboo =
  { buildPythonPackage, numpy, uv-build }:
  buildPythonPackage {
    inherit ((lib.importTOML ./pyproject.toml).project) name version;
    pyproject = true;

    src = lib.cleanSource ./.;

    build-system = [ uv-build ];
    dependencies = [ numpy ];
  };