···129129130130## User contributed examples
131131132132+#### Example: Config across `nixos` and `darwin` classes.
133133+134134+The `os` forward class ([provided by Den](https://github.com/vic/den/blob/main/modules/aspects/provides/os-class.nix)) can be useful for settings that must be forwarded to both on NixOS and MacOS.
135135+136136+> Requested by @Risa-G at [#222](https://github.com/vic/den/discussions/222)
137137+138138+```nix
139139+# Note: this is already provided by Den at provides/os-class.nix
140140+os-class = { class, aspect-chain }: den._.forward {
141141+ each = [ "nixos" "darwin" ];
142142+ fromClass = _: "os";
143143+ intoClass = lib.id;
144144+ intoPath = _: [ ]; # top-level
145145+ fromAspect = _: lib.head aspect-chain;
146146+};
147147+148148+# Note: already enabled by Den
149149+# den.ctx.host.includes = [ os-class ];
150150+151151+den.aspects.my-laptop = {
152152+ os.networking.hostName = "Yavanna"; # on both NixOS and MacOS
153153+};
154154+```
155155+132156#### Example: A git class that forwards to home-manager.
133157134158```nix
···178202179203# included at users who can fix things with nix.
180204den.aspects.tux.includes = [ nix-allowed ];
181181-```
182182-183183-#### Example: An `os` class forwarding to NixOS and nix-Darwin
184184-185185-This forward class can be useful for settings that are common to both
186186-`nixos` and `darwin` classes.
187187-188188-```nix
189189-os-class = { host }: { class, aspect-chain }: den._.forward {
190190- each = lib.singleton true;
191191- fromClass = _: "os";
192192- intoClass = _: host.class;
193193- intoPath = _: [ ]; # Forward at Top-Level
194194- fromAspect = lib.head aspect-chain;
195195- adaptArgs = lib.id;
196196-};
197197-198198-199199-# enable on all hosts
200200-den.ctx.host.includes = [ os-class ];
201201-202202-# usage
203203-den.aspects.my-laptop = {
204204- nixos = {}; # nixos specific options
205205- darwin = {}; # darwin specific options
206206-207207- # both on nixos and darwin
208208- os = { pkgs, ... }: {
209209- environment.packages = [ pkgs.hello ];
210210- };
211211-};
212205```
213206214207#### Example: An impermanence class