summaryrefslogtreecommitdiff
path: root/doctrine
diff options
context:
space:
mode:
authorFabian Montero <fabian@posixlycorrect.com>2025-08-05 23:22:16 -0600
committerAlejandro Soto <alejandro@34project.org>2025-08-06 13:36:43 -0600
commit578b0c59aa75fedf7594d4ce95b2038cc53f53cd (patch)
treea4cddec76fc5d6d6a591ea109ad56b1082fbb8d4 /doctrine
parenteecebc6ffa285678f650700d771aace2efcf2176 (diff)
add doctrine
Diffstat (limited to '')
-rw-r--r--doctrine/default.nix12
-rw-r--r--doctrine/lib/default.nix10
-rw-r--r--doctrine/lib/importAll.nix (renamed from pkgs/lib/importAll.nix)0
-rw-r--r--doctrine/lib/mk-module.nix38
4 files changed, 60 insertions, 0 deletions
diff --git a/doctrine/default.nix b/doctrine/default.nix
new file mode 100644
index 0000000..b4c72b8
--- /dev/null
+++ b/doctrine/default.nix
@@ -0,0 +1,12 @@
+{
+ pkgs,
+ namespace,
+}: let
+ doctrine = {
+ lib = import ./lib {inherit lib pkgs doctrine;};
+ prefix = "trivium";
+ inherit namespace;
+ };
+ inherit (pkgs) lib;
+in
+ doctrine
diff --git a/doctrine/lib/default.nix b/doctrine/lib/default.nix
new file mode 100644
index 0000000..1b03fe1
--- /dev/null
+++ b/doctrine/lib/default.nix
@@ -0,0 +1,10 @@
+{
+ lib,
+ doctrine,
+ pkgs,
+}: let
+ close = f: args: f (args // {inherit lib pkgs doctrine;});
+in {
+ importAll = pkgs.callPackage ./importAll.nix {};
+ mkModule = close (import ./mk-module.nix);
+}
diff --git a/pkgs/lib/importAll.nix b/doctrine/lib/importAll.nix
index 6acabe9..6acabe9 100644
--- a/pkgs/lib/importAll.nix
+++ b/doctrine/lib/importAll.nix
diff --git a/doctrine/lib/mk-module.nix b/doctrine/lib/mk-module.nix
new file mode 100644
index 0000000..79c24c5
--- /dev/null
+++ b/doctrine/lib/mk-module.nix
@@ -0,0 +1,38 @@
+{
+ name,
+ hm ? null,
+ sys ? null,
+ options ? null,
+ lib,
+ config,
+ pkgs,
+ doctrine,
+}: let
+ optionsSet = import options {
+ inherit config lib pkgs cfg name doctrine;
+ };
+
+ configSet = import configFiles.${doctrine.namespace} {
+ inherit config lib pkgs doctrine cfg;
+ };
+
+ configFiles = lib.filterAttrs (k: v: v != null) {
+ inherit sys hm;
+ };
+
+ cfg = config.${doctrine.prefix}.${name};
+in {
+ config =
+ lib.optionalAttrs (configFiles ? ${doctrine.namespace})
+ (lib.mkIf cfg.enable configSet);
+
+ options = lib.optionalAttrs (options
+ != null
+ && optionsSet ? ${doctrine.namespace}) {
+ ${doctrine.prefix}.${name} =
+ optionsSet.${doctrine.namespace}
+ // {
+ enable = lib.mkEnableOption name;
+ };
+ };
+}