home-manager/modules/default.nix

102 lines
2.4 KiB
Nix
Raw Normal View History

2017-01-07 19:16:26 +01:00
{ configuration
, pkgs
, lib ? pkgs.stdenv.lib
# Whether to check that each option has a matching declaration.
, check ? true
2017-01-07 19:16:26 +01:00
}:
with lib;
2017-01-07 19:16:26 +01:00
let
modules = [
./home-environment.nix
./manual.nix
./misc/gtk.nix
./misc/news.nix
./misc/pam.nix
2017-01-07 19:16:26 +01:00
./programs/bash.nix
./programs/beets.nix
./programs/browserpass.nix
2017-01-07 19:16:26 +01:00
./programs/eclipse.nix
./programs/emacs.nix
2017-09-04 16:35:23 +02:00
./programs/feh.nix
2017-01-11 00:36:43 +01:00
./programs/firefox.nix
2017-01-07 19:16:26 +01:00
./programs/git.nix
./programs/gnome-terminal.nix
./programs/home-manager.nix
2017-07-24 07:47:59 +02:00
./programs/htop.nix
./programs/info.nix
2017-01-07 19:16:26 +01:00
./programs/lesspipe.nix
./programs/ssh.nix
2017-08-23 16:10:41 +02:00
./programs/termite.nix
2017-01-07 19:16:26 +01:00
./programs/texlive.nix
2017-08-28 16:33:22 +02:00
./programs/vim.nix
2017-08-15 13:54:33 +02:00
./programs/zsh.nix
2017-01-07 19:16:26 +01:00
./services/dunst.nix
./services/gnome-keyring.nix
./services/gpg-agent.nix
./services/keepassx.nix
./services/network-manager-applet.nix
2017-08-26 16:00:55 +02:00
./services/owncloud-client.nix
2017-01-07 19:16:26 +01:00
./services/random-background.nix
./services/redshift.nix
2017-07-17 10:10:15 +02:00
./services/syncthing.nix
2017-01-07 19:16:26 +01:00
./services/taffybar.nix
./services/tahoe-lafs.nix
./services/udiskie.nix
./services/xscreensaver.nix
./systemd.nix
./xresources.nix
2017-01-07 19:16:26 +01:00
./xsession.nix
<nixpkgs/nixos/modules/misc/assertions.nix>
<nixpkgs/nixos/modules/misc/meta.nix>
2017-01-07 19:16:26 +01:00
];
collectFailed = cfg:
map (x: x.message) (filter (x: !x.assertion) cfg.assertions);
showWarnings = res:
let
f = w: x: builtins.trace "warning: ${w}" x;
in
fold f res res.config.warnings;
2017-01-07 19:16:26 +01:00
pkgsModule = {
config._module.args.pkgs = lib.mkForce pkgs;
config._module.args.baseModules = modules;
config._module.check = check;
2017-01-07 19:16:26 +01:00
};
rawModule = lib.evalModules {
modules = [ configuration ] ++ modules ++ [ pkgsModule ];
};
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}"
);
2017-01-07 19:16:26 +01:00
in
{
inherit (module) options config;
activationPackage = module.config.home.activationPackage;
2017-08-27 17:44:00 +02:00
# 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
);
2017-01-07 19:16:26 +01:00
}