From e0f04630de5f72bb490368557ff266a002e32536 Mon Sep 17 00:00:00 2001 From: Jeff Hykin Date: Sat, 25 May 2024 12:55:31 -0400 Subject: [PATCH] change how static is handled --- nodes/1_lib/source/default.nix | 6 +++--- nodes/1_lib/source/detangled/1_foundation.nix | 12 ++++++++++++ nodes/1_lib/source/detangled/2_static.nix | 19 +++++++++++++++++++ ...{2_fixed-points.nix => 3_fixed-points.nix} | 0 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 nodes/1_lib/source/detangled/2_static.nix rename nodes/1_lib/source/detangled/{2_fixed-points.nix => 3_fixed-points.nix} (100%) diff --git a/nodes/1_lib/source/default.nix b/nodes/1_lib/source/default.nix index 7cd436d..9b1ca4d 100644 --- a/nodes/1_lib/source/default.nix +++ b/nodes/1_lib/source/default.nix @@ -4,11 +4,11 @@ * for new functions in `./tests.nix`. */ let - foundation = import ./detangled/1_foundation.nix; - fixedPoints = import ./detangled/2_fixed-points.nix; + foundation = import ./detangled/1_foundation.nix; + static = import ./detangled/2_static.nix; + fixedPoints = import ./detangled/3_fixed-points.nix; in let - static = foundation.loadStatic ../.; untangledBase = { # constants sourceTypes = static.setup.sourceTypes; diff --git a/nodes/1_lib/source/detangled/1_foundation.nix b/nodes/1_lib/source/detangled/1_foundation.nix index 3a96182..78105b3 100644 --- a/nodes/1_lib/source/detangled/1_foundation.nix +++ b/nodes/1_lib/source/detangled/1_foundation.nix @@ -153,6 +153,18 @@ let __functionArgs = args; }; + # See https://github.com/NixOS/nix/issues/749. Eventually we'd like these + # to expand to Nix builtins that carry metadata so that Nix can filter out + # the INFO messages without parsing the message string. + # + # Usage: + # { + # foo = lib.warn "foo is deprecated" oldFoo; + # bar = lib.warnIf (bar == "") "Empty bar is deprecated" bar; + # } + # + # TODO: figure out a clever way to integrate location information from + # something like __unsafeGetAttrPos. /** Print a warning before returning the second argument. This function behaves like `builtins.trace`, but requires a string message and formats it as a diff --git a/nodes/1_lib/source/detangled/2_static.nix b/nodes/1_lib/source/detangled/2_static.nix new file mode 100644 index 0000000..825dd3c --- /dev/null +++ b/nodes/1_lib/source/detangled/2_static.nix @@ -0,0 +1,19 @@ +let # internal lib dependencies + foundation = import ./1_foundation.nix; +in + # e.g. the root of the node + foundation.loadStatic ../../. + # will end up being an object like this: + # { + # setup = { + # release = ""; + # sourceTypes = { ...}; + # licenses = { ... }; + # maintainers = [ ... ]; + # teams = { ... }; + # }; + # meta = { + # minNixVersion = "2.3"; + # generatedBy = ""; + # }; + # } \ No newline at end of file diff --git a/nodes/1_lib/source/detangled/2_fixed-points.nix b/nodes/1_lib/source/detangled/3_fixed-points.nix similarity index 100% rename from nodes/1_lib/source/detangled/2_fixed-points.nix rename to nodes/1_lib/source/detangled/3_fixed-points.nix