mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
9c1b3735b4
This command allows the user to examine the news items generated by the news module. See #52. Many thanks to @nonsequitur and @uvNikita for suggestions and improvements.
103 lines
2.4 KiB
Nix
103 lines
2.4 KiB
Nix
{ configuration
|
||
, pkgs
|
||
, lib ? pkgs.stdenv.lib
|
||
|
||
# Whether to check that each option has a matching declaration.
|
||
, check ? true
|
||
}:
|
||
|
||
with lib;
|
||
|
||
let
|
||
|
||
modules = [
|
||
./home-environment.nix
|
||
./manual.nix
|
||
./misc/gtk.nix
|
||
./misc/news.nix
|
||
./misc/pam.nix
|
||
./programs/bash.nix
|
||
./programs/beets.nix
|
||
./programs/browserpass.nix
|
||
./programs/eclipse.nix
|
||
./programs/emacs.nix
|
||
./programs/feh.nix
|
||
./programs/firefox.nix
|
||
./programs/git.nix
|
||
./programs/gnome-terminal.nix
|
||
./programs/home-manager.nix
|
||
./programs/htop.nix
|
||
./programs/info.nix
|
||
./programs/lesspipe.nix
|
||
./programs/oh-my-zsh.nix
|
||
./programs/ssh.nix
|
||
./programs/termite.nix
|
||
./programs/texlive.nix
|
||
./programs/vim.nix
|
||
./programs/zsh.nix
|
||
./services/dunst.nix
|
||
./services/gnome-keyring.nix
|
||
./services/gpg-agent.nix
|
||
./services/keepassx.nix
|
||
./services/network-manager-applet.nix
|
||
./services/owncloud-client.nix
|
||
./services/random-background.nix
|
||
./services/redshift.nix
|
||
./services/syncthing.nix
|
||
./services/taffybar.nix
|
||
./services/tahoe-lafs.nix
|
||
./services/udiskie.nix
|
||
./services/xscreensaver.nix
|
||
./systemd.nix
|
||
./xresources.nix
|
||
./xsession.nix
|
||
<nixpkgs/nixos/modules/misc/assertions.nix>
|
||
<nixpkgs/nixos/modules/misc/meta.nix>
|
||
];
|
||
|
||
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;
|
||
|
||
pkgsModule = {
|
||
config._module.args.pkgs = lib.mkForce pkgs;
|
||
config._module.args.baseModules = modules;
|
||
config._module.check = check;
|
||
};
|
||
|
||
module = showWarnings (
|
||
let
|
||
mod = lib.evalModules {
|
||
modules = [ configuration ] ++ modules ++ [ pkgsModule ];
|
||
};
|
||
|
||
failed = collectFailed mod.config;
|
||
|
||
failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);
|
||
in
|
||
if failed == []
|
||
then mod
|
||
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 = module.config.news.display;
|
||
newsEntries =
|
||
sort (a: b: a.time > b.time) (
|
||
filter (a: a.condition) module.config.news.entries
|
||
);
|
||
}
|