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(ctx): should not use hm from host when no-bidir enabled. (#293)

cc @Sharparam, offending line was:
https://github.com/vic/den/pull/293/changes#diff-a008f96c95a197db435b512a966b1b8a2038e6da23230fddd6184e120aa22b15L75

Fixes #292.

authored by

Victor Borja and committed by
GitHub
d68155ea e867b825

+106 -15
+1
modules/context/user.nix
··· 76 76 77 77 from-user = { host, user }: fixedTo { inherit host user; } den.aspects.${user.aspect}; 78 78 from-host = { host, user }: atLeast den.aspects.${host.aspect} { inherit host user; }; 79 + 79 80 in 80 81 { 81 82 den.ctx = ctx;
-1
nix/lib/home-env.nix
··· 72 72 includes = [ 73 73 (den.ctx."${ctxName}-user" { inherit host user; }) 74 74 (den.ctx.user { inherit host user; }) 75 - (den.lib.parametric.fixedTo { inherit host user; } den.aspects.${host.aspect}) 76 75 ]; 77 76 }; 78 77
+1
templates/ci/modules/features/conditional-config.nix
··· 69 69 pingu = { }; 70 70 }; 71 71 den.default.homeManager.home.stateVersion = "25.11"; 72 + den.ctx.user.includes = [ den._.bidirectional ]; 72 73 den.aspects.igloo.includes = [ git-for-linux-only ]; 73 74 74 75 expr = [
+27
templates/ci/modules/features/deadbugs/issue-292-hm-used-when-no-bidir-enabled.nix
··· 1 + { denTest, ... }: 2 + { 3 + flake.tests.deadbugs-issue-292 = { 4 + 5 + test-should-not-read-from-host-without-bidirectionality = denTest ( 6 + { 7 + den, 8 + lib, 9 + igloo, # igloo = nixosConfigurations.igloo.config 10 + tuxHm, # tuxHm = igloo.home-manager.users.tux 11 + ... 12 + }: 13 + { 14 + den.hosts.x86_64-linux.igloo.users.tux = { }; 15 + 16 + den.aspects.igloo.includes = [ den.aspects.bash ]; 17 + den.aspects.tux.includes = [ den.aspects.bash ]; 18 + 19 + den.aspects.bash.homeManager.programs.bash.historyIgnore = [ "foo" ]; 20 + 21 + expr = tuxHm.programs.bash.historyIgnore; 22 + expected = [ "foo" ]; 23 + } 24 + ); 25 + 26 + }; 27 + }
+1
templates/ci/modules/features/perUser-perHost.nix
··· 85 85 }; 86 86 87 87 den.aspects.igloo.includes = [ 88 + 88 89 (den.lib.perHost { nixos.funny = [ "atHost perHost static" ]; }) 89 90 (den.lib.perHost ( 90 91 { host }:
+76 -14
templates/ci/modules/features/user-host-bidirectional-config.nix
··· 2 2 { 3 3 flake.tests.user-host-bidirectional-config = { 4 4 5 - test-host-owned-configures-all-users = denTest ( 5 + test-host-owned-unidirectional = denTest ( 6 6 { 7 7 den, 8 8 tuxHm, ··· 10 10 ... 11 11 }: 12 12 { 13 - den.default.homeManager.home.stateVersion = "25.11"; 13 + den.hosts.x86_64-linux.igloo.users = { 14 + tux = { }; 15 + pingu = { }; 16 + }; 17 + 18 + # no bidirectionality enabled, this is ignored 19 + den.aspects.igloo.homeManager.programs.direnv.enable = true; 20 + 21 + expr = [ 22 + tuxHm.programs.direnv.enable 23 + pinguHm.programs.direnv.enable 24 + ]; 25 + expected = [ 26 + false 27 + false 28 + ]; 29 + } 30 + ); 14 31 32 + test-host-owned-bidirectional = denTest ( 33 + { 34 + den, 35 + tuxHm, 36 + pinguHm, 37 + ... 38 + }: 39 + { 15 40 den.hosts.x86_64-linux.igloo.users = { 16 41 tux = { }; 17 42 pingu = { }; 18 43 }; 19 44 45 + den.ctx.user.includes = [ den._.bidirectional ]; 20 46 den.aspects.igloo.homeManager.programs.direnv.enable = true; 21 47 22 48 expr = [ ··· 24 50 pinguHm.programs.direnv.enable 25 51 ]; 26 52 expected = [ 27 - true 28 - true 53 + false 54 + false 29 55 ]; 30 56 } 31 57 ); 32 58 33 - test-host-static-configures-all-users = denTest ( 59 + test-host-bidirectional-static-includes-configures-all-users = denTest ( 34 60 { 35 61 den, 36 62 tuxHm, ··· 38 64 ... 39 65 }: 40 66 { 41 - den.default.homeManager.home.stateVersion = "25.11"; 42 - 43 67 den.hosts.x86_64-linux.igloo.users = { 44 68 tux = { }; 45 69 pingu = { }; 46 70 }; 71 + 72 + den.ctx.user.includes = [ den._.bidirectional ]; 47 73 48 74 den.aspects.igloo.includes = [ 49 75 { 76 + homeManager.programs.direnv.enable = throw "unreachable, static includes wont be used by bidirectionality"; 77 + } 78 + # This is the way, walk in it: 79 + (den.lib.perUser { 50 80 homeManager.programs.direnv.enable = true; 51 - } 81 + }) 52 82 ]; 53 83 54 84 expr = [ ··· 62 92 } 63 93 ); 64 94 65 - test-host-parametric-configures-all-users = denTest ( 95 + test-host-parametric-unidirectional = denTest ( 96 + { 97 + den, 98 + tuxHm, 99 + pinguHm, 100 + ... 101 + }: 102 + { 103 + 104 + den.hosts.x86_64-linux.igloo.users = { 105 + tux = { }; 106 + pingu = { }; 107 + }; 108 + 109 + den.aspects.igloo.includes = [ 110 + ( 111 + { host, user }: 112 + { 113 + homeManager.programs.direnv.enable = true; 114 + } 115 + ) 116 + ]; 117 + 118 + expr = [ 119 + tuxHm.programs.direnv.enable 120 + pinguHm.programs.direnv.enable 121 + ]; 122 + expected = [ 123 + false 124 + false 125 + ]; 126 + } 127 + ); 128 + 129 + test-host-parametric-bidirectional = denTest ( 66 130 { 67 131 den, 68 132 tuxHm, ··· 70 134 ... 71 135 }: 72 136 { 73 - den.default.homeManager.home.stateVersion = "25.11"; 74 137 75 138 den.hosts.x86_64-linux.igloo.users = { 76 139 tux = { }; 77 140 pingu = { }; 78 141 }; 142 + 143 + den.ctx.user.includes = [ den._.bidirectional ]; 79 144 80 145 den.aspects.igloo.includes = [ 81 146 ( ··· 105 170 ... 106 171 }: 107 172 { 108 - den.default.homeManager.home.stateVersion = "25.11"; 109 173 110 174 den.hosts.x86_64-linux.igloo.users.tux = { }; 111 175 den.hosts.x86_64-linux.iceberg.users.tux = { }; ··· 123 187 } 124 188 ); 125 189 126 - test-user-static-configures-all-hosts = denTest ( 190 + test-user-static-unidirectional-configures-all-hosts = denTest ( 127 191 { 128 192 den, 129 193 igloo, ··· 131 195 ... 132 196 }: 133 197 { 134 - den.default.homeManager.home.stateVersion = "25.11"; 135 198 136 199 den.hosts.x86_64-linux.igloo.users.tux = { }; 137 200 den.hosts.x86_64-linux.iceberg.users.tux = { }; ··· 161 224 ... 162 225 }: 163 226 { 164 - den.default.homeManager.home.stateVersion = "25.11"; 165 227 166 228 den.hosts.x86_64-linux.igloo.users.tux = { }; 167 229 den.hosts.x86_64-linux.iceberg.users.tux = { };