### Utilize Denful Library Functions in Configurations Source: https://context7.com/vic/denful/llms.txt This snippet illustrates how to use utility functions provided by `denful.lib` within your Nix configurations. It shows an example of using a built-in function `dup` and how to extend the library with custom functions like `triple` and `greet`. ```nix # modules/example.nix { denful, ... }: { # Use the built-in dup function config.someOption = denful.lib.dup 21; # Returns 42 # Extend the library with custom functions config.denful.lib = { triple = x: x * 3; greet = name: "Hello, ${name}!"; }; } ``` -------------------------------- ### Configure Denful Options Namespace in NixOS Modules Source: https://context7.com/vic/denful/llms.txt This example demonstrates how to configure Denful's freeform `denful` option namespace within a NixOS module. It shows how to set application-specific configurations like `enable`, `port`, and `settings`, and how to use these configurations in other services. ```nix # modules/my-config.nix { lib, config, denful, ... }: { # Access the denful configuration namespace config.denful.myApp = { enable = true; port = 8080; settings = { debug = false; logLevel = "info"; }; }; # Use denful config from module args services.myApp = lib.mkIf denful.myApp.enable { inherit (denful.myApp) port; }; } ``` -------------------------------- ### Automatic Host Module Import with import-tree Source: https://context7.com/vic/denful/llms.txt This example demonstrates Denful's `import-tree` facet for automatically importing NixOS/Darwin modules based on directory structure. It configures the `vix.aspects.import-tree.provides.hosts` to point to a `hosts` directory, where subdirectories like `my-desktop` and `my-macbook` contain `_nixos` or `_darwin` subdirectories with modules. ```nix # modules/hosts/default.nix { denful, inputs, ... }: { imports = [ denful.vix.facet ]; # Configure the hosts aspect with your hosts directory vix.aspects.import-tree.provides.hosts = { hostsPath = ./hosts; }; } # Directory structure: # modules/hosts/ # my-desktop/ # _nixos/ # hardware.nix # Auto-imported for nixos class # services.nix # my-macbook/ # _darwin/ # homebrew.nix # Auto-imported for darwin class # defaults.nix ``` -------------------------------- ### Define a Facet for Niri Window Manager in Denful Source: https://context7.com/vic/denful/llms.txt This example defines a reusable 'facet' for the Niri window manager. It specifies contributions to the `flake` and `nixos` module classes, including flake inputs, cachix configuration, and NixOS module imports. It also demonstrates aspect composition by including the `anarchy` aspect. ```nix # facets/niri.nix { inputs, lib, ... }: { flake.aspects.niri = { aspects, ... }: { description = '' Niri: a scrollable-tiling WM (https://github.com/YaLTeR/niri) Configured via https://github.com/sodiboo/niri-flake. ''; # Flake-level contributions: inputs and caches flake = { flake-file.inputs.niri-flake = { url = lib.mkDefault "github:sodiboo/niri-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; flake-file.nixConfig = { extra-substituters = [ "https://niri.cachix.org" ]; extra-trusted-public-keys = [ "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964=" ]; }; # Compose with other aspects flake.aspects.anarchy = { includes = [ aspects.niri ]; }; }; # NixOS-level contributions nixos = { imports = [ inputs.niri-flake.nixosModules.niri ]; }; }; } ``` -------------------------------- ### Import Denful Modules in flake.nix Source: https://context7.com/vic/denful/llms.txt Demonstrates how to import specific Denful modules directly within a flake.nix file. This method is useful for incorporating individual functionalities like Niri or base NixOS configurations. ```nix { inputs, ... }: { imports = [ # Import specific class modules directly inputs.denful.modules.flake.niri inputs.denful.modules.nixos.base ]; # Or use aspects for the same functionality flake.aspects.my-config = { aspects, ... }: { includes = [ aspects.niri ]; }; } ``` -------------------------------- ### Compose Facets in Dendritic Configurations Source: https://context7.com/vic/denful/llms.txt This snippet shows how to import and compose facets within your Dendritic modules. It imports the `niri` facet from Denful and defines a custom `my-laptop` aspect that includes the `anarchy` aspect (which in turn includes `niri`), adding laptop-specific NixOS configurations. ```nix # modules/my-laptop.nix { inputs, ... }: { # Import the niri facet from denful imports = [ inputs.denful.modules.flake.niri ]; # Define a custom aspect that includes other aspects flake.aspects.my-laptop = { aspects, ... }: { description = "My personal laptop configuration"; # Include all features from the anarchy aspect (which includes niri) includes = [ aspects.anarchy ]; # Add laptop-specific nixos configuration nixos = { services.tlp.enable = true; hardware.bluetooth.enable = true; }; }; } ``` -------------------------------- ### Import Denful Flake Module in flake.nix Source: https://context7.com/vic/denful/llms.txt This snippet shows how to import the Denful flake module into your flake.nix file. It defines the necessary inputs, including nixpkgs, flake-parts, and denful, and then uses flake-parts to set up the flake, importing Denful's flakeModule. ```nix # flake.nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; denful.url = "github:vic/denful"; }; outputs = inputs@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ inputs.denful.flakeModule ]; systems = [ "x86_64-linux" "aarch64-darwin" ]; }; } ``` -------------------------------- ### Use Niri Facet in Dendritic Module Source: https://github.com/vic/denful/blob/main/README.md This Nix code demonstrates how to use the 'niri' facet within a Dendritic module. It imports the facet and then includes the 'anarchy' aspect, which is defined within the 'niri' facet, to configure the 'my-laptop' aspect. ```nix { inputs, ... }: { imports = [ inputs.denful.modules.flake.niri ]; flake.aspects.my-laptop = {aspects, ...}: { # features of all facets that contribute to the anarchy aspect includes = [ aspects.anarchy ]; }; } ``` -------------------------------- ### Define Niri Facet for Dendritic Nix Configuration Source: https://github.com/vic/denful/blob/main/README.md This Nix code defines a 'facet' named 'niri' for use with Dendritic and flake.parts. It configures the Niri window manager by specifying its flake input, Nix configuration for cachix, and integrating with the 'anarchy' aspect. It also includes the necessary NixOS module for the Niri aspect. ```nix # facets/niri.nix { inputs, lib, ... }: { flake.aspects.niri = { aspects, ... }: { description = '' Niri: a scrollable-tiling WM (https://github.com/YaLTeR/niri) Configured via https://github.com/sodiboo/niri-flake. ''; # the `flake` class module contributes to your flake, # for example by adding inputs or caches via `github:vic/flake-file`. flake = { flake-file.inputs.niri-flake = { url = lib.mkDefault "github:sodiboo/niri-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; flake-file.nixConfig = { extra-substituters = [ "https://niri.cachix.org" ]; extra-trusted-public-keys = [ "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964=" ]; }; # it can also import aditional flake modules. # flake-file.inputs.foo-dep.url = "..."; # imports = [ inputs.foo-dep.flakeModule ]; # or define/enhance another aspect: anarchy is our omarchy like aspect. flake.aspects.anarchy = { includes = [ aspects.niri ]; }; }; # the nixos class enhances os-level stuff for the `niri` aspect. nixos = { imports = [ inputs.niri-flake.nixosModules.niri ]; }; }; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.