2017-01-07 19:16:26 +01:00
|
|
|
|
{ configuration
|
|
|
|
|
, pkgs
|
|
|
|
|
, lib ? pkgs.stdenv.lib
|
2017-08-26 22:24:40 +02:00
|
|
|
|
|
|
|
|
|
# Whether to check that each option has a matching declaration.
|
|
|
|
|
, check ? true
|
2017-01-07 19:16:26 +01:00
|
|
|
|
}:
|
|
|
|
|
|
2017-02-21 21:39:53 +01:00
|
|
|
|
with lib;
|
|
|
|
|
|
2017-01-07 19:16:26 +01:00
|
|
|
|
let
|
|
|
|
|
|
|
|
|
|
modules = [
|
2017-10-05 21:38:46 +02:00
|
|
|
|
./files.nix
|
2017-10-20 23:22:47 +02:00
|
|
|
|
./home-environment.nix
|
2017-01-15 20:56:18 +01:00
|
|
|
|
./manual.nix
|
2017-10-09 18:37:57 +02:00
|
|
|
|
./misc/fontconfig.nix
|
2017-01-17 00:47:03 +01:00
|
|
|
|
./misc/gtk.nix
|
2017-07-12 00:35:59 +02:00
|
|
|
|
./misc/news.nix
|
2017-10-20 23:22:47 +02:00
|
|
|
|
./misc/nixpkgs.nix
|
2017-01-16 23:54:45 +01:00
|
|
|
|
./misc/pam.nix
|
2017-10-17 15:50:55 +02:00
|
|
|
|
./misc/xdg.nix
|
2017-01-07 19:16:26 +01:00
|
|
|
|
./programs/bash.nix
|
|
|
|
|
./programs/beets.nix
|
2017-06-30 22:45:09 +02:00
|
|
|
|
./programs/browserpass.nix
|
2017-09-26 08:39:56 +02:00
|
|
|
|
./programs/command-not-found/command-not-found.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
|
2017-07-11 19:55:30 +02:00
|
|
|
|
./programs/home-manager.nix
|
2017-07-24 07:47:59 +02:00
|
|
|
|
./programs/htop.nix
|
2017-05-24 22:55:12 +02:00
|
|
|
|
./programs/info.nix
|
2017-01-07 19:16:26 +01:00
|
|
|
|
./programs/lesspipe.nix
|
2017-10-15 16:01:41 +02:00
|
|
|
|
./programs/man.nix
|
2017-09-28 14:41:35 +02:00
|
|
|
|
./programs/rofi.nix
|
2017-05-09 05:30:37 +02:00
|
|
|
|
./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-09-12 16:26:52 +02:00
|
|
|
|
./services/blueman-applet.nix
|
2017-09-13 13:31:10 +02:00
|
|
|
|
./services/compton.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-10-05 15:55:37 +02:00
|
|
|
|
./services/polybar.nix
|
2017-01-07 19:16:26 +01:00
|
|
|
|
./services/random-background.nix
|
2017-01-20 19:26:52 +01:00
|
|
|
|
./services/redshift.nix
|
2017-09-20 16:50:49 +02:00
|
|
|
|
./services/screen-locker.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
|
2017-09-22 23:52:26 +02:00
|
|
|
|
./services/window-managers/i3.nix
|
2017-10-31 14:05:54 +01:00
|
|
|
|
./services/window-managers/xmonad.nix
|
2017-01-07 19:16:26 +01:00
|
|
|
|
./services/xscreensaver.nix
|
|
|
|
|
./systemd.nix
|
2017-01-12 01:01:15 +01:00
|
|
|
|
./xresources.nix
|
2017-01-07 19:16:26 +01:00
|
|
|
|
./xsession.nix
|
2017-02-21 21:39:53 +01:00
|
|
|
|
<nixpkgs/nixos/modules/misc/assertions.nix>
|
2017-01-15 20:56:18 +01:00
|
|
|
|
<nixpkgs/nixos/modules/misc/meta.nix>
|
2017-01-07 19:16:26 +01:00
|
|
|
|
];
|
|
|
|
|
|
2017-02-21 21:39:53 +01:00
|
|
|
|
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;
|
|
|
|
|
|
2017-01-07 19:16:26 +01:00
|
|
|
|
pkgsModule = {
|
2017-01-15 20:56:18 +01:00
|
|
|
|
config._module.args.baseModules = modules;
|
2017-10-20 23:22:47 +02:00
|
|
|
|
config._module.args.pkgs = lib.mkDefault pkgs;
|
2017-08-26 22:24:40 +02:00
|
|
|
|
config._module.check = check;
|
2017-10-20 23:22:47 +02:00
|
|
|
|
config.nixpkgs.system = mkDefault pkgs.system;
|
2017-01-07 19:16:26 +01:00
|
|
|
|
};
|
|
|
|
|
|
2017-09-09 17:14:07 +02:00
|
|
|
|
rawModule = lib.evalModules {
|
|
|
|
|
modules = [ configuration ] ++ modules ++ [ pkgsModule ];
|
|
|
|
|
};
|
|
|
|
|
|
2017-02-21 21:39:53 +01:00
|
|
|
|
module = showWarnings (
|
|
|
|
|
let
|
2017-09-09 17:14:07 +02:00
|
|
|
|
failed = collectFailed rawModule.config;
|
2017-02-21 21:39:53 +01:00
|
|
|
|
failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);
|
|
|
|
|
in
|
|
|
|
|
if failed == []
|
2017-09-09 17:14:07 +02:00
|
|
|
|
then rawModule
|
2017-02-21 21:39:53 +01:00
|
|
|
|
else throw "\nFailed assertions:\n${failedStr}"
|
|
|
|
|
);
|
2017-01-07 19:16:26 +01:00
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
inherit (module) options config;
|
|
|
|
|
|
2017-08-27 13:04:39 +02:00
|
|
|
|
activationPackage = module.config.home.activationPackage;
|
2017-08-27 17:44:00 +02:00
|
|
|
|
|
|
|
|
|
# For backwards compatibility. Please use activationPackage instead.
|
2017-08-27 17:13:06 +02:00
|
|
|
|
activation-script = module.config.home.activationPackage;
|
2017-08-26 22:24:40 +02:00
|
|
|
|
|
2017-09-09 17:14:07 +02:00
|
|
|
|
newsDisplay = rawModule.config.news.display;
|
2017-08-26 22:24:40 +02:00
|
|
|
|
newsEntries =
|
|
|
|
|
sort (a: b: a.time > b.time) (
|
2017-09-09 17:14:07 +02:00
|
|
|
|
filter (a: a.condition) rawModule.config.news.entries
|
2017-08-26 22:24:40 +02:00
|
|
|
|
);
|
2017-01-07 19:16:26 +01:00
|
|
|
|
}
|