Skip to content

Schema

Each of host, user, home configuration objects have freeform-types, meaning you can assign any attribute into them as meta-data.

However, at times you might want to have shared meta-data between all hosts or all users.

The base modules, den.schema.* serve for this purpose. They are not aspects, they are meta-data (the attributes of host) that aspects can later read for providing configuration.

For example, instead of:

den.hosts.x86_64-linux.igloo = {
hardened = true; # custom free-form metadata
# repetitive
users.alice.classes = [ "homeManager" ];
users.bob.classes = [ "homeManager" ];
};

You can do:

# This is not an aspect, it is a meta-configuration of the host capabilities.
den.schema.host = { host, lib, ... }: {
options.hardened = lib.mkEnableOption "Is it secure";
config.hardened = lib.mkDefault true;
};
# The meta-configuration module for all users
den.schema.user = { user, lib, ... }: {
config.classes = lib.mkDefault [ "homeManager" ];
};

All hosts you create will be hardened = true by default. And aspects will be able to read host.hardened value.

Base modules merged into all hosts, users, or homes.

OptionTypeDescription
den.schema.confdeferredModuleApplied to host, user, and home
den.schema.hostdeferredModuleApplied to all hosts (imports conf)
den.schema.userdeferredModuleApplied to all users (imports conf)
den.schema.homedeferredModuleApplied to all homes (imports conf)
den.schema.conf = { lib, ... }: {
# shared across all host/user/home declarations
};
den.schema.host = { ... }: {
# host-specific base config
};

Type: attrsOf systemType

Keyed by system string (e.g., "x86_64-linux"). Each system contains host definitions as freeform attribute sets.

den.hosts.x86_64-linux.myhost = {
users.vic = {};
};
OptionTypeDefaultDescription
namestrattr nameConfiguration name
hostNamestrnameNetwork hostname
systemstrparent keyPlatform (e.g., x86_64-linux)
classstrauto"nixos" or "darwin" based on system
aspectstrnameMain aspect name for this host
descriptionstrautoclass.hostName@system
usersattrsOf userType{}User accounts on this host
instantiaterawautoOS builder function
intoAttrlistOf strautoFlake output path
*den.schema.host optionsOptions from base module
*free-form attributes
ClassDefault
nixosinputs.nixpkgs.lib.nixosSystem
darwininputs.darwin.lib.darwinSystem
systemManagerinputs.system-manager.lib.makeSystemConfig
ClassDefault
nixos[ "nixosConfigurations" name ]
darwin[ "darwinConfigurations" name ]
systemManager[ "systemConfigs" name ]

Type: attrsOf userType

OptionTypeDefaultDescription
namestrattr nameUser configuration name
userNamestrnameSystem account name
classeslistOf str[ "homeManager" ]Home management classes
aspectstrnameMain aspect name
*den.schema.user optionsOptions from base module
*free-form attributes

Freeform: additional attributes pass through to the user module.

Type: attrsOf homeSystemType

Standalone home-manager configurations, keyed by system string.

den.homes.x86_64-linux.vic = {};
OptionTypeDefaultDescription
namestrattr nameHome configuration name
userNamestrnameUser account name
systemstrparent keyPlatform system
classstr"homeManager"Home management class
aspectstrnameMain aspect name
descriptionstrautohome.userName@system
pkgsrawinputs.nixpkgs.legacyPackages.$sysNixpkgs instance
instantiaterawinputs.home-manager.lib.homeManagerConfigurationBuilder
intoAttrlistOf str[ "homeConfigurations" name ]Output path
*den.schema.home optionsOptions from base module
*free-form attributes
Contribute Community Sponsor