Skip to content

Std Library Reference

std.lib holds the target builders: they turn sinks into real flake outputs and NixOS modules. Each builder takes SinkRefs (from = yen.kinds.host.sinks.nixos), never sink names as strings. The arguments come from the function itself. An argument with ? has a default. The description is the #: line above the definition, and each name links to that line. For worked examples, see Machines & Targets and Resource Protocol.

Builder Arguments Description
std.lib.mkSystem builder, extraArgs?, from, output?, pkgs?, system? Build one OS configuration per scope from the modules of the from sink, at <output>.<scope.name>.
std.lib.nixos see description Build nixosConfigurations.<name> from the from sink. Takes the std.lib.mkSystem arguments.
std.lib.darwin see description Build darwinConfigurations.<name> from the from sink. Takes the std.lib.mkSystem arguments.
std.lib.homeManager builder, extraArgs?, from, output?, pkgs, system? Build standalone homeConfigurations.<name> from the from sink with a per-system pkgs.
std.lib.hmIntoHost from Import the modules of a user sink into home-manager.users.<user> of the host.
std.lib.microvmGuest from Import the nixos modules of a guest into microvm.vms.<guest>.config of its parent host.
std.lib.terranix builder, from, output?, pkgs, system? Build terraformConfigurations.<name> from the from sink with Terranix.
std.lib.k8s builder, from, output?, pkgs, system? Build k8sConfigurations.<name> from the from sink with a Kubernetes builder such as nixidy.
std.lib.nvf builder, from, output?, pkgName?, pkgs, system? Build a Neovim package at <output>.<system>.<pkgName> from the from sink with NVF or Nixvim.
std.lib.deployRs activate, configurations, hostname?, sshUser? Make deploy.nodes for deploy-rs from built configurations, with one system profile each.
std.lib.colmena from, nixpkgs, nodeSpecialArgs? Make one colmena node per scope from the from sink, with meta.nixpkgs set.
std.lib.perSystem see description Map a list of systems (refs or names) to an attrset keyed by system name: perSystem systems (name: sys: ...).
std.lib.firewallModule from Collect { tcp; udp; } rules from the from sink into networking.firewall ports.
std.lib.persistModule from, root? Collect paths or { directories; files; } from the from sink into environment.persistence.<root>.
std.lib.nixpkgsModule insecureFrom?, overlaysFrom?, respectGlobalPkgs?, unfreeFrom? Collect unfree, insecure, and overlays sinks into one nixpkgs module (safe with home-manager.useGlobalPkgs).
std.lib.cachesModule from Collect { url; publicKey; } entries from the from sink into nix.settings substituters and keys.
std.lib.flakeFile from, writer Pass the entries of the from sink to writer, for flake-file generation.
std.lib.devshell from, mkShell, name?, pkgs, system? Build devShells.<system>.<name> with mkShell from the modules of the from sink.
ContributeCommunitySponsor