Nix flakes with libraries that don't expose a flake.nix

Hello!

I’m pretty new with Nix and there’s something that I haven’t found an answer yet.
I have a flake.nex for a project I have and I want to use a third-party software as a buildInput, this package doesn’t exist in nixpkgs but it exists on GitHub, but on GitHub they don’t expose a flake.nix, how can I use that? Do I have to fork it and then add the flake.nix myself?

Thanks!

From the manual:

Repositories that don’t contain a flake.nix can also be used as inputs, by setting the input’s flake attribute to false:

inputs.grcov = {
  type = "github";
  owner = "mozilla";
  repo = "grcov";
  flake = false;
};

outputs = { self, nixpkgs, grcov }: {
  packages.x86_64-linux.grcov = stdenv.mkDerivation {
    src = grcov;
    ...
  };
};

So, you can create an out-of-repo flake.nix that refers to the original project with an input like in here.

4 Likes

Thanks a lot!

I missed that part