Skip to content

Share with Namespaces

import { Aside } from ‘@astrojs/starlight/components’;

Namespaces let you organize aspects into named collections that can be shared across flakes and consumed by others.

{ 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 output
  • true — exposed at flake.denful.ns
  • A list of sources — merge from external inputs

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.

Namespaces support the full aspect tree with provides:

ns.root.provides.branch.provides.leaf.nixos.truth = true;
# access via:
ns.root._.branch._.leaf

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.ns

Other flakes can then consume it:

inputs.your-flake.denful.ns

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.gear

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> ];
}

denful is a community aspect distribution built on Den namespaces — a lazyvim-like approach to Nix configurations.