1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

Move platform check into modules

Before, loading a module would be guarded by an optional platform
condition. This made it possible to avoid loading and evaluating a
module if it did not support the host platform.

Unfortunately, this made it impossible to share a single configuration
between GNU/Linux and Darwin hosts, which some wish to do.

This removes the conditional load and instead inserts host platform
assertions in the modules that are platform specific.

Fixes #1906
This commit is contained in:
Robert Helgesson 2021-07-07 23:24:27 +02:00
parent 1617e56c2f
commit 5f433eb164
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
90 changed files with 743 additions and 307 deletions

View file

@ -9,7 +9,29 @@ section is therefore not final.
This release has the following notable changes:
* Nothing has happened.
* All Home Manager modules are now loaded on all platforms. With this
change you will get a more descriptive error message if you attempt to
enable a module that is incompatible with the host platform.
+
Previously, modules that were platform specific would only be loaded
on that particular platform. For example, a module defining a
https://systemd.io/[systemd] service would only be loaded when the
host platform was Linux. This reduced evaluation times, simplified the
generated documentation, and made it impossible to accidentally use
modules that do not support the host platform.
+
While the above benefits are quite nice, avoiding module loads also
brings a few problems. For example, the
https://nix-community.github.io/home-manager/[public documentation]
will only show the options available for Linux hosts and the
documentation cannot make references to options within modules that
are unavailable on some hosts. Finally, users who wish to use the same
configuration file for different platforms cannot do so, even if the
platform incompatible options are unused.
+
Ultimately, the benefits of loading all modules won and the behavior
has now changed. For associated discussion see
https://github.com/nix-community/home-manager/issues/1906[issue #1906].
[[sec-release-21.11-state-version-changes]]
=== State Version Changes

View file

