How to use a flake overlay into another flake?

I have my neovim config using nix flakes and nix mosules at GitHub - matdsoupe/neomat: No LSP here my friend!

And I also have my system config set up with flakes, at GitHub - matdsoupe/nixnad: Config files to set up a Software development workstation!

In my neovim flake I define the overlay as:

overlay = (self: super: {
  inherit neovimWrapper;
  neovim = packages.neovimMT;
  neovimPlugins = pkgs.neovimPlugins;

and in my system config I have a overlay helper module:

flake: self: super:
  inherit (flake) inputs;
  inherit (flake.outputs.extra-args) global;
  inherit (global) rootPath system;
  inherit (super) lib callPackage writeShellScript;
  inherit (lib) recursiveUpdate;
  inherit (builtins) toString length head tail;
  inherit (flake.inputs) nixpkgs-latest nixpkgs-master nixpkgs neomat;
  cp = f: (callPackage f) {};
  reduce-join = items:
    if (length items) > 0 then
      (recursiveUpdate (head items) (reduce-join (tail items)))
reduce-join [
  rec {
    lib = {
      inherit reduce-join;
      maintainers = import "${nixpkgs-latest}/maintainers/maintainer-list.nix";
    latest = import nixpkgs-latest { };
    beekeeper-studio = cp "${nixpkgs-master}/pkgs/development/tools/database/beekeeper-studio/default.nix";
    discord = cp "${nixpkgs-master}/pkgs/applications/networking/instant-messengers/discord/default.nix";
    onlyoffice-bin = cp "${nixpkgs-master}/pkgs/applications/office/onlyoffice-bin/default.nix";
    neovim = cp neomat.overlay."${system}";

In the attr neovim I tried to define in severous ways:

  • neovim = cp neomat.overlay."${system}";
  • neovim = cp neomat.overlay."${system}".neovim;
  • neovim = import neomat.overlay."${system}";
  • neovim = import neomat.overlay."${system}".neovim;

And I call the neovim package here: nixnad/default.nix at d2c60ee0fc966046779b34e2c1ab8f787edc1336 · matdsoupe/nixnad · GitHub

With the first neovim attrs option, nothing happens and neovim v0.4.4 is installed.

With all the other options I get this error:

error: value is a function while a set was expected

       at /nix/store/dgi2naykwi67abi94rzypyvwv3bykqv6-source/overlay.nix:30:17:

           29|     onlyoffice-bin = cp "${nixpkgs-master}/pkgs/applications/office/onlyoffice-bin/default.nix";
           30|     neovim = cp neomat.overlay."${system}".neovim;
             |                 ^
           31|   }
(use '--show-trace' to show detailed location information)

What am I doing wrong?

1 Like

Without having time to look into the snippets, I can say that value is a function while a set was expected means that you’re not calling the function in question, just passing it around. You should find out where that’s happening and call it.