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 — exportsmodule,file, andversioningmodule/: Module creation helpers (mkModule,mkOpt,mkBoolOpt, etc.)file/: File and path utilitiesversioning/: 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.