I have one module in which I have
{lib, config, pkgs, ... }:
let
an_overlay = self: super: {
lib = (super.lib or {}) // {
secret_key = attrs: attrs // {destDir = config.secrets_directory;};
};
in
<snip defining some options>
config = {
nixpkgs.overlays = [an_overlay];};
Now, in a different module x.nix, when I refer to the symbol lib.secret_key
, but then I get:
attribute 'secret_key' missing at x.nix
I just want to add a library function via an overlay and have it available in every module in my NixOps deployment.
When you look at the documentation, it only describes overlays as being useful for managing packages.
This chapter describes how to extend and change Nixpkgs packages using overlays.
Some blog posts describe extending e.g. lib
, but lib
is not a package, so the language in the manual is likely not precise enough.