Share with Namespaces
import { Aside } from ‘@astrojs/starlight/components’;
What Are Namespaces?
Section titled “What Are Namespaces?”Namespaces let you organize aspects into named collections that can be shared across flakes and consumed by others.
Define a Local Namespace
Section titled “Define a Local Namespace”{ inputs, ... }: { imports = [ (inputs.den.namespace "ns" false) ]; ns.tools.nixos.programs.vim.enable = true;}The second argument controls output:
false— local only, not exposed as flake outputtrue— exposed atflake.denful.ns- A list of sources — merge from external inputs
Consume Remote Namespaces
Section titled “Consume Remote Namespaces”Import aspects from another flake’s denful output:
{ inputs, ... }: { imports = [ (inputs.den.namespace "provider" [ true inputs.other-flake ]) ];
den.aspects.igloo.includes = [ provider.tools._.editors ];}Multiple sources are merged. Local definitions override remote ones.
Nested Provides in Namespaces
Section titled “Nested Provides in Namespaces”Namespaces support the full aspect tree with provides:
ns.root.provides.branch.provides.leaf.nixos.truth = true;# access via:ns.root._.branch._.leafExpose as Flake Output
Section titled “Expose as Flake Output”When the second argument is true (or a list containing true),
the namespace appears at config.flake.denful.<name>:
imports = [ (inputs.den.namespace "ns" true) ];ns.foo.nixos.truth = true;# available at config.flake.denful.nsOther flakes can then consume it:
inputs.your-flake.denful.nsMerge Multiple Sources
Section titled “Merge Multiple Sources”Combine local, remote, and output in one namespace:
imports = [ (inputs.den.namespace "ns" [ inputs.sourceA inputs.sourceB true # also expose as output ])];
ns.gear.nixos.data = [ "local" ];# merges with sourceA and sourceB's denful.ns.gearUse with Angle Brackets
Section titled “Use with Angle Brackets”When __findFile is in scope, namespace aspects are accessible via
angle brackets:
{ __findFile, ns, ... }: { _module.args.__findFile = den.lib.__findFile; den.aspects.igloo.includes = [ <ns/tools> ];}Real-World: denful
Section titled “Real-World: denful”denful is a community aspect distribution built on Den namespaces — a lazyvim-like approach to Nix configurations.