Customization¶
My Nix configuration, based on the SnowfallOrg lib structure, provides a flexible and organized approach to managing your Nix environment. Here's how it works:
-
Custom Library: An optional custom library in the
lib/
directory contains a Nix function called withinputs
,snowfall-inputs
, andlib
. The function should return an attribute set to merge withlib
. -
Modular Directory Structure: You can create any (nestable) directory structure within
lib/
,packages/
,modules/
,overlays/
,systems/
, andhomes/
. Each directory should contain a Nix function that returns an attribute set to merge with the corresponding section. -
Package Overlays: The
packages/
directory includes an optional set of packages to export. Each package is instantiated withcallPackage
, and the files should contain functions that take an attribute set of packages and the requiredlib
to return a derivation. -
Modules for Configuration: In the
modules/
directory, you can define NixOS modules for various platforms, such asnixos
,darwin
, andhome
. This modular approach simplifies system configuration management. -
Custom Overlays: The
overlays/
directory is for optional custom overlays. Each overlay file should contain a function that takes three arguments: an attribute set of your flake's inputs and achannels
attribute containing all available channels, the final set ofpkgs
, and the previous set ofpkgs
. This allows you to customize package sets effectively. -
System Configurations: The
systems/
directory organizes system configurations based on architecture and format. You can create configurations for different architectures and formats, such asx86_64-linux
,aarch64-darwin
, and more. -
Home Configurations: Similar to system configurations, the
homes/
directory organizes home configurations based on architecture and format. This is especially useful if you want to manage home environments with Nix.
This structured approach to Nix configuration makes it easier to manage and customize your Nix environment while maintaining flexibility and modularity.