trivionomicon/doctrine: add support for overriding the prefix

This commit is contained in:
Alejandro Soto 2025-08-24 18:49:13 -06:00
parent c651b8c470
commit 7daa3d91b3
3 changed files with 28 additions and 18 deletions

View file

@ -1,12 +1,16 @@
{ {
lib ? pkgs.lib,
pkgs, pkgs,
namespace, prefix ? "trivium",
namespace ? null,
}: let }: let
doctrine = { doctrine =
{
lib = import ./lib {inherit lib pkgs doctrine;}; lib = import ./lib {inherit lib pkgs doctrine;};
prefix = "trivium"; inherit namespace prefix;
inherit namespace; }
// lib.optionalAttrs (pkgs != null) {
inherit pkgs;
}; };
inherit (pkgs) lib;
in in
doctrine doctrine

View file

@ -13,8 +13,11 @@
closeLib = close {inherit lib;}; closeLib = close {inherit lib;};
closeFull = close {inherit lib pkgs doctrine;}; closeFull = close {inherit lib pkgs doctrine;};
in { in
{
inherit close; inherit close;
importAll = closeLib ./import-all.nix; importAll = closeLib ./import-all.nix;
}
// lib.optionalAttrs (doctrine.namespace != null) {
mkModule = closeFull ./mk-module.nix; mkModule = closeFull ./mk-module.nix;
} }

View file

@ -11,14 +11,17 @@
requires ? [], requires ? [],
prefix ? doctrine.prefix, prefix ? doctrine.prefix,
namespace ? doctrine.namespace, namespace ? doctrine.namespace,
passthru ? {},
}: let }: let
optionsSet = import options { optionsSet = import options (passthru
// {
inherit config lib pkgs cfg name doctrine; inherit config lib pkgs cfg name doctrine;
}; });
configSet = import configFiles.${namespace} { configSet = import configFiles.${namespace} (passthru
// {
inherit config lib pkgs doctrine cfg; inherit config lib pkgs doctrine cfg;
}; });
configFiles = lib.filterAttrs (k: v: v != null) { configFiles = lib.filterAttrs (k: v: v != null) {
inherit sys hm; inherit sys hm;