2020-10-12 00:22:58 +00:00
|
|
|
|
{ configuration
|
|
|
|
|
, pkgs
|
2021-07-02 22:36:30 +00:00
|
|
|
|
, lib ? pkgs.lib
|
2020-10-12 00:22:58 +00:00
|
|
|
|
|
|
|
|
|
# Whether to check that each option has a matching declaration.
|
|
|
|
|
, check ? true
|
2021-07-02 22:36:30 +00:00
|
|
|
|
# Extra arguments passed to specialArgs.
|
|
|
|
|
, extraSpecialArgs ? { }
|
2020-10-12 00:22:58 +00:00
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
|
|
collectFailed = cfg:
|
|
|
|
|
map (x: x.message) (filter (x: !x.assertion) cfg.assertions);
|
|
|
|
|
|
|
|
|
|
showWarnings = res:
|
|
|
|
|
let
|
|
|
|
|
f = w: x: builtins.trace "[1;31mwarning: ${w}[0m" x;
|
|
|
|
|
in
|
|
|
|
|
fold f res res.config.warnings;
|
|
|
|
|
|
2023-01-10 09:35:00 +00:00
|
|
|
|
extendedLib = import ./lib/stdlib-extended.nix lib;
|
2020-10-12 00:22:58 +00:00
|
|
|
|
|
|
|
|
|
hmModules =
|
|
|
|
|
import ./modules.nix {
|
|
|
|
|
inherit check pkgs;
|
|
|
|
|
lib = extendedLib;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
rawModule = extendedLib.evalModules {
|
|
|
|
|
modules = [ configuration ] ++ hmModules;
|
|
|
|
|
specialArgs = {
|
|
|
|
|
modulesPath = builtins.toString ./.;
|
2021-07-02 22:36:30 +00:00
|
|
|
|
} // extraSpecialArgs;
|
2020-10-12 00:22:58 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module = showWarnings (
|
|
|
|
|
let
|
|
|
|
|
failed = collectFailed rawModule.config;
|
|
|
|
|
failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);
|
|
|
|
|
in
|
|
|
|
|
if failed == []
|
|
|
|
|
then rawModule
|
|
|
|
|
else throw "\nFailed assertions:\n${failedStr}"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
inherit (module) options config;
|
|
|
|
|
|
|
|
|
|
activationPackage = module.config.home.activationPackage;
|
|
|
|
|
|
|
|
|
|
# For backwards compatibility. Please use activationPackage instead.
|
|
|
|
|
activation-script = module.config.home.activationPackage;
|
|
|
|
|
|
|
|
|
|
newsDisplay = rawModule.config.news.display;
|
|
|
|
|
newsEntries =
|
|
|
|
|
sort (a: b: a.time > b.time) (
|
|
|
|
|
filter (a: a.condition) rawModule.config.news.entries
|
|
|
|
|
);
|
2023-01-10 09:35:00 +00:00
|
|
|
|
|
|
|
|
|
inherit (module._module.args) pkgs;
|
2020-10-12 00:22:58 +00:00
|
|
|
|
}
|