Modular, context-aware and aspect-oriented dendritic Nix configurations. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ den.oeiuwq.com
configurations den dendritic nix aspect oriented

fix include-less parametric in provides (#208)

Fix: https://github.com/vic/den/issues/207

Also added a test to catch this.

I hope this isn't just peppering over a deeper underlying issue.

authored by

musjj and committed by
GitHub
3d9be07e fb189d3e

+52 -5
+4 -2
nix/lib.nix
··· 13 13 aspect 14 14 // { 15 15 __functor = self: ctx: { 16 - includes = builtins.filter (x: x != { }) (map (apply ctx) (builtins.filter isFn self.includes)); 16 + includes = builtins.filter (x: x != { }) ( 17 + map (apply ctx) (builtins.filter isFn (self.includes or [ ])) 18 + ); 17 19 }; 18 20 }; 19 21 ··· 35 37 self: 36 38 { class, aspect-chain }: 37 39 { 38 - includes = map (applyStatics { inherit class aspect-chain; }) self.includes; 40 + includes = map (applyStatics { inherit class aspect-chain; }) (self.includes or [ ]); 39 41 }; 40 42 }; 41 43
+3 -3
templates/ci/flake.lock
··· 17 17 }, 18 18 "flake-aspects": { 19 19 "locked": { 20 - "lastModified": 1771395573, 21 - "narHash": "sha256-bcCOG2CW23/Eww/zULJf1xd0Shz2zS4c2AJWwLALyJ8=", 20 + "lastModified": 1772393050, 21 + "narHash": "sha256-lu8y40rGSps8U3ak0xhieLxSA4Dv/fJiPGkknjteEfk=", 22 22 "owner": "vic", 23 23 "repo": "flake-aspects", 24 - "rev": "8297f3bc41ad79b9f01d56d0dd92f7aac51bacfb", 24 + "rev": "d9502abaa6acc3a444b45a9df729d22f5ccff33c", 25 25 "type": "github" 26 26 }, 27 27 "original": {
+45
templates/ci/modules/features/provides-parametric.nix
··· 1 + { denTest, inputs, ... }: 2 + { 3 + 4 + flake.tests.provides-parametric = { 5 + 6 + test-parametric-inside-provides = denTest ( 7 + { 8 + den, 9 + ns, 10 + igloo, 11 + ... 12 + }: 13 + { 14 + den.hosts.x86_64-linux.igloo.users.tux = { }; 15 + 16 + imports = [ (inputs.den.namespace "ns" false) ]; 17 + 18 + ns.foo = den.lib.parametric { }; 19 + ns.bar.provides.baz = den.lib.parametric { }; 20 + ns.a = den.lib.parametric { 21 + provides.b = den.lib.parametric { }; 22 + provides.c = den.lib.parametric { }; 23 + provides.d = den.lib.parametric { 24 + provides.e = den.lib.parametric { nixos.networking.hostName = "pinguino"; }; 25 + }; 26 + }; 27 + 28 + den.aspects.igloo.includes = [ 29 + ns.foo 30 + ns.bar._.baz 31 + ns.a 32 + ns.a._.b 33 + ns.a._.c 34 + ns.a._.d 35 + ns.a._.d._.e 36 + ]; 37 + 38 + expr = igloo.networking.hostName; 39 + expected = "pinguino"; 40 + } 41 + ); 42 + 43 + }; 44 + 45 + }