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
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(bug): nested plain-attrs aspects are parametric (#312)

Fixes #311

authored by

Victor Borja and committed by
GitHub
5ab19d88 66fba202

+63 -9
+8 -8
Justfile
··· 15 15 docs: 16 16 cd docs && pnpm run dev 17 17 18 - ci test="": 19 - just nix-unit ci "{{test}}" 18 + ci test="" *args: 19 + just nix-unit ci "{{test}}" {{args}} 20 20 21 - bogus: 22 - just nix-unit bogus "" 21 + bogus *args: 22 + just nix-unit bogus "" {{args}} 23 23 24 - nix-unit template test: 25 - nix-unit --override-input den . --flake ./templates/{{template}}#.tests.systems.{{system}}.system-agnostic.{{test}} 24 + nix-unit template test *args: 25 + nix-unit --override-input den . --flake ./templates/{{template}}#.tests.systems.{{system}}.system-agnostic.{{test}} {{args}} 26 26 27 - check template: 28 - nix flake check --override-input den . ./templates/{{template}} 27 + check template *args: 28 + nix flake check --override-input den . ./templates/{{template}} {{args}} 29 29 30 30 update template: 31 31 nix flake update --flake ./templates/{{template}} den flake-aspects
+1
nix/lib/aspects.nix
··· 6 6 }: 7 7 let 8 8 fa-lib = inputs.flake-aspects.lib lib; 9 + # In Den all aspects are context forwarders 9 10 defaultFunctor = (den.lib.parametric { }).__functor; 10 11 typesConf = { inherit defaultFunctor; }; 11 12 types = lib.mapAttrs (n: v: v typesConf) fa-lib.types;
+15 -1
nix/lib/parametric.nix
··· 3 3 inherit (den.lib) take functor; 4 4 inherit (den.lib.statics) owned statics isCtxStatic; 5 5 6 + fixedRecurse = 7 + ctx: provided: 8 + provided 9 + // { 10 + includes = map (include: if include ? includes then parametric.fixedTo ctx include else include) ( 11 + provided.includes or [ ] 12 + ); 13 + }; 14 + 6 15 parametric.atLeast = functor (lib.flip take.atLeast); 16 + 7 17 parametric.exactly = functor (lib.flip take.exactly); 18 + 8 19 parametric.expands = 9 20 attrs: parametric.withOwn (aspect: ctx: parametric.atLeast aspect (ctx // attrs)); 21 + 10 22 parametric.fixedTo = 11 23 attrs: aspect: 12 24 aspect ··· 18 30 includes = [ 19 31 (owned self) 20 32 (statics self { inherit class aspect-chain; }) 21 - (parametric.atLeast self attrs) 33 + (fixedRecurse attrs (parametric.atLeast self attrs)) 22 34 ]; 23 35 }; 24 36 }; 37 + 25 38 parametric.withOwn = 26 39 functor: aspect: 27 40 aspect ··· 37 50 [ (functor self ctx) ]; 38 51 }; 39 52 }; 53 + 40 54 parametric.__functor = _: parametric.withOwn parametric.atLeast; 41 55 in 42 56 parametric
+39
templates/ci/modules/features/deadbugs/issue-311-nested-includes-are-parametric.nix
··· 1 + { denTest, ... }: 2 + { 3 + flake.tests.deadbugs-issue-311 = { 4 + 5 + test-nested-includes-are-parametric = denTest ( 6 + { 7 + den, 8 + lib, 9 + tuxHm, 10 + ... 11 + }: 12 + { 13 + den.hosts.x86_64-linux.igloo.users.tux = { }; 14 + 15 + den.aspects.tux.includes = [ 16 + ( 17 + { host, ... }: 18 + { 19 + homeManager.home.keyboard.model = lib.mkDefault "${host.name}-nested"; 20 + includes = [ 21 + ( 22 + { user, ... }: 23 + { 24 + homeManager.home.keyboard.model = lib.mkForce "${user.name}-nested"; 25 + } 26 + ) 27 + ]; 28 + } 29 + ) 30 + ]; 31 + 32 + expr = tuxHm.home.keyboard.model; 33 + expected = "tux-nested"; 34 + } 35 + ); 36 + 37 + }; 38 + 39 + }