Hi,
I’m packaging a proprietary C/C++ library into a flake and would like to provide an overlay for downstream projects. At first, I have a default.nix
that provides the derivation:
{ pkgs ? import <nixpkgs> {
config = { allowUnfree = true; };
}}:
pkgs.stdenv.mkDerivation rec {
...
}
And the flake for this library (both nix build
and nix develop
can work as expected):
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
{
packages.default = pkgs.callPackage ./default.nix { inherit pkgs; };
overlay = final: prev: {
fpgamgr = pkgs.callPackage ./default.nix {
pkgs = final;
};
};
devShells.default = pkgs.callPackage ({ mkShell, pkg-config, ... }:
mkShell {
buildInputs = with pkgs; [
cmake
coreutils
];
}
) {};
}
);
}
The problem is on the overlay when I create another flake for my application:
{
description = "Demo Application";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
# The folder contains both default.nix and flake.nix mentioned above
fpgamgr.url = "./../nixos";
};
outputs = { self, nixpkgs, flake-utils, fpgamgr }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ fpgamgr.overlay ];
};
in
{
devShells.default = pkgs.callPackage ({ mkShell, pkg-config, ... }:
mkShell {
buildInputs = with pkgs; [
fpgamgr
cmake
coreutils
];
}
) {};
}
);
}
When I call nix develop
against this flake, it throws this error: All overlays passed to nixpkgs must be functions. This confuses me a lot because it looks like a function to me. Does it somehow get evaluated?
Many thanks.