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

fix: inputs' and self' exactly arguments (#122)

Closes #121

Nicely done, Heitor. Thanks :)

authored by

Heitor Augusto and committed by
GitHub
9e5bb4be d114d8b8

+76 -24
+38 -12
modules/aspects/provides/inputs.nix
··· 1 1 { den, withSystem, ... }: 2 2 { 3 - den.provides.inputs' = den.lib.parametric { 3 + den.provides.inputs' = den.lib.parametric.exactly { 4 4 description = '' 5 5 Provides the `flake-parts` `inputs'` (the flake's `inputs` with system pre-selected) 6 6 as a top-level module argument. ··· 21 21 den.aspects.my-laptop.includes = [ den._.inputs' ]; 22 22 den.aspects.alice.includes = [ den._.inputs' ]; 23 23 24 - **Note:** If specified in a user aspect (e.g., `alice`) that is integrated into a host (not standalone), 25 - `inputs'` will be available to **both** the user's Home Manager configuration and the **Host's** configuration. 24 + **Note:** This aspect is contextual. When included in a `host` aspect, it 25 + configures `inputs'` for the host's OS. When included in a `user` or `home` 26 + aspect, it configures `inputs'` for the corresponding Home Manager configuration. 26 27 ''; 27 28 28 29 includes = [ 29 30 ( 30 - { host, user, ... }: 31 - (withSystem host.system ( 31 + { OS, host }: 32 + let 33 + unused = den.lib.take.unused OS; 34 + in 35 + withSystem host.system ( 32 36 { inputs', ... }: 33 37 { 34 - ${host.class}._module.args.inputs' = inputs'; 35 - ${user.class or null}._module.args.inputs' = inputs'; 38 + ${host.class}._module.args.inputs' = unused inputs'; 36 39 } 37 - )) 40 + ) 38 41 ) 39 42 ( 40 - { home, ... }: 41 - (withSystem home.system ( 43 + { 44 + OS, 45 + HM, 46 + user, 47 + host, 48 + }: 49 + let 50 + unused = den.lib.take.unused [ 51 + OS 52 + HM 53 + ]; 54 + in 55 + withSystem host.system ( 42 56 { inputs', ... }: 43 57 { 44 - ${home.class}._module.args.inputs' = inputs'; 58 + ${user.class}._module.args.inputs' = unused inputs'; 59 + } 60 + ) 61 + ) 62 + ( 63 + { HM, home }: 64 + let 65 + unused = den.lib.take.unused HM; 66 + in 67 + withSystem home.system ( 68 + { inputs', ... }: 69 + { 70 + ${home.class}._module.args.inputs' = unused inputs'; 45 71 } 46 - )) 72 + ) 47 73 ) 48 74 ]; 49 75 };
+38 -12
modules/aspects/provides/self.nix
··· 1 1 { den, withSystem, ... }: 2 2 { 3 - den.provides.self' = den.lib.parametric { 3 + den.provides.self' = den.lib.parametric.exactly { 4 4 description = '' 5 5 Provides the `flake-parts` `self'` (the flake's `self` with system pre-selected) 6 6 as a top-level module argument. ··· 21 21 den.aspects.my-laptop.includes = [ den._.self' ]; 22 22 den.aspects.alice.includes = [ den._.self' ]; 23 23 24 - **Note:** If specified in a user aspect (e.g., `alice`) that is integrated into a host (not standalone), 25 - `self'` will be available to **both** the user's Home Manager configuration and the **Host's** configuration. 24 + **Note:** This aspect is contextual. When included in a `host` aspect, it 25 + configures `self'` for the host's OS. When included in a `user` or `home` 26 + aspect, it configures `self'` for the corresponding Home Manager configuration. 26 27 ''; 27 28 28 29 includes = [ 29 30 ( 30 - { host, user, ... }: 31 - (withSystem host.system ( 31 + { OS, host }: 32 + let 33 + unused = den.lib.take.unused OS; 34 + in 35 + withSystem host.system ( 32 36 { self', ... }: 33 37 { 34 - ${host.class}._module.args.self' = self'; 35 - ${user.class or null}._module.args.self' = self'; 38 + ${host.class}._module.args.self' = unused self'; 36 39 } 37 - )) 40 + ) 38 41 ) 39 42 ( 40 - { home, ... }: 41 - (withSystem home.system ( 43 + { 44 + OS, 45 + HM, 46 + user, 47 + host, 48 + }: 49 + let 50 + unused = den.lib.take.unused [ 51 + OS 52 + HM 53 + ]; 54 + in 55 + withSystem host.system ( 42 56 { self', ... }: 43 57 { 44 - ${home.class}._module.args.self' = self'; 58 + ${user.class}._module.args.self' = unused self'; 59 + } 60 + ) 61 + ) 62 + ( 63 + { HM, home }: 64 + let 65 + unused = den.lib.take.unused HM; 66 + in 67 + withSystem home.system ( 68 + { self', ... }: 69 + { 70 + ${home.class}._module.args.self' = unused self'; 45 71 } 46 - )) 72 + ) 47 73 ) 48 74 ]; 49 75 };