1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

modules: support conditional module inclusion

Also make use of this functionality for the `programs.chromium`
module.

See #501
This commit is contained in:
Robert Helgesson 2018-12-16 12:23:01 +01:00
parent e68d6e7924
commit 218a8c4d90
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 112 additions and 101 deletions

View file

@ -6,6 +6,8 @@ let
cfg = config.news; cfg = config.news;
hostPlatform = pkgs.stdenv.hostPlatform;
entryModule = types.submodule ({ config, ... }: { entryModule = types.submodule ({ config, ... }: {
options = { options = {
id = mkOption { id = mkOption {
@ -734,7 +736,7 @@ in
{ {
time = "2018-08-19T20:46:09+00:00"; time = "2018-08-19T20:46:09+00:00";
condition = pkgs.stdenv.isLinux; condition = hostPlatform.isLinux;
message = '' message = ''
A new modules is available: 'programs.chromium'. A new modules is available: 'programs.chromium'.
''; '';

View file

@ -12,106 +12,115 @@ with lib;
let let
modules = [ hostPlatform = pkgs.stdenv.hostPlatform;
./accounts/email.nix
./files.nix checkPlatform = any (meta.platformMatch pkgs.stdenv.hostPlatform);
./home-environment.nix
./manual.nix loadModule = file: { condition ? true }: {
./misc/fontconfig.nix inherit file condition;
./misc/gtk.nix };
./misc/lib.nix
./misc/news.nix allModules = [
./misc/nixpkgs.nix (loadModule ./accounts/email.nix { })
./misc/pam.nix (loadModule ./files.nix { })
./misc/qt.nix (loadModule ./home-environment.nix { })
./misc/version.nix (loadModule ./manual.nix { })
./misc/xdg.nix (loadModule ./misc/fontconfig.nix { })
./programs/afew.nix (loadModule ./misc/gtk.nix { })
./programs/alot.nix (loadModule ./misc/lib.nix { })
./programs/astroid.nix (loadModule ./misc/news.nix { })
./programs/autorandr.nix (loadModule ./misc/nixpkgs.nix { })
./programs/bash.nix (loadModule ./misc/pam.nix { })
./programs/beets.nix (loadModule ./misc/qt.nix { })
./programs/browserpass.nix (loadModule ./misc/version.nix { })
./programs/command-not-found/command-not-found.nix (loadModule ./misc/xdg.nix { })
./programs/direnv.nix (loadModule ./programs/afew.nix { })
./programs/eclipse.nix (loadModule ./programs/alot.nix { })
./programs/emacs.nix (loadModule ./programs/astroid.nix { })
./programs/feh.nix (loadModule ./programs/autorandr.nix { })
./programs/firefox.nix (loadModule ./programs/bash.nix { })
./programs/fish.nix (loadModule ./programs/beets.nix { })
./programs/fzf.nix (loadModule ./programs/browserpass.nix { })
./programs/git.nix (loadModule ./programs/chromium.nix { condition = hostPlatform.isLinux; })
./programs/gnome-terminal.nix (loadModule ./programs/command-not-found/command-not-found.nix { })
./programs/go.nix (loadModule ./programs/direnv.nix { })
./programs/home-manager.nix (loadModule ./programs/eclipse.nix { })
./programs/htop.nix (loadModule ./programs/emacs.nix { })
./programs/info.nix (loadModule ./programs/feh.nix { })
./programs/jq.nix (loadModule ./programs/firefox.nix { })
./programs/lesspipe.nix (loadModule ./programs/fish.nix { })
./programs/man.nix (loadModule ./programs/fzf.nix { })
./programs/mbsync.nix (loadModule ./programs/git.nix { })
./programs/mercurial.nix (loadModule ./programs/gnome-terminal.nix { })
./programs/msmtp.nix (loadModule ./programs/go.nix { })
./programs/neovim.nix (loadModule ./programs/home-manager.nix { })
./programs/newsboat.nix (loadModule ./programs/htop.nix { })
./programs/noti.nix (loadModule ./programs/info.nix { })
./programs/notmuch.nix (loadModule ./programs/jq.nix { })
./programs/obs-studio.nix (loadModule ./programs/lesspipe.nix { })
./programs/offlineimap.nix (loadModule ./programs/man.nix { })
./programs/pidgin.nix (loadModule ./programs/mbsync.nix { })
./programs/rofi.nix (loadModule ./programs/mercurial.nix { })
./programs/ssh.nix (loadModule ./programs/msmtp.nix { })
./programs/taskwarrior.nix (loadModule ./programs/neovim.nix { })
./programs/termite.nix (loadModule ./programs/newsboat.nix { })
./programs/texlive.nix (loadModule ./programs/noti.nix { })
./programs/tmux.nix (loadModule ./programs/notmuch.nix { })
./programs/urxvt.nix (loadModule ./programs/obs-studio.nix { })
./programs/vim.nix (loadModule ./programs/offlineimap.nix { })
./programs/vscode.nix (loadModule ./programs/pidgin.nix { })
./programs/zathura.nix (loadModule ./programs/rofi.nix { })
./programs/zsh.nix (loadModule ./programs/ssh.nix { })
./services/blueman-applet.nix (loadModule ./programs/taskwarrior.nix { })
./services/compton.nix (loadModule ./programs/termite.nix { })
./services/dunst.nix (loadModule ./programs/texlive.nix { })
./services/flameshot.nix (loadModule ./programs/tmux.nix { })
./services/gnome-keyring.nix (loadModule ./programs/urxvt.nix { })
./services/gpg-agent.nix (loadModule ./programs/vim.nix { })
./services/kbfs.nix (loadModule ./programs/vscode.nix { })
./services/kdeconnect.nix (loadModule ./programs/zathura.nix { })
./services/keepassx.nix (loadModule ./programs/zsh.nix { })
./services/keybase.nix (loadModule ./services/blueman-applet.nix { })
./services/mbsync.nix (loadModule ./services/compton.nix { })
./services/mpd.nix (loadModule ./services/dunst.nix { })
./services/network-manager-applet.nix (loadModule ./services/flameshot.nix { })
./services/nextcloud-client.nix (loadModule ./services/gnome-keyring.nix { })
./services/owncloud-client.nix (loadModule ./services/gpg-agent.nix { })
./services/parcellite.nix (loadModule ./services/kbfs.nix { })
./services/pasystray.nix (loadModule ./services/kdeconnect.nix { })
./services/polybar.nix (loadModule ./services/keepassx.nix { })
./services/random-background.nix (loadModule ./services/keybase.nix { })
./services/redshift.nix (loadModule ./services/mbsync.nix { })
./services/screen-locker.nix (loadModule ./services/mpd.nix { })
./services/stalonetray.nix (loadModule ./services/network-manager-applet.nix { })
./services/status-notifier-watcher.nix (loadModule ./services/nextcloud-client.nix { })
./services/syncthing.nix (loadModule ./services/owncloud-client.nix { })
./services/taffybar.nix (loadModule ./services/parcellite.nix { })
./services/tahoe-lafs.nix (loadModule ./services/pasystray.nix { })
./services/udiskie.nix (loadModule ./services/polybar.nix { })
./services/unclutter.nix (loadModule ./services/random-background.nix { })
./services/window-managers/awesome.nix (loadModule ./services/redshift.nix { })
./services/window-managers/i3.nix (loadModule ./services/screen-locker.nix { })
./services/window-managers/xmonad.nix (loadModule ./services/stalonetray.nix { })
./services/xscreensaver.nix (loadModule ./services/status-notifier-watcher.nix { })
./systemd.nix (loadModule ./services/syncthing.nix { })
./xcursor.nix (loadModule ./services/taffybar.nix { })
./xresources.nix (loadModule ./services/tahoe-lafs.nix { })
./xsession.nix (loadModule ./services/udiskie.nix { })
<nixpkgs/nixos/modules/misc/assertions.nix> (loadModule ./services/unclutter.nix { })
<nixpkgs/nixos/modules/misc/meta.nix> (loadModule ./services/window-managers/awesome.nix { })
] (loadModule ./services/window-managers/i3.nix { })
++ (loadModule ./services/window-managers/xmonad.nix { })
optional pkgs.stdenv.isLinux ./programs/chromium.nix; (loadModule ./services/xscreensaver.nix { })
(loadModule ./systemd.nix { })
(loadModule ./xcursor.nix { })
(loadModule ./xresources.nix { })
(loadModule ./xsession.nix { })
(loadModule <nixpkgs/nixos/modules/misc/assertions.nix> { })
(loadModule <nixpkgs/nixos/modules/misc/meta.nix> { })
];
modules = map (getAttr "file") (filter (getAttr "condition") allModules);
pkgsModule = { pkgsModule = {
options.nixosSubmodule = mkOption { options.nixosSubmodule = mkOption {