Modules
Here is a fizzbuzz flake from Perch end-to-end tests:
{{ #include ../test/e2e/fizzbuzz/flake.nix }}
In the example we see a call to perch.lib.flake.make with one fizzbuzz
module. The module defines:
-
a default and named package called
fizzbuzzby the name of the module for the abovementioned systems like so:{ packages = { "systems..." = { default = "<<derivation>>"; fizzbuzz = "<<derivation>>"; }; }; } -
a default and named NixOS module using the beforementioned package called
fizzbuzzby the name of the module like so:{ nixosModules = { default = "<<module>>"; fizzbuzz = "<<module>>"; }; } -
a NixOS configuration using the beforementioned NixOS module named
fizzbuzz-${system}where the system is the abovementioned system{ nixosConfigurations = { "fizzbuzz-${system}" = "<<nixos configuration>>"; }; }
Special arguments
root- if usingperch.lib.flake.makewithrootandprefixtherootargument will be supplied to special arguments of each module in any contextpkgs- when creating modules, packages or configurations Perch automatically createspkgsfor you with the specified systems or all default systems if not provided with the consequence of thepkgsargument beingnullwhile evaluating thenixpkgsconfiguration for thosepkgssuper- when creating modules, packages or configurations Perch wraps your flakeoptionsandconfigintosuperattrset with the consequence ofsuperbeingnullin any other context since the priorconfigandoptionsarguments may be occupied by another NixOS configuration