Files
nix-config/lib
mjallen18 d9f17670e1 cleanup
2026-03-18 21:24:58 -05:00
..
2025-09-03 09:43:56 -05:00
2026-03-18 20:39:25 -05:00
fmt
2026-01-22 16:08:24 -06:00
2026-03-18 20:39:25 -05:00
2026-03-18 21:24:58 -05:00

mjallen-lib Utility Functions

Utility functions for the NixOS/nix-darwin configuration. Exposed via Snowfall Lib as lib.mjallen.*.

Directory Structure

  • default.nix: Main entry point — exports module, file, and versioning
  • module/: Module creation helpers (mkModule, mkOpt, mkBoolOpt, etc.)
  • file/: File and path utilities
  • versioning/: Multi-source version pinning helpers (used by packages)

Module Utilities (lib.mjallen.module)

Function Description
mkModule Create a NixOS module with standard options (enable, port, reverseProxy, firewall, user, postgresql, redis)
mkOpt type → default → description → mkOption shorthand
mkOpt' mkOpt without description
mkBoolOpt Boolean mkOpt shorthand
mkBoolOpt' Boolean mkOpt without description
mkReverseProxyOpt Standard Caddy reverse proxy sub-options
enabled { enable = true; } shorthand
disabled { enable = false; } shorthand
capitalize Capitalise the first character of a string
boolToNum Convert a boolean to 0 or 1
default-attrs Apply lib.mkDefault to every value in an attrset
force-attrs Apply lib.mkForce to every value in an attrset
nested-default-attrs Apply default-attrs one level deeper
nested-force-attrs Apply force-attrs one level deeper
enableForSystem Filter a module list to only those that match a given system string

File Utilities (lib.mjallen.file)

Function Description
getFile Resolve a path relative to the flake root
safeImport Import a Nix file with a fallback on error
scanDir Return a list of directory names under a path
importModulesRecursive Recursively discover and import all default.nix files under a directory

Versioning Utilities (lib.mjallen.versioning)

Used by packages that track multiple upstream variants (e.g. linux-rpi, proton-cachyos). See lib/versioning/default.nix for the full API.