feat: add lib and inputs args to overlay

Overlays previously would only receive a "channels" argument and the
rest of the attribute set would be the flake's inputs. This is now
changing to support passing "lib", the same instance you would get
in your system configuration, and "inputs", an attribute set of the
flake's inputs. Referencing flake inputs by name here is now
deprecated and will be removed in a future update.
This commit is contained in:
Jake Hamilton 2024-02-23 08:57:44 -08:00
parent 1284023e7a
commit 9b718da230
No known key found for this signature in database
GPG key ID: 9762169A1B35EA68

View file

@ -26,7 +26,16 @@ in {
extra-overlays ? [],
}: channels: let
user-overlays = snowfall-lib.fs.get-default-nix-files-recursive src;
create-overlay = overlay: import overlay (user-inputs // {inherit channels;});
create-overlay = overlay:
import overlay (
# Deprecated: Use `inputs.*` instead of referencing the input name directly.
user-inputs
// {
inherit channels;
inputs = user-inputs;
lib = snowfall-lib.internal.system-lib;
}
);
user-packages-overlay = final: prev: let
user-packages = snowfall-lib.package.create-packages {
pkgs = final;
@ -89,7 +98,15 @@ in {
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory file);
overlay = final: prev: let
channels = channel-systems.${prev.system};
user-overlay = import file (user-inputs // {inherit channels;});
user-overlay = import file (
# Deprecated: Use `inputs.*` instead of referencing the input name directly.
user-inputs
// {
inherit channels;
inputs = user-inputs;
lib = snowfall-lib.internal.system-lib;
}
);
packages = user-packages-overlay final prev;
prev-with-packages =
if package-namespace == null