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

Improve comment on how to avoid duplication from default.includes. (#74)

authored by oeiuwq.com and committed by

GitHub 374ad5fb 1ffbe4b4

+22 -17
+22 -17
templates/default/modules/den.nix
··· 61 61 }; 62 62 }; 63 63 64 - # This one can be included on igloo host to make USB/VM installers. 64 + # This one can be included on a host to make USB/VM installers. 65 65 vm-bootable = 66 - { host, ... }: 66 + { ... }: 67 67 { 68 68 nixos = 69 69 { modulesPath, ... }: 70 70 { 71 - networking.hostName = host.hostName; 72 71 imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-graphical-base.nix") ]; 73 72 }; 74 73 }; 75 74 }; 76 75 77 - den.aspects.igloo.includes = 78 - let 79 - # an small parametric aspect that needs access to contextual host data. 80 - hostname = 81 - { host, ... }: 82 - { 83 - nixos.networking.hostName = host.name; 84 - }; 85 - in 86 - [ 87 - hostname 88 - den.aspects.common._.vm-bootable 89 - den.aspects.common._.xfce-desktop 90 - ]; 76 + den.aspects.igloo.includes = [ 77 + den.aspects.common._.vm-bootable 78 + den.aspects.common._.xfce-desktop 79 + ]; 91 80 92 81 # NixOS configuration for igloo. 93 82 den.aspects.igloo.nixos = ··· 144 133 145 134 # Disable booting when running on CI on all NixOS hosts. 146 135 (if config ? _module.args.CI then den.aspects.ci-no-boot else { }) 136 + 137 + # NOTE: be cautious when adding fully parametric functions to defaults. 138 + # defaults are included on EVERY host/user/home, and IF you are not careful 139 + # you could be duplicating config values. For example: 140 + # 141 + # # This will append 42 into foo option for the {host} and for EVERY {host,user} 142 + # ({ host, ... }: { nixos.foo = [ 42 ]; }) # DO-NOT-DO-THIS. 143 + # 144 + # # Instead try to be explicit if a function is intended for ONLY { host }. 145 + (den.lib.take.exactly ( 146 + { host }: 147 + { 148 + nixos.networking.hostName = host.hostName; 149 + } 150 + )) 151 + 147 152 ]; 148 153 149 154 den.aspects.ci-no-boot = {