summaryrefslogtreecommitdiffstats
path: root/default.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-11-02 15:19:44 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-11-02 15:19:44 +0100
commit39a3a1a6f8c0a5bd387dcddf07ea686a3f2e493d (patch)
treeefabda5300b8247f1b7bc2787247a7351e52d100 /default.nix
parentfix(by-name-overlay): Correctly display the `rawPath` in warnings (diff)
downloadnix-library-39a3a1a6f8c0a5bd387dcddf07ea686a3f2e493d.zip
treewide: Add new math and options subcategories and restructure
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix29
1 files changed, 12 insertions, 17 deletions
diff --git a/default.nix b/default.nix
index 9098bce..26e93c3 100644
--- a/default.nix
+++ b/default.nix
@@ -7,27 +7,18 @@
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-
-{}: let
+{lib}: let
# string -> string -> string
colorize = color: string: "[${color}m${string}";
-
- # Taken from `nixpkgs/lib`.
- # Is here to avoid a dependency on `lib` (making this file easy to test with `nix eval`)
- warn =
- # Since Nix 2.23, https://github.com/NixOS/nix/pull/10592
- builtins.warn
- or (
- # Do not eta reduce v, so that we have the same strictness as `builtins.warn`.
- msg: v:
- # `builtins.warn` requires a string message, so we enforce that in our implementation, so that callers aren't accidentally incompatible with newer Nix versions.
- assert builtins.isString msg;
- builtins.trace "${colorize "1;35" "evaluation warning:"} ${msg}" v
- );
in {
- mkByName = import ./by-name-overlay.nix {inherit warn;};
+ /**
+ Converts a `by-name` structured directory into.
+ *
+ */
+ mkByName = import ./by-name.nix;
# Warn while merging two attrsets if the RHS shares names with the LHS.
+ #
# # Example:
# ```nix
# let
@@ -36,6 +27,7 @@ in {
# in
# warnMerge attr1 attr2 "attr1 core value set"
# ```
+ #
# # Type:
# {} -> {} -> string -> {}
warnMerge = lhs: rhs: sourceSet: let
@@ -46,7 +38,10 @@ in {
in
if overridden != {}
then
- warn "Attributes overridden while merging ${sourceSet}: ${mkWarning overridden}"
+ builtins.warn "Attributes overridden while merging ${sourceSet}: ${mkWarning overridden}"
merged
else merged;
+
+ math = import ./math.nix {inherit lib;};
+ options = import ./options.nix {inherit lib;};
}