allowBroken for a single package in flake

I’m trying to write a flake [to tame an integrated collection of scientific software (with which I am not familiar myself), which is glued together with ad-hoc installation scripts, patches, branches in forks, chewing gum and sticky tape … and lots of implicit state on the developer’s machine].

Somewhere in its bowels, it requires the use of a Python module which depends on another Python module which is marked as broken in nixpkgs. I suspect that this dependency might not be used all that much in this whole bundle, and it’s preventing me from making progress on discovering and dealing with other dependencies.

Is it possible to allowBroken for just that single package that is being used in a flake?

Hrm, can you use overrideAttrs to set meta.broken to false? E.g.:

pythonPackage.overrideAttrs(old: {
  meta = old.meta // { broken = false; };

[aside: there’s a missing ; after broken = false] in your code sample.

I’m still a bit lost as to how to deal with the fact that it’s a transitive dependency. Edit: not only that, it’s also a Python package, so it needs to go somewhere in pkgs.python<generic-version-????>Packages.

Replacing abstract names with some concrete ones, I need to use

  • nipype, which depends on
  • pybids, which is broken

How should I tell nipype about the overridden pybids?

Any old overlay will do the trick. That’s exactly what they’re for.

I whipped up this minimal example:

  outputs = { self, nixpkgs, ... }: let
    pkgs = import nixpkgs {
      overlays = [
        (final: prev: {
          custom_python = prev.python3.override {
            packageOverrides = pyself: pyprev: {
              pybids = pyprev.pybids.overrideAttrs(old: {
                meta = old.meta // { broken = false; };
      system = "x86_64-linux";
  in {
    devShells.x86_64-linux.default = pkgs.mkShell {
      buildInputs = [
        (pkgs.custom_python.withPackages(ps: with ps; [

This evaluates for me without complaining!

Thanks for the complete code sample, that’s always very helpful.

Unfortunately I’m missing much of the Nix-vocabulary of overlays, and the experience to remember details of plumbing. For example, without your sample, I don’t know how long it would have taken me to recall or re-find packageOverrides, etc.

If I try to nix build it, with an additional inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05"; I get this error:

> ERROR: Could not find a version that satisfies the requirement sqlalchemy<1.4.0.dev0 (from pybids) (from versions: none)
> ERROR: No matching distribution found for sqlalchemy<1.4.0.dev0

which looks likely to be related to the reason why the package was broken in the first place.

If I switch nixpkgs to unstable I get the same error but with formulaic<0.4,>=0.2.4 instead of sqlalchemy.

Hm, I see. In that case I think you’ll have to provide the necessary versions manually with a buildPythonPackage (see Python | nixpkgs). You can add those to the overlay and pray it doesn’t break any other packages.

Personally, I would use a tool like poerty ( and poetry2nix (GitHub - nix-community/poetry2nix: Convert poetry projects to nix automagically [maintainer=@adisbladis]) but those do not guarantee everything will build, I ran into plenty of edge-cases myself…

Honestly, python packaging is a mess

1 Like