From 4054bdc7385597446bc9dd124b0b3fd6df86f6d3 Mon Sep 17 00:00:00 2001 From: Lucas Chaim Date: Wed, 18 Sep 2024 12:30:52 -0300 Subject: [PATCH] feat: Pass through individual channel configuration Channel-specific configuration is now also passed through to flake-utils-plus.mkFlake, allowing channels to have distinct settings and allowing for channel selection for individual hosts. --- snowfall-lib/flake/default.nix | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/snowfall-lib/flake/default.nix b/snowfall-lib/flake/default.nix index 65cbe30..9df1dcf 100644 --- a/snowfall-lib/flake/default.nix +++ b/snowfall-lib/flake/default.nix @@ -4,7 +4,7 @@ snowfall-lib, snowfall-config, }: let - inherit (core-inputs.nixpkgs.lib) assertMsg foldl filterAttrs const; + inherit (core-inputs.nixpkgs.lib) const filterAttrs mapAttrs traceVal; in rec { flake = rec { ## Remove the `self` attribute from an attribute set. @@ -128,6 +128,7 @@ in rec { inherit namespace; extra-overlays = full-flake-options.extra-exported-overlays or {}; }; + channels = full-flake-options.channels or {}; outputs-builder = channels: let user-outputs-builder = @@ -172,12 +173,22 @@ in rec { darwinModules = darwin-modules; homeModules = home-modules; - channelsConfig = full-flake-options.channels-config or {}; - - channels.nixpkgs.overlaysBuilder = snowfall-lib.overlay.create-overlays-builder { - inherit namespace; - extra-overlays = full-flake-options.overlays or []; - }; + channelsConfig = + full-flake-options.channels-config + or full-flake-options.channelsConfig + or {}; + + channels = + mapAttrs + (channel: config: + config + // { + overlaysBuilder = snowfall-lib.overlay.create-overlays-builder { + inherit namespace; + extra-overlays = full-flake-options.overlays or []; + }; + }) + ({nixpkgs = {};} // channels); outputsBuilder = outputs-builder;