@ -36,7 +36,7 @@ let
in {
meta.maintainers = with maintainers; [ midchildan ];
config = {
config = mkIf pkgs.hostPlatform.isLinux {
# For shell sessions.
home.sessionVariables = localeVars;

View file

@ -95,6 +95,10 @@ in {
};
config = mkIf (cfg.enabled != null) {
assertions = [
(hm.assertions.assertPlatform "i18n.inputMethod" pkgs platforms.linux)
];
home.packages = [ cfg.package gtk2Cache gtk3Cache ];
};

View file

@ -0,0 +1,14 @@
{ lib }:
{
assertPlatform = module: pkgs: platforms: {
assertion = lib.elem pkgs.stdenv.hostPlatform.system platforms;
message = let
platformsStr = lib.concatStringsSep "\n"
(map (p: " - ${p}") (lib.sort (a: b: a < b) platforms));
in ''
The module ${module} does not support your platform. It only supports
${platformsStr}'';
};
}

View file

@ -16,6 +16,8 @@ rec {
entryBefore = d.dagEntryBefore;
};
assertions = import ./assertions.nix { inherit lib; };
gvariant = import ./gvariant.nix { inherit lib; };
maintainers = import ./maintainers.nix;
strings = import ./strings.nix { inherit lib; };

View file

@ -12,6 +12,10 @@ in {
options = { xsession.numlock.enable = mkEnableOption "Num Lock"; };
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "xsession.numlock" pkgs platforms.linux)
];
systemd.user.services.numlockx = {
Unit = {
Description = "NumLockX";

View file

@ -25,6 +25,11 @@ in {
};
config = mkIf (cfg.rules != [ ]) {
assertions = [
(hm.assertions.assertPlatform "systemd.user.tmpfiles" pkgs
platforms.linux)
];
xdg = {
dataFile."user-tmpfiles.d/home-manager.conf" = {
text = ''

View file

@ -171,8 +171,13 @@ in {
'';
};
config.home.packages = mkIf (config.xdg.desktopEntries != { })
(map hiPrio # we need hiPrio to override existing entries
config = mkIf (config.xdg.desktopEntries != { }) {
assertions = [
(hm.assertions.assertPlatform "xdg.desktopEntries" pkgs platforms.linux)
];
home.packages = (map hiPrio # we need hiPrio to override existing entries
(attrsets.mapAttrsToList makeFile config.xdg.desktopEntries));
};
}

View file

@ -73,6 +73,9 @@ in {
};
config = mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "xdg.mimeApps" pkgs platforms.linux) ];
# Deprecated but still used by some applications.
xdg.dataFile."applications/mimeapps.list".source =
config.xdg.configFile."mimeapps.list".source;

View file

@ -10,7 +10,9 @@ in {
options = {
xdg.mime.enable = mkOption {
type = types.bool;
default = true;
default = pkgs.hostPlatform.isLinux;
defaultText =
literalExample "true if host platform is Linux, false otherwise";
description = ''
Whether to install programs and files to support the
XDG Shared MIME-info specification and XDG MIME Applications
@ -24,6 +26,9 @@ in {
};
config = mkIf config.xdg.mime.enable {
assertions =
[ (hm.assertions.assertPlatform "xdg.mime" pkgs platforms.linux) ];
home.packages = [
# Explicitly install package to provide basic mime types.
pkgs.shared-mime-info

View file

@ -36,6 +36,12 @@ in {
};
config = mkMerge [
(mkIf (cfg.config != [ ] || cfg.data != [ ]) {
assertions = [
(hm.assertions.assertPlatform "xdg.systemDirs" pkgs platforms.linux)
];
})
(mkIf (cfg.config != [ ]) {
home.sessionVariables.XDG_CONFIG_DIRS =
"${configDirs}\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}";

View file

@ -103,6 +103,9 @@ in {
XDG_VIDEOS_DIR = cfg.videos;
} // cfg.extraConfig;
in mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "xdg.userDirs" pkgs platforms.linux) ];
xdg.configFile."user-dirs.dirs".text = let
# For some reason, these need to be wrapped with quotes to be valid.
wrapped = mapAttrs (_: value: ''"${value}"'') directories;

View file

@ -14,234 +14,225 @@ with lib;
let
hostPlatform = pkgs.stdenv.hostPlatform;
loadModule = file: { condition ? true }: {
inherit file condition;
};
allModules = [
(loadModule ./accounts/email.nix { })
(loadModule ./config/i18n.nix { condition = hostPlatform.isLinux; })
(loadModule ./files.nix { })
(loadModule ./home-environment.nix { })
(loadModule ./i18n/input-method/default.nix { condition = hostPlatform.isLinux; })
(loadModule ./manual.nix { })
(loadModule ./misc/dconf.nix { })
(loadModule ./misc/debug.nix { })
(loadModule ./misc/fontconfig.nix { })
(loadModule ./misc/gtk.nix { })
(loadModule ./misc/lib.nix { })
(loadModule ./misc/news.nix { })
(loadModule ./misc/nixpkgs.nix { condition = useNixpkgsModule; })
(loadModule ./misc/numlock.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/pam.nix { })
(loadModule ./misc/qt.nix { })
(loadModule ./misc/submodule-support.nix { })
(loadModule ./misc/tmpfiles.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/version.nix { })
(loadModule ./misc/vte.nix { })
(loadModule ./misc/xdg-system-dirs.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-desktop-entries.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-mime.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-mime-apps.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-user-dirs.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg.nix { })
(loadModule ./programs/abook.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/afew.nix { })
(loadModule ./programs/alacritty.nix { })
(loadModule ./programs/alot.nix { })
(loadModule ./programs/aria2.nix { })
(loadModule ./programs/astroid.nix { })
(loadModule ./programs/autojump.nix { })
(loadModule ./programs/autorandr.nix { })
(loadModule ./programs/bash.nix { })
(loadModule ./programs/bat.nix { })
(loadModule ./programs/beets.nix { })
(loadModule ./programs/broot.nix { })
(loadModule ./programs/browserpass.nix { })
(loadModule ./programs/chromium.nix { })
(loadModule ./programs/command-not-found/command-not-found.nix { })
(loadModule ./programs/dircolors.nix { })
(loadModule ./programs/direnv.nix { })
(loadModule ./programs/eclipse.nix { })
(loadModule ./programs/emacs.nix { })
(loadModule ./programs/exa.nix { })
(loadModule ./programs/feh.nix { })
(loadModule ./programs/firefox.nix { })
(loadModule ./programs/fish.nix { })
(loadModule ./programs/foot.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/fzf.nix { })
(loadModule ./programs/getmail.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/gh.nix { })
(loadModule ./programs/git.nix { })
(loadModule ./programs/gnome-terminal.nix { })
(loadModule ./programs/go.nix { })
(loadModule ./programs/gpg.nix { })
(loadModule ./programs/himalaya.nix { })
(loadModule ./programs/home-manager.nix { })
(loadModule ./programs/htop.nix { })
(loadModule ./programs/i3status.nix { })
(loadModule ./programs/i3status-rust.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/info.nix { })
(loadModule ./programs/irssi.nix { })
(loadModule ./programs/lieer.nix { })
(loadModule ./programs/jq.nix { })
(loadModule ./programs/kakoune.nix { })
(loadModule ./programs/keychain.nix { })
(loadModule ./programs/kitty.nix { })
(loadModule ./programs/lazygit.nix { })
(loadModule ./programs/lesspipe.nix { })
(loadModule ./programs/lf.nix { })
(loadModule ./programs/lsd.nix { })
(loadModule ./programs/man.nix { })
(loadModule ./programs/mangohud.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/matplotlib.nix { })
(loadModule ./programs/mbsync.nix { })
(loadModule ./programs/mcfly.nix { })
(loadModule ./programs/mercurial.nix { })
(loadModule ./programs/mpv.nix { })
(loadModule ./programs/msmtp.nix { })
(loadModule ./programs/mu.nix { })
(loadModule ./programs/ncmpcpp.nix { })
(loadModule ./programs/ncspot.nix { })
(loadModule ./programs/ne.nix { })
(loadModule ./programs/neomutt.nix { })
(loadModule ./programs/neovim.nix { })
(loadModule ./programs/newsboat.nix { })
(loadModule ./programs/nix-index.nix { })
(loadModule ./programs/noti.nix { })
(loadModule ./programs/notmuch.nix { })
(loadModule ./programs/nushell.nix { })
(loadModule ./programs/obs-studio.nix { })
(loadModule ./programs/octant.nix { })
(loadModule ./programs/offlineimap.nix { })
(loadModule ./programs/opam.nix { })
(loadModule ./programs/password-store.nix { })
(loadModule ./programs/pazi.nix { })
(loadModule ./programs/pet.nix { })
(loadModule ./programs/pidgin.nix { })
(loadModule ./programs/piston-cli.nix { })
(loadModule ./programs/powerline-go.nix { })
(loadModule ./programs/qutebrowser.nix { })
(loadModule ./programs/rbw.nix { })
(loadModule ./programs/readline.nix { })
(loadModule ./programs/rofi.nix { })
(loadModule ./programs/rofi-pass.nix { })
(loadModule ./programs/rtorrent.nix { })
(loadModule ./programs/scmpuff.nix { })
(loadModule ./programs/senpai.nix { })
(loadModule ./programs/skim.nix { })
(loadModule ./programs/sm64ex.nix { })
(loadModule ./programs/starship.nix { })
(loadModule ./programs/sbt.nix { })
(loadModule ./programs/ssh.nix { })
(loadModule ./programs/taskwarrior.nix { })
(loadModule ./programs/termite.nix { })
(loadModule ./programs/texlive.nix { })
(loadModule ./programs/tmux.nix { })
(loadModule ./programs/terminator.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/topgrade.nix { })
(loadModule ./programs/urxvt.nix { })
(loadModule ./programs/vim.nix { })
(loadModule ./programs/vscode.nix { })
(loadModule ./programs/vscode/haskell.nix { })
(loadModule ./programs/waybar.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/xmobar.nix { })
(loadModule ./programs/z-lua.nix { })
(loadModule ./programs/zathura.nix { })
(loadModule ./programs/zoxide.nix { })
(loadModule ./programs/zplug.nix { })
(loadModule ./programs/zsh.nix { })
(loadModule ./programs/zsh/prezto.nix { })
(loadModule ./services/barrier.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/blueman-applet.nix { })
(loadModule ./services/caffeine.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/clipmenu.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/compton.nix { })
(loadModule ./services/devilspie2.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/dropbox.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/dunst.nix { })
(loadModule ./services/dwm-status.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/emacs.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/etesync-dav.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/flameshot.nix { })
(loadModule ./services/fluidsynth.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/redshift-gammastep/gammastep.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/getmail.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/gnome-keyring.nix { })
(loadModule ./services/gpg-agent.nix { })
(loadModule ./services/grobi.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/hound.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/imapnotify.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/kanshi.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/kbfs.nix { })
(loadModule ./services/kdeconnect.nix { })
(loadModule ./services/keepassx.nix { })
(loadModule ./services/keybase.nix { })
(loadModule ./services/keynav.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/lieer.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/lorri.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/mako.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/mbsync.nix { })
(loadModule ./services/mpd.nix { })
(loadModule ./services/mpdris2.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/mpris-proxy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/muchsync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/network-manager-applet.nix { })
(loadModule ./services/nextcloud-client.nix { })
(loadModule ./services/owncloud-client.nix { })
(loadModule ./services/pantalaimon.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/parcellite.nix { })
(loadModule ./services/pass-secret-service.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/password-store-sync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/pasystray.nix { })
(loadModule ./services/pbgopy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/picom.nix { })
(loadModule ./services/plan9port.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/playerctld.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/polybar.nix { })
(loadModule ./services/poweralertd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/pulseeffects.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/random-background.nix { })
(loadModule ./services/redshift-gammastep/redshift.nix { })
(loadModule ./services/rsibreak.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/screen-locker.nix { })
(loadModule ./services/stalonetray.nix { })
(loadModule ./services/status-notifier-watcher.nix { })
(loadModule ./services/spotifyd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/sxhkd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/syncthing.nix { })
(loadModule ./services/taffybar.nix { })
(loadModule ./services/tahoe-lafs.nix { })
(loadModule ./services/taskwarrior-sync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/udiskie.nix { })
(loadModule ./services/unclutter.nix { })
(loadModule ./services/unison.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/window-managers/awesome.nix { })
(loadModule ./services/window-managers/bspwm/default.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/window-managers/i3-sway/i3.nix { })
(loadModule ./services/window-managers/i3-sway/sway.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/window-managers/xmonad.nix { })
(loadModule ./services/wlsunset.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xcape.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xembed-sni-proxy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xidlehook.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xscreensaver.nix { })
(loadModule ./services/xsettingsd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xsuspender.nix { condition = hostPlatform.isLinux; })
(loadModule ./systemd.nix { })
(loadModule ./targets/darwin { condition = hostPlatform.isDarwin; })
(loadModule ./targets/generic-linux.nix { condition = hostPlatform.isLinux; })
(loadModule ./xcursor.nix { })
(loadModule ./xresources.nix { })
(loadModule ./xsession.nix { })
(loadModule (pkgs.path + "/nixos/modules/misc/assertions.nix") { })
(loadModule (pkgs.path + "/nixos/modules/misc/meta.nix") { })
];
modules = map (getAttr "file") (filter (getAttr "condition") allModules);
modules = [
./accounts/email.nix
./config/i18n.nix
./files.nix
./home-environment.nix
./i18n/input-method/default.nix
./manual.nix
./misc/dconf.nix
./misc/debug.nix
./misc/fontconfig.nix
./misc/gtk.nix
./misc/lib.nix
./misc/news.nix
./misc/numlock.nix
./misc/pam.nix
./misc/qt.nix
./misc/submodule-support.nix
./misc/tmpfiles.nix
./misc/version.nix
./misc/vte.nix
./misc/xdg-desktop-entries.nix
./misc/xdg-mime-apps.nix
./misc/xdg-mime.nix
./misc/xdg-system-dirs.nix
./misc/xdg-user-dirs.nix
./misc/xdg.nix
./programs/abook.nix
./programs/afew.nix
./programs/alacritty.nix
./programs/alot.nix
./programs/aria2.nix
./programs/astroid.nix
./programs/autojump.nix
./programs/autorandr.nix
./programs/bash.nix
./programs/bat.nix
./programs/beets.nix
./programs/broot.nix
./programs/browserpass.nix
./programs/chromium.nix
./programs/command-not-found/command-not-found.nix
./programs/dircolors.nix
./programs/direnv.nix
./programs/eclipse.nix
./programs/emacs.nix
./programs/exa.nix
./programs/feh.nix
./programs/firefox.nix
./programs/fish.nix
./programs/foot.nix
./programs/fzf.nix
./programs/getmail.nix
./programs/gh.nix
./programs/git.nix
./programs/gnome-terminal.nix
./programs/go.nix
./programs/gpg.nix
./programs/himalaya.nix
./programs/home-manager.nix
./programs/htop.nix
./programs/i3status-rust.nix
./programs/i3status.nix
./programs/info.nix
./programs/irssi.nix
./programs/jq.nix
./programs/kakoune.nix
./programs/keychain.nix
./programs/kitty.nix
./programs/lazygit.nix
./programs/lesspipe.nix
./programs/lf.nix
./programs/lieer.nix
./programs/lsd.nix
./programs/man.nix
./programs/mangohud.nix
./programs/matplotlib.nix
./programs/mbsync.nix
./programs/mcfly.nix
./programs/mercurial.nix
./programs/mpv.nix
./programs/msmtp.nix
./programs/mu.nix
./programs/ncmpcpp.nix
./programs/ncspot.nix
./programs/ne.nix
./programs/neomutt.nix
./programs/neovim.nix
./programs/newsboat.nix
./programs/nix-index.nix
./programs/noti.nix
./programs/notmuch.nix
./programs/nushell.nix
./programs/obs-studio.nix
./programs/octant.nix
./programs/offlineimap.nix
./programs/opam.nix
./programs/password-store.nix
./programs/pazi.nix
./programs/pet.nix
./programs/pidgin.nix
./programs/piston-cli.nix
./programs/powerline-go.nix
./programs/qutebrowser.nix
./programs/rbw.nix
./programs/readline.nix
./programs/rofi-pass.nix
./programs/rofi.nix
./programs/rtorrent.nix
./programs/sbt.nix
./programs/scmpuff.nix
./programs/senpai.nix
./programs/skim.nix
./programs/sm64ex.nix
./programs/ssh.nix
./programs/starship.nix
./programs/taskwarrior.nix
./programs/terminator.nix
./programs/termite.nix
./programs/texlive.nix
./programs/tmux.nix
./programs/topgrade.nix
./programs/urxvt.nix
./programs/vim.nix
./programs/vscode.nix
./programs/vscode/haskell.nix
./programs/waybar.nix
./programs/xmobar.nix
./programs/z-lua.nix
./programs/zathura.nix
./programs/zoxide.nix
./programs/zplug.nix
./programs/zsh.nix
./programs/zsh/prezto.nix
./services/barrier.nix
./services/blueman-applet.nix
./services/caffeine.nix
./services/cbatticon.nix
./services/clipmenu.nix
./services/compton.nix
./services/devilspie2.nix
./services/dropbox.nix
./services/dunst.nix
./services/dwm-status.nix
./services/emacs.nix
./services/etesync-dav.nix
./services/flameshot.nix
./services/fluidsynth.nix
./services/getmail.nix
./services/gnome-keyring.nix
./services/gpg-agent.nix
./services/grobi.nix
./services/hound.nix
./services/imapnotify.nix
./services/kanshi.nix
./services/kbfs.nix
./services/kdeconnect.nix
./services/keepassx.nix
./services/keybase.nix
./services/keynav.nix
./services/lieer.nix
./services/lorri.nix
./services/mako.nix
./services/mbsync.nix
./services/mpd.nix
./services/mpdris2.nix
./services/mpris-proxy.nix
./services/muchsync.nix
./services/network-manager-applet.nix
./services/nextcloud-client.nix
./services/owncloud-client.nix
./services/pantalaimon.nix
./services/parcellite.nix
./services/pass-secret-service.nix
./services/password-store-sync.nix
./services/pasystray.nix
./services/pbgopy.nix
./services/picom.nix
./services/plan9port.nix
./services/playerctld.nix
./services/polybar.nix
./services/poweralertd.nix
./services/pulseeffects.nix
./services/random-background.nix
./services/redshift-gammastep/gammastep.nix
./services/redshift-gammastep/redshift.nix
./services/rsibreak.nix
./services/screen-locker.nix
./services/spotifyd.nix
./services/stalonetray.nix
./services/status-notifier-watcher.nix
./services/sxhkd.nix
./services/syncthing.nix
./services/taffybar.nix
./services/tahoe-lafs.nix
./services/taskwarrior-sync.nix
./services/udiskie.nix
./services/unclutter.nix
./services/unison.nix
./services/window-managers/awesome.nix
./services/window-managers/bspwm/default.nix
./services/window-managers/i3-sway/i3.nix
./services/window-managers/i3-sway/sway.nix
./services/window-managers/xmonad.nix
./services/wlsunset.nix
./services/xcape.nix
./services/xembed-sni-proxy.nix
./services/xidlehook.nix
./services/xscreensaver.nix
./services/xsettingsd.nix
./services/xsuspender.nix
./systemd.nix
./targets/darwin
./targets/generic-linux.nix
./xcursor.nix
./xresources.nix
./xsession.nix
(pkgs.path + "/nixos/modules/misc/assertions.nix")
(pkgs.path + "/nixos/modules/misc/meta.nix")
] ++ optional useNixpkgsModule ./misc/nixpkgs.nix;
pkgsModule = { config, ... }: {
config = {

View file

@ -27,7 +27,11 @@ in {
};
config = mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "programs.abook" pkgs platforms.linux) ];
home.packages = [ pkgs.abook ];
xdg.configFile."abook/abookrc" = mkIf (cfg.extraConfig != "") {
text = ''
# Generated by Home Manager.

View file

@ -49,6 +49,9 @@ in {
};
config = mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "programs.foot" pkgs platforms.linux) ];
home.packages = [ cfg.package ];
xdg.configFile."foot/foot.ini" = mkIf (cfg.settings != { }) {

View file

@ -55,6 +55,10 @@ in {
};
config = mkIf getmailEnabled {
assertions = [
(hm.assertions.assertPlatform "programs.getmail" pkgs platforms.linux)
];
home.file = foldl' (a: b: a // b) { }
(map (a: { "${renderConfigFilepath a}".text = renderAccountConfig a; })
accounts);

View file

@ -249,6 +249,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "programs.i3status-rust" pkgs
platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile = mapAttrs' (cfgFileSuffix: cfg:

View file

@ -82,24 +82,25 @@ in {
};
};
config = mkIf cfg.enable (mkMerge [
{
home.packages = [ cfg.package ];
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "programs.mangohud" pkgs platforms.linux)
];
home.sessionVariables = mkIf cfg.enableSessionWide {
MANGOHUD = 1;
MANGOHUD_DLSYM = 1;
};
home.packages = [ cfg.package ];
xdg.configFile."MangoHud/MangoHud.conf" =
home.sessionVariables = mkIf cfg.enableSessionWide {
MANGOHUD = 1;
MANGOHUD_DLSYM = 1;
};
xdg.configFile = {
"MangoHud/MangoHud.conf" =
mkIf (cfg.settings != { }) { text = renderSettings cfg.settings; };
}
{
xdg.configFile = mapAttrs'
(n: v: nameValuePair "MangoHud/${n}.conf" { text = renderSettings v; })
cfg.settingsPerApplication;
}
]);
} // mapAttrs'
(n: v: nameValuePair "MangoHud/${n}.conf" { text = renderSettings v; })
cfg.settingsPerApplication;
};
meta.maintainers = with maintainers; [ zeratax ];
}

View file

@ -402,12 +402,15 @@ in {
};
config = mkIf cfg.enable {
assertions = [{
assertion = cfg.theme == null || cfg.colors == null;
message = ''
Cannot use the rofi options 'theme' and 'colors' simultaneously.
'';
}];
assertions = [
(hm.assertions.assertPlatform "programs.rofi" pkgs platforms.linux)
{
assertion = cfg.theme == null || cfg.colors == null;
message = ''
Cannot use the rofi options 'theme' and 'colors' simultaneously.
'';
}
];
lib.formats.rasi.mkLiteral = value: {
_type = "literal";

View file

@ -63,7 +63,12 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "programs.terminator" pkgs platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile."terminator/config" =
mkIf (cfg.config != { }) { text = toConfigObject cfg.config; };
};

View file

@ -353,16 +353,26 @@ in {
in allWarnings;
in mkIf cfg.enable (mkMerge [
{ home.packages = [ cfg.package ]; }
{
assertions = [
(lib.hm.assertions.assertPlatform "programs.waybar" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
}
(mkIf (cfg.settings != [ ]) {
# Generate warnings about defined but unreferenced modules
inherit warnings;
xdg.configFile."waybar/config".source = configSource;
})
(mkIf (cfg.style != null) {
xdg.configFile."waybar/style.css".text = cfg.style;
})
(mkIf cfg.systemd.enable {
systemd.user.services.waybar = {
Unit = {

View file

@ -51,6 +51,11 @@ in {
};
config = mkIf cfg.client.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.barrier" pkgs
lib.platforms.linux)
];
systemd.user.services.barrierc = {
Unit = {
Description = "Barrier Client daemon";

View file

@ -14,6 +14,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.caffeine" pkgs
lib.platforms.linux)
];
systemd.user.services.caffeine = {
Unit = { Description = "caffeine"; };

View file

@ -98,6 +98,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.cbatticon" pkgs
lib.platforms.linux)
];
home.packages = [ package ];
systemd.user.services.cbatticon = {

View file

@ -21,6 +21,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.clipmenu" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services.clipmenu = {

View file

@ -27,6 +27,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.devilspie2" pkgs
lib.platforms.linux)
];
systemd.user.services.devilspie2 = {
Service.ExecStart = "${pkgs.devilspie2}/bin/devilspie2";
Unit = {

View file

@ -28,6 +28,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.dropbox" pkgs
lib.platforms.linux)
];
home.packages = [ pkgs.dropbox-cli ];
systemd.user.services.dropbox = {

View file

@ -53,6 +53,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.dwm-status" pkgs
lib.platforms.linux)
];
systemd.user.services.dwm-status = {
Unit = {
Description = "DWM status service";

View file

@ -75,6 +75,11 @@ in {
config = mkIf cfg.enable (mkMerge [
{
assertions = [
(lib.hm.assertions.assertPlatform "services.emacs" pkgs
lib.platforms.linux)
];
systemd.user.services.emacs = {
Unit = {
Description = "Emacs text editor";

View file

@ -45,6 +45,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.etesync-dav" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services.etesync-dav = {

View file

@ -13,6 +13,11 @@ in {
options = { services.flameshot = { enable = mkEnableOption "Flameshot"; }; };
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.flameshot" pkgs
lib.platforms.linux)
];
home.packages = [ package ];
systemd.user.services.flameshot = {

View file

@ -37,6 +37,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.fluidsynth" pkgs
lib.platforms.linux)
];
systemd.user.services.fluidsynth = {
Unit = {
Description = "FluidSynth Daemon";

View file

@ -37,6 +37,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.getmail" pkgs
lib.platforms.linux)
];
systemd.user.services.getmail = {
Unit = { Description = "getmail email fetcher"; };
Service = { ExecStart = "${pkgs.getmail}/bin/getmail ${configFiles}"; };

View file

@ -25,6 +25,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.gnome-keyring" pkgs
lib.platforms.linux)
];
systemd.user.services.gnome-keyring = {
Unit = {
Description = "GNOME Keyring";

View file

@ -71,6 +71,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.grobi" pkgs
lib.platforms.linux)
];
systemd.user.services.grobi = {
Unit = {
Description = "grobi display auto config daemon";

View file

@ -59,6 +59,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.hound" pkgs
lib.platforms.linux)
];
home.packages = [ pkgs.hound ];
systemd.user.services.hound = {

View file

@ -77,6 +77,8 @@ in {
+ concatMapStringsSep ", " (a: a.name) badAccounts;
};
in [
(lib.hm.assertions.assertPlatform "services.imapnotify" pkgs
lib.platforms.linux)
(checkAccounts (a: a.maildir == null) "maildir configuration")
(checkAccounts (a: a.imap == null) "IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "password command")

View file

@ -187,6 +187,10 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.kanshi" pkgs
lib.platforms.linux)
];
xdg.configFile."kanshi/config".text = ''
${concatStringsSep "\n" (mapAttrsToList profileStr cfg.profiles)}

View file

@ -32,6 +32,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.kbfs" pkgs
lib.platforms.linux)
];
systemd.user.services.kbfs = {
Unit = {
Description = "Keybase File System";

View file

@ -10,6 +10,11 @@ in {
options.services.keybase.enable = mkEnableOption "Keybase";
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.keybase" pkgs
lib.platforms.linux)
];
home.packages = [ pkgs.keybase ];
systemd.user.services.keybase = {

View file

@ -10,6 +10,11 @@ in {
options.services.keynav = { enable = mkEnableOption "keynav"; };
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.keynav" pkgs
lib.platforms.linux)
];
systemd.user.services.keynav = {
Unit = {
Description = "keynav";

View file

@ -61,6 +61,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.lieer" pkgs
lib.platforms.linux)
];
programs.lieer.enable = true;
systemd.user.services = listToAttrs (map serviceUnit syncAccounts);
systemd.user.timers = listToAttrs (map timerUnit syncAccounts);

View file

@ -21,6 +21,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.lorri" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user = {

View file

@ -292,7 +292,11 @@ in {
optionalString = name: val:
lib.optionalString (val != null) "${name}=${val}";
in mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "services.mako" pkgs platforms.linux) ];
home.packages = [ pkgs.mako ];
xdg.configFile."mako/config".text = ''
${optionalInteger "max-visible" cfg.maxVisible}
${optionalString "sort" cfg.sort}

View file

@ -76,6 +76,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.mbsync" pkgs
lib.platforms.linux)
];
systemd.user.services.mbsync = {
Unit = { Description = "mbsync mailbox synchronization"; };

View file

@ -143,6 +143,10 @@ in {
###### implementation
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.mpd" pkgs
lib.platforms.linux)
];
systemd.user.services.mpd = {
Unit = {

View file

@ -74,10 +74,15 @@ in {
};
config = mkIf cfg.enable {
assertions = [{
assertion = config.services.mpd.enable;
message = "The mpdris2 module requires 'services.mpd.enable = true'.";
}];
assertions = [
(lib.hm.assertions.assertPlatform "services.mpdris2" pkgs
lib.platforms.linux)
{
assertion = config.services.mpd.enable;
message = "The mpdris2 module requires 'services.mpd.enable = true'.";
}
];
xdg.configFile."mpDris2/mpDris2.conf".text = toIni mpdris2Conf;

View file

@ -13,6 +13,11 @@ in {
"a proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players";
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.mpris-proxy" pkgs
lib.platforms.linux)
];
systemd.user.services.mpris-proxy = {
Unit = {
Description =

View file

@ -156,12 +156,16 @@ in {
(name: remoteCfg: nameValuePair "muchsync-${name}" (gen name remoteCfg))
cfg.remotes;
in mkIf (cfg.remotes != { }) {
assertions = [{
assertion = config.programs.notmuch.enable;
message = ''
The muchsync module requires 'programs.notmuch.enable = true'.
'';
}];
assertions = [
(hm.assertions.assertPlatform "services.muchsync" pkgs platforms.linux)
{
assertion = config.programs.notmuch.enable;
message = ''
The muchsync module requires 'programs.notmuch.enable = true'.
'';
}
];
systemd.user.services = mapRemotes (name: remoteCfg: {
Unit = { Description = "muchsync sync service (${name})"; };

View file

@ -16,6 +16,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.network-manager-applet" pkgs
lib.platforms.linux)
];
systemd.user.services.network-manager-applet = {
Unit = {
Description = "Network Manager applet";

View file

@ -28,6 +28,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.nextcloud-client" pkgs
lib.platforms.linux)
];
systemd.user.services.nextcloud-client = {
Unit = {
Description = "Nextcloud Client";

View file

@ -55,6 +55,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.pantalaimon" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services = {

View file

@ -22,6 +22,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.parcellite" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services.parcellite = {

View file

@ -9,11 +9,16 @@ in {
enable = mkEnableOption "Pass libsecret service";
};
config = mkIf serviceCfg.enable {
assertions = [{
assertion = config.programs.password-store.enable;
message = "The 'services.pass-secret-service' module requires"
+ " 'programs.password-store.enable = true'.";
}];
assertions = [
(hm.assertions.assertPlatform "services.pass-secret-service" pkgs
platforms.linux)
{
assertion = config.programs.password-store.enable;
message = "The 'services.pass-secret-service' module requires"
+ " 'programs.password-store.enable = true'.";
}
];
systemd.user.services.pass-secret-service = {
Unit = { Description = "Pass libsecret service"; };

View file

@ -33,11 +33,16 @@ in {
};
config = mkIf serviceCfg.enable {
assertions = [{
assertion = programCfg.enable;
message = "The 'services.password-store-sync' module requires"
+ " 'programs.password-store.enable = true'.";
}];
assertions = [
(hm.assertions.assertPlatform "services.password-store-sync" pkgs
platforms.linux)
{
assertion = programCfg.enable;
message = "The 'services.password-store-sync' module requires"
+ " 'programs.password-store.enable = true'.";
}
];
systemd.user.services.password-store-sync = {
Unit = { Description = "Password store sync"; };

View file

@ -50,6 +50,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.pbgopy" pkgs
lib.platforms.linux)
];
home.packages = [ package ];
systemd.user.services.pbgopy = {

View file

@ -283,6 +283,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.picom" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services.picom = {

View file

@ -16,7 +16,10 @@ in {
mkEnableOption "the Plan 9 file system for interprocess messaging";
};
config = {
config = mkIf (cfg.fontsrv.enable || cfg.plumber.enable) {
assertions = [
(hm.assertions.assertPlatform "services.plan9port" pkgs platforms.linux)
];
systemd.user.services.fontsrv = mkIf cfg.fontsrv.enable {
Unit.Description = "the Plan 9 file system access to host fonts";

View file

@ -21,6 +21,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.playerctld" pkgs
lib.platforms.linux)
];
systemd.user.services.playerctld = {
Unit.Description = "MPRIS media player daemon";

View file

@ -191,6 +191,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.polybar" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile."polybar/config".source = configFile;

View file

@ -11,6 +11,11 @@ in {
mkEnableOption "the Upower-powered power alerterd";
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.poweralertd" pkgs
lib.platforms.linux)
];
systemd.user.services.poweralertd = {
Unit = {
Description = "UPower-powered power alerter";

View file

@ -33,6 +33,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.pulseeffects" pkgs
lib.platforms.linux)
];
# running pulseeffects will just attach itself to gapplication service
# at-spi2-core is to minimize journalctl noise of:
# "AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files"

View file

@ -146,20 +146,25 @@ in {
};
config = {
assertions = [{
assertion = (cfg.settings ? ${mainSection}.dawn-time || cfg.settings
? ${mainSection}.dusk-time)
|| (cfg.settings.${mainSection}.location-provider) == "geoclue2"
|| ((cfg.settings.${mainSection}.location-provider) == "manual"
&& (cfg.settings ? manual.lat || cfg.settings ? manual.lon));
message = ''
In order for ${programName} to know the time of action, you need to set one of
- services.${moduleName}.provider = "geoclue2" for automatically inferring your location
(you also need to enable Geoclue2 service separately)
- services.${moduleName}.longitude and .latitude for specifying your location manually
- services.${moduleName}.dawnTime and .duskTime for specifying the times manually
'';
}];
assertions = [
(hm.assertions.assertPlatform "services.${moduleName}" pkgs
platforms.linux)
{
assertion = (cfg.settings ? ${mainSection}.dawn-time || cfg.settings
? ${mainSection}.dusk-time)
|| (cfg.settings.${mainSection}.location-provider) == "geoclue2"
|| ((cfg.settings.${mainSection}.location-provider) == "manual"
&& (cfg.settings ? manual.lat || cfg.settings ? manual.lon));
message = ''
In order for ${programName} to know the time of action, you need to set one of
- services.${moduleName}.provider = "geoclue2" for automatically inferring your location
(you also need to enable Geoclue2 service separately)
- services.${moduleName}.longitude and .latitude for specifying your location manually
- services.${moduleName}.dawnTime and .duskTime for specifying the times manually
'';
}
];
services.${moduleName}.settings = {
${mainSection} = {

View file

@ -14,6 +14,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.rsibreak" pkgs
lib.platforms.linux)
];
home.packages = [ pkgs.rsibreak ];
systemd.user.services.rsibreak = {
Unit = {

View file

@ -53,6 +53,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.screen-locker" pkgs
lib.platforms.linux)
];
systemd.user.services.xautolock-session = {
Unit = {
Description = "xautolock, session locker service";

View file

@ -43,6 +43,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.spotifyd" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services.spotifyd = {

View file

@ -26,6 +26,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.status-notifier-watcher" pkgs
lib.platforms.linux)
];
systemd.user.services.status-notifier-watcher = {
Unit = {
Description = "SNI watcher";

View file

@ -65,6 +65,11 @@ in
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.sxhkd" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile."sxhkd/sxhkdrc".text = concatStringsSep "\n" [

View file

@ -29,6 +29,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.taskwarrior-sync" pkgs
lib.platforms.linux)
];
systemd.user.services.taskwarrior-sync = {
Unit = { Description = "Taskwarrior sync"; };
Service = {

View file

@ -37,6 +37,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.unclutter" pkgs
lib.platforms.linux)
];
systemd.user.services.unclutter = {
Unit = {
Description = "unclutter";

View file

@ -93,6 +93,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.unison" pkgs
lib.platforms.linux)
];
systemd.user.services = makeDefs (name: pairCfg: {
Unit = {
Description = "Unison pair sync (${name})";

View file

@ -45,7 +45,13 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "xsession.windowManager.awesome" pkgs
platforms.linux)
];
home.packages = [ awesome ];
xsession.windowManager.command = "${awesome}/bin/awesome "
+ optionalString cfg.noArgb "--no-argb " + makeSearchPath cfg.luaModules;
};

View file

@ -42,6 +42,11 @@ in {
options = import ./options.nix { inherit pkgs lib; };
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "xsession.windowManager.bspwm" pkgs
platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile."bspwm/bspwmrc".source = pkgs.writeShellScript "bspwmrc" ''

View file

@ -241,8 +241,15 @@ in {
config = mkIf cfg.enable (mkMerge [
{
assertions = [
(hm.assertions.assertPlatform "xsession.windowManager.i3" pkgs
platforms.linux)
];
home.packages = [ cfg.package ];
xsession.windowManager.command = "${cfg.package}/bin/i3";
xdg.configFile."i3/config" = {
source = checkI3Config;
onChange = ''

View file

@ -427,8 +427,14 @@ in {
})
{
assertions = [
(hm.assertions.assertPlatform "wayland.windowManager.sway" pkgs
platforms.linux)
];
home.packages = optional (cfg.package != null) cfg.package
++ optional cfg.xwayland pkgs.xwayland;
xdg.configFile."sway/config" = {
source = configFile;
onChange = ''
@ -439,6 +445,7 @@ in {
fi
'';
};
systemd.user.targets.sway-session = mkIf cfg.systemdIntegration {
Unit = {
Description = "sway compositor session";

View file

@ -137,10 +137,23 @@ in {
}/bin/xmonad-${pkgs.hostPlatform.system}";
in mkIf cfg.enable (mkMerge [
{ home.packages = [ (lowPrio xmonad) ]; }
{
assertions = [
(hm.assertions.assertPlatform "xsession.windowManager.xmonad" pkgs
platforms.linux)
];
home.packages = [ (lowPrio xmonad) ];
home.file = mapAttrs' (name: value:
attrsets.nameValuePair (".xmonad/lib/" + name) { source = value; })
cfg.libFiles;
}
(mkIf (cfg.config == null) {
xsession.windowManager.command = "${xmonad}/bin/xmonad";
})
(mkIf (cfg.config != null) {
xsession.windowManager.command = xmonadBin;
home.file.".xmonad/xmonad.hs".source = cfg.config;
@ -156,10 +169,5 @@ in {
};
})
{
home.file = mapAttrs' (name: value:
attrsets.nameValuePair (".xmonad/lib/" + name) { source = value; })
cfg.libFiles;
}
]);
}

View file

@ -73,6 +73,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.wlsunset" pkgs
lib.platforms.linux)
];
systemd.user.services.wlsunset = {
Unit = {
Description = "Day/night gamma adjustments for Wayland compositors.";

View file

@ -53,6 +53,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.xcape" pkgs
lib.platforms.linux)
];
systemd.user.services.xcape = {
Unit = {
Description = "xcape";

View file

@ -26,6 +26,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.xembed-sni-proxy" pkgs
lib.platforms.linux)
];
systemd.user.services.xembed-sni-proxy = {
Unit = {
Description = "XEmbed SNI Proxy";

View file

@ -132,6 +132,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.xidlehook" pkgs
lib.platforms.linux)
];
systemd.user.services.xidlehook = {
Unit = {
Description = "xidlehook service";

View file

@ -29,6 +29,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.xscreensaver" pkgs
lib.platforms.linux)
];
# To make the xscreensaver-command tool available.
home.packages = [ pkgs.xscreensaver ];

View file

@ -25,6 +25,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.xsettingsd" pkgs
lib.platforms.linux)
];
systemd.user.services.xsettingsd = {
Unit = {
Description = "xsettingsd";

View file

@ -148,6 +148,11 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.xsuspender" pkgs
lib.platforms.linux)
];
services.xsuspender.iniContent = let
mkSection = values:
filterAttrs (_: v: v != null) {

View file

@ -43,6 +43,11 @@ in {
};
config = mkIf (activationCmds != [ ]) {
assertions = [
(hm.assertions.assertPlatform "targets.darwin.defaults" pkgs
platforms.darwin)
];
home.activation.setDarwinDefaults = hm.dag.entryAfter [ "writeBoundary" ] ''
$VERBOSE_ECHO "Configuring macOS user defaults"
${concatStringsSep "\n" activationCmds}

View file

@ -12,16 +12,18 @@ let
fonts = "${fontsEnv}/share/fonts";
in {
# macOS won't recognize symlinked fonts
config.home.activation.copyFonts = hm.dag.entryAfter [ "writeBoundary" ] ''
copyFonts() {
rm -rf ${homeDir}/Library/Fonts/HomeManager || :
config = mkIf pkgs.hostPlatform.isDarwin {
home.activation.copyFonts = hm.dag.entryAfter [ "writeBoundary" ] ''
copyFonts() {
rm -rf ${homeDir}/Library/Fonts/HomeManager || :
local f
find -L "${fonts}" -type f -printf '%P\0' | while IFS= read -rd "" f; do
$DRY_RUN_CMD install $VERBOSE_ARG -Dm644 -T \
"${fonts}/$f" "${homeDir}/Library/Fonts/HomeManager/$f"
done
}
copyFonts
'';
local f
find -L "${fonts}" -type f -printf '%P\0' | while IFS= read -rd "" f; do
$DRY_RUN_CMD install $VERBOSE_ARG -Dm644 -T \
"${fonts}/$f" "${homeDir}/Library/Fonts/HomeManager/$f"
done
}
copyFonts
'';
};
}

View file

@ -31,6 +31,11 @@ in {
};
config = mkIf (cfg.keybindings != { }) {
assertions = [
(hm.assertions.assertPlatform "targets.darwin.keybindings" pkgs
platforms.darwin)
];
# NOTE: just copy the files because symlinks won't be recognized by macOS
home.activation.setCocoaKeybindings =
hm.dag.entryAfter [ "writeBoundary" ] ''

View file

@ -20,6 +20,11 @@ in {
};
config = mkIf (cfg.search != null) {
assertions = [
(hm.assertions.assertPlatform "targets.darwin.search" pkgs
platforms.darwin)
];
targets.darwin.defaults = {
NSGlobalDomain.NSPreferredWebServices = {
NSWebServicesProviderWebSearch = {

View file

@ -27,6 +27,10 @@ in {
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "targets.genericLinux" pkgs platforms.linux)
];
xdg.systemDirs.data = [
# Nix profiles
"\${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share"

View file

@ -55,6 +55,10 @@ in {
};
config = mkIf (cfg != null) {
assertions = [
(hm.assertions.assertPlatform "xsession.pointerCursor" pkgs
platforms.linux)
];
home.packages = [ cfg.package ];

View file

@ -85,6 +85,9 @@ in {
};
config = mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "xsession" pkgs platforms.linux) ];
xsession.importedVariables = [
"DBUS_SESSION_BUS_ADDRESS"
"DISPLAY"