The goal of Nixy is simple: make large or multi-node configurations easier to structure, reason about, and maintain.
Schema defines typed configuration options and their defaults.
Traits are reusable behavior modules. But traits are not conditional logic systems.
Instead, they act as structural switches that determine which configuration modules are included in the final result.
Nodes represent final configuration targets. Each node selects a set of traits and overrides parts of the schema.
From this, Nixy produces a standard Nix module that can be used with tools like lib.nixosSystem.
Nixy introduces a small amount of structure to help manage this complexity while remaining fully compatible with the Nix ecosystem.
Example Usage
A minimal example where schema, traits, and nodes are defined.
# flake.nix
{
description = "nixy example";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixy.url = "github:cuskiy/nixy";
};
outputs = { self, nixpkgs, nixy, ... }@inputs:
let
lib = nixpkgs.lib;
cluster = nixy.eval {
inherit lib;
imports = [
# Automatically import all .nix files in the folder.
./traits
./nodes
];
args = { inherit inputs; };
};
in {
nixosConfigurations =
lib.mapAttrs (_: node:
lib.nixosSystem {
system = node.schema.base.system;
modules = [ node.module ];
}
) cluster.nodes;
};
}
# traits/test.nix
{ schema, mkStr, mkPort, ... }:
{
schema = {
base = {
system = mkStr "x86_64-linux";
hostname = mkStr "node";
stateVersion = mkStr "26.05";
};
ssh = {
port = mkPort 22;
};
};
traits = {
base = { schema, ... }: {
networking.hostName = schema.base.hostname;
system.stateVersion = schema.base.stateVersion;
};
ssh = { schema, ... }: {
services.openssh.enable = true;
services.openssh.ports = [ schema.ssh.port ];
};
};
}
# nodes/nodes.nix
{
nodes = {
server = {
traits = [ "base" "ssh" ];
schema = {
base.hostname = "server";
ssh.port = 2222;
};
};
laptop = {
includes = [
# ../platform/foo.nix
];
traits = [ "base" ];
schema.base.hostname = "laptop";
};
};
}
Compared to Dendritic
Dendritic is another configuration framework built on top of Nix modules.
Nixy focuses on only three core concepts:
-
schema
-
traits
-
nodes
The model is intentionally minimal and easy to understand.
Nixy avoids introducing complex orchestration or additional runtime logic. Try to help users reduce the amount of code as much as possible without affecting flexibility.
Nodes, serving as the final entry point, improve the clarity of the configuration.
Disadvantages of Nixy
Dendritic provides more predefined patterns for organizing infrastructure.
Nixy leaves more decisions to the user.
Summary
Nixy aims to provide a clean and minimal structure for organizing complex Nix configurations.