From e3938e9464c2f860bfe303dd986243880c0b4075 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 18 Jan 2025 06:55:28 +0000 Subject: [PATCH] templates: inherit `checks` from _all_ templates --- flake/templates.nix | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/flake/templates.nix b/flake/templates.nix index c8338d6c..7de4151f 100644 --- a/flake/templates.nix +++ b/flake/templates.nix @@ -25,7 +25,7 @@ args@{ inputs, outputs, - sourceInfo, + sourceInfo ? { }, }: let outputs = args.outputs (inputs // { self = result; }); @@ -39,18 +39,21 @@ in result; - templateFlakeOutputs = callFlake { - inputs = { - inherit (inputs) flake-parts nixpkgs; - nixvim = self; - }; - # Import and read the `outputs` field of the template flake. - inherit (import ../templates/simple/flake.nix) outputs; - sourceInfo = { }; - }; - - templateChecks = templateFlakeOutputs.checks.${system}; + flakes = lib.mapAttrs ( + name: template: + callFlake { + # Use inputs from our flake + inputs = { + inherit (inputs) flake-parts nixpkgs; + nixvim = self; + }; + # Use outputs from the template flake + inherit (import "${template.path}/flake.nix") outputs; + } + ) self.templates; in - lib.concatMapAttrs (checkName: check: { "template-${checkName}" = check; }) templateChecks; + lib.concatMapAttrs (name: flake: { + "template-${name}" = pkgs.linkFarm name flake.checks.${system}; + }) flakes; }; }