diff --git a/doc/release-notes/rl-2111.adoc b/doc/release-notes/rl-2111.adoc index 63986f95..14216eff 100644 --- a/doc/release-notes/rl-2111.adoc +++ b/doc/release-notes/rl-2111.adoc @@ -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 diff --git a/modules/config/i18n.nix b/modules/config/i18n.nix index 9fca360d..c795bbcf 100644 --- a/modules/config/i18n.nix +++ b/modules/config/i18n.nix @@ -36,7 +36,7 @@ let in { meta.maintainers = with maintainers; [ midchildan ]; - config = { + config = mkIf pkgs.hostPlatform.isLinux { # For shell sessions. home.sessionVariables = localeVars; diff --git a/modules/i18n/input-method/default.nix b/modules/i18n/input-method/default.nix index 0abfec17..27b3ae86 100644 --- a/modules/i18n/input-method/default.nix +++ b/modules/i18n/input-method/default.nix @@ -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 ]; }; diff --git a/modules/lib/assertions.nix b/modules/lib/assertions.nix new file mode 100644 index 00000000..1089c27b --- /dev/null +++ b/modules/lib/assertions.nix @@ -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}''; + }; +} diff --git a/modules/lib/default.nix b/modules/lib/default.nix index 7c2c72f7..c087c810 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -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; }; diff --git a/modules/misc/numlock.nix b/modules/misc/numlock.nix index c823f6db..88032417 100644 --- a/modules/misc/numlock.nix +++ b/modules/misc/numlock.nix @@ -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"; diff --git a/modules/misc/tmpfiles.nix b/modules/misc/tmpfiles.nix index c46fe2c5..24884302 100644 --- a/modules/misc/tmpfiles.nix +++ b/modules/misc/tmpfiles.nix @@ -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 = '' diff --git a/modules/misc/xdg-desktop-entries.nix b/modules/misc/xdg-desktop-entries.nix index 382d6c2b..73452c07 100644 --- a/modules/misc/xdg-desktop-entries.nix +++ b/modules/misc/xdg-desktop-entries.nix @@ -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)); + }; } diff --git a/modules/misc/xdg-mime-apps.nix b/modules/misc/xdg-mime-apps.nix index 81d2ba0f..c7867d44 100644 --- a/modules/misc/xdg-mime-apps.nix +++ b/modules/misc/xdg-mime-apps.nix @@ -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; diff --git a/modules/misc/xdg-mime.nix b/modules/misc/xdg-mime.nix index 5999e129..9a6d7860 100644 --- a/modules/misc/xdg-mime.nix +++ b/modules/misc/xdg-mime.nix @@ -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 diff --git a/modules/misc/xdg-system-dirs.nix b/modules/misc/xdg-system-dirs.nix index f79ebc55..87624458 100644 --- a/modules/misc/xdg-system-dirs.nix +++ b/modules/misc/xdg-system-dirs.nix @@ -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}"; diff --git a/modules/misc/xdg-user-dirs.nix b/modules/misc/xdg-user-dirs.nix index 6694b52d..78d350cd 100644 --- a/modules/misc/xdg-user-dirs.nix +++ b/modules/misc/xdg-user-dirs.nix @@ -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; diff --git a/modules/modules.nix b/modules/modules.nix index 8b76f6c0..a82c3cb6 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -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 = { diff --git a/modules/programs/abook.nix b/modules/programs/abook.nix index 4ddc080a..bdbf7e87 100644 --- a/modules/programs/abook.nix +++ b/modules/programs/abook.nix @@ -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. diff --git a/modules/programs/foot.nix b/modules/programs/foot.nix index 8df201fd..f02c5b3c 100644 --- a/modules/programs/foot.nix +++ b/modules/programs/foot.nix @@ -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 != { }) { diff --git a/modules/programs/getmail.nix b/modules/programs/getmail.nix index eaf297cf..53e39b43 100644 --- a/modules/programs/getmail.nix +++ b/modules/programs/getmail.nix @@ -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); diff --git a/modules/programs/i3status-rust.nix b/modules/programs/i3status-rust.nix index 5d721cc5..b20b5f27 100644 --- a/modules/programs/i3status-rust.nix +++ b/modules/programs/i3status-rust.nix @@ -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: diff --git a/modules/programs/mangohud.nix b/modules/programs/mangohud.nix index 3a2158e3..b85203e4 100644 --- a/modules/programs/mangohud.nix +++ b/modules/programs/mangohud.nix @@ -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 ]; } diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index f4f7594e..2c06aae4 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -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"; diff --git a/modules/programs/terminator.nix b/modules/programs/terminator.nix index d100a9cd..831d7263 100644 --- a/modules/programs/terminator.nix +++ b/modules/programs/terminator.nix @@ -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; }; }; diff --git a/modules/programs/waybar.nix b/modules/programs/waybar.nix index 3cf919cc..207d311c 100644 --- a/modules/programs/waybar.nix +++ b/modules/programs/waybar.nix @@ -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 = { diff --git a/modules/services/barrier.nix b/modules/services/barrier.nix index ae9b7d93..5b34e1af 100644 --- a/modules/services/barrier.nix +++ b/modules/services/barrier.nix @@ -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"; diff --git a/modules/services/caffeine.nix b/modules/services/caffeine.nix index bb24a0e0..28ebc7f1 100644 --- a/modules/services/caffeine.nix +++ b/modules/services/caffeine.nix @@ -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"; }; diff --git a/modules/services/cbatticon.nix b/modules/services/cbatticon.nix index a86805dd..1216878c 100644 --- a/modules/services/cbatticon.nix +++ b/modules/services/cbatticon.nix @@ -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 = { diff --git a/modules/services/clipmenu.nix b/modules/services/clipmenu.nix index 2e1c10e4..3f2055c9 100644 --- a/modules/services/clipmenu.nix +++ b/modules/services/clipmenu.nix @@ -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 = { diff --git a/modules/services/devilspie2.nix b/modules/services/devilspie2.nix index 4b93217c..fa77153e 100644 --- a/modules/services/devilspie2.nix +++ b/modules/services/devilspie2.nix @@ -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 = { diff --git a/modules/services/dropbox.nix b/modules/services/dropbox.nix index bcf3ba2b..81cf8881 100644 --- a/modules/services/dropbox.nix +++ b/modules/services/dropbox.nix @@ -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 = { diff --git a/modules/services/dwm-status.nix b/modules/services/dwm-status.nix index a0c2a724..005e9dca 100644 --- a/modules/services/dwm-status.nix +++ b/modules/services/dwm-status.nix @@ -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"; diff --git a/modules/services/emacs.nix b/modules/services/emacs.nix index 96c86ee7..fecb19f4 100644 --- a/modules/services/emacs.nix +++ b/modules/services/emacs.nix @@ -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"; diff --git a/modules/services/etesync-dav.nix b/modules/services/etesync-dav.nix index 8bc5aa7a..76819aaf 100644 --- a/modules/services/etesync-dav.nix +++ b/modules/services/etesync-dav.nix @@ -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 = { diff --git a/modules/services/flameshot.nix b/modules/services/flameshot.nix index 13fb7ea2..ed523561 100644 --- a/modules/services/flameshot.nix +++ b/modules/services/flameshot.nix @@ -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 = { diff --git a/modules/services/fluidsynth.nix b/modules/services/fluidsynth.nix index 18913fe5..1b5a0c5f 100644 --- a/modules/services/fluidsynth.nix +++ b/modules/services/fluidsynth.nix @@ -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"; diff --git a/modules/services/getmail.nix b/modules/services/getmail.nix index e7a1b1a4..83ed4ed4 100644 --- a/modules/services/getmail.nix +++ b/modules/services/getmail.nix @@ -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}"; }; diff --git a/modules/services/gnome-keyring.nix b/modules/services/gnome-keyring.nix index 7e3f8bbc..7267129d 100644 --- a/modules/services/gnome-keyring.nix +++ b/modules/services/gnome-keyring.nix @@ -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"; diff --git a/modules/services/grobi.nix b/modules/services/grobi.nix index 4dfc5d63..682458fd 100644 --- a/modules/services/grobi.nix +++ b/modules/services/grobi.nix @@ -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"; diff --git a/modules/services/hound.nix b/modules/services/hound.nix index 07b5d476..12c1f5d5 100644 --- a/modules/services/hound.nix +++ b/modules/services/hound.nix @@ -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 = { diff --git a/modules/services/imapnotify.nix b/modules/services/imapnotify.nix index 4b3ebda7..5d7c5f4b 100644 --- a/modules/services/imapnotify.nix +++ b/modules/services/imapnotify.nix @@ -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") diff --git a/modules/services/kanshi.nix b/modules/services/kanshi.nix index 8df32121..ce6e2522 100644 --- a/modules/services/kanshi.nix +++ b/modules/services/kanshi.nix @@ -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)} diff --git a/modules/services/kbfs.nix b/modules/services/kbfs.nix index d4be2592..4f1bfd8b 100644 --- a/modules/services/kbfs.nix +++ b/modules/services/kbfs.nix @@ -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"; diff --git a/modules/services/keybase.nix b/modules/services/keybase.nix index 0aec0bbc..f6e40086 100644 --- a/modules/services/keybase.nix +++ b/modules/services/keybase.nix @@ -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 = { diff --git a/modules/services/keynav.nix b/modules/services/keynav.nix index c7f1df37..d83252e5 100644 --- a/modules/services/keynav.nix +++ b/modules/services/keynav.nix @@ -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"; diff --git a/modules/services/lieer.nix b/modules/services/lieer.nix index 71f0a66e..9dd8c15e 100644 --- a/modules/services/lieer.nix +++ b/modules/services/lieer.nix @@ -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); diff --git a/modules/services/lorri.nix b/modules/services/lorri.nix index 61836990..5e749532 100644 --- a/modules/services/lorri.nix +++ b/modules/services/lorri.nix @@ -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 = { diff --git a/modules/services/mako.nix b/modules/services/mako.nix index e8f4d38c..b09f90a1 100644 --- a/modules/services/mako.nix +++ b/modules/services/mako.nix @@ -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} diff --git a/modules/services/mbsync.nix b/modules/services/mbsync.nix index ac6ac1ef..b52b6885 100644 --- a/modules/services/mbsync.nix +++ b/modules/services/mbsync.nix @@ -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"; }; diff --git a/modules/services/mpd.nix b/modules/services/mpd.nix index a6ed0a48..5800a18c 100644 --- a/modules/services/mpd.nix +++ b/modules/services/mpd.nix @@ -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 = { diff --git a/modules/services/mpdris2.nix b/modules/services/mpdris2.nix index cb8cefba..88ea50af 100644 --- a/modules/services/mpdris2.nix +++ b/modules/services/mpdris2.nix @@ -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; diff --git a/modules/services/mpris-proxy.nix b/modules/services/mpris-proxy.nix index 69f56c21..9996b137 100644 --- a/modules/services/mpris-proxy.nix +++ b/modules/services/mpris-proxy.nix @@ -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 = diff --git a/modules/services/muchsync.nix b/modules/services/muchsync.nix index b7004418..39899bfb 100644 --- a/modules/services/muchsync.nix +++ b/modules/services/muchsync.nix @@ -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})"; }; diff --git a/modules/services/network-manager-applet.nix b/modules/services/network-manager-applet.nix index b84861a9..f4abe86e 100644 --- a/modules/services/network-manager-applet.nix +++ b/modules/services/network-manager-applet.nix @@ -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"; diff --git a/modules/services/nextcloud-client.nix b/modules/services/nextcloud-client.nix index 4e56c4f5..b787a6d6 100644 --- a/modules/services/nextcloud-client.nix +++ b/modules/services/nextcloud-client.nix @@ -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"; diff --git a/modules/services/pantalaimon.nix b/modules/services/pantalaimon.nix index 38662a34..ac049e50 100644 --- a/modules/services/pantalaimon.nix +++ b/modules/services/pantalaimon.nix @@ -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 = { diff --git a/modules/services/parcellite.nix b/modules/services/parcellite.nix index dddb0631..617fe6fb 100644 --- a/modules/services/parcellite.nix +++ b/modules/services/parcellite.nix @@ -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 = { diff --git a/modules/services/pass-secret-service.nix b/modules/services/pass-secret-service.nix index d2ed11ee..06b5be1f 100644 --- a/modules/services/pass-secret-service.nix +++ b/modules/services/pass-secret-service.nix @@ -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"; }; diff --git a/modules/services/password-store-sync.nix b/modules/services/password-store-sync.nix index 81933914..c8dbe808 100644 --- a/modules/services/password-store-sync.nix +++ b/modules/services/password-store-sync.nix @@ -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"; }; diff --git a/modules/services/pbgopy.nix b/modules/services/pbgopy.nix index f4fd4f53..487aa4f3 100644 --- a/modules/services/pbgopy.nix +++ b/modules/services/pbgopy.nix @@ -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 = { diff --git a/modules/services/picom.nix b/modules/services/picom.nix index 4c4da8de..617c0756 100644 --- a/modules/services/picom.nix +++ b/modules/services/picom.nix @@ -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 = { diff --git a/modules/services/plan9port.nix b/modules/services/plan9port.nix index 0f5893f2..24980472 100644 --- a/modules/services/plan9port.nix +++ b/modules/services/plan9port.nix @@ -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"; diff --git a/modules/services/playerctld.nix b/modules/services/playerctld.nix index 63e7b8fe..5e48896b 100644 --- a/modules/services/playerctld.nix +++ b/modules/services/playerctld.nix @@ -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"; diff --git a/modules/services/polybar.nix b/modules/services/polybar.nix index 8a8e9994..9f762777 100644 --- a/modules/services/polybar.nix +++ b/modules/services/polybar.nix @@ -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; diff --git a/modules/services/poweralertd.nix b/modules/services/poweralertd.nix index 39fffd7c..cae44c75 100644 --- a/modules/services/poweralertd.nix +++ b/modules/services/poweralertd.nix @@ -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"; diff --git a/modules/services/pulseeffects.nix b/modules/services/pulseeffects.nix index 184c2af7..bad04e4e 100644 --- a/modules/services/pulseeffects.nix +++ b/modules/services/pulseeffects.nix @@ -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" diff --git a/modules/services/redshift-gammastep/lib/options.nix b/modules/services/redshift-gammastep/lib/options.nix index 11ce9d7c..e79c5df1 100644 --- a/modules/services/redshift-gammastep/lib/options.nix +++ b/modules/services/redshift-gammastep/lib/options.nix @@ -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} = { diff --git a/modules/services/rsibreak.nix b/modules/services/rsibreak.nix index 5f07e6a0..351632a0 100644 --- a/modules/services/rsibreak.nix +++ b/modules/services/rsibreak.nix @@ -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 = { diff --git a/modules/services/screen-locker.nix b/modules/services/screen-locker.nix index 554d64f9..4da24b74 100644 --- a/modules/services/screen-locker.nix +++ b/modules/services/screen-locker.nix @@ -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"; diff --git a/modules/services/spotifyd.nix b/modules/services/spotifyd.nix index ee5af345..f15954d7 100644 --- a/modules/services/spotifyd.nix +++ b/modules/services/spotifyd.nix @@ -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 = { diff --git a/modules/services/status-notifier-watcher.nix b/modules/services/status-notifier-watcher.nix index 8ff1cace..b5d1bcd4 100644 --- a/modules/services/status-notifier-watcher.nix +++ b/modules/services/status-notifier-watcher.nix @@ -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"; diff --git a/modules/services/sxhkd.nix b/modules/services/sxhkd.nix index 9a2027a8..363c1fb2 100644 --- a/modules/services/sxhkd.nix +++ b/modules/services/sxhkd.nix @@ -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" [ diff --git a/modules/services/taskwarrior-sync.nix b/modules/services/taskwarrior-sync.nix index d16c0681..ddce6d6f 100644 --- a/modules/services/taskwarrior-sync.nix +++ b/modules/services/taskwarrior-sync.nix @@ -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 = { diff --git a/modules/services/unclutter.nix b/modules/services/unclutter.nix index 5e760639..3c70cd03 100644 --- a/modules/services/unclutter.nix +++ b/modules/services/unclutter.nix @@ -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"; diff --git a/modules/services/unison.nix b/modules/services/unison.nix index a9cf23fb..40b63ad4 100644 --- a/modules/services/unison.nix +++ b/modules/services/unison.nix @@ -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})"; diff --git a/modules/services/window-managers/awesome.nix b/modules/services/window-managers/awesome.nix index d2e2903f..15af2c2d 100644 --- a/modules/services/window-managers/awesome.nix +++ b/modules/services/window-managers/awesome.nix @@ -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; }; diff --git a/modules/services/window-managers/bspwm/default.nix b/modules/services/window-managers/bspwm/default.nix index c43be074..c2b8fd49 100644 --- a/modules/services/window-managers/bspwm/default.nix +++ b/modules/services/window-managers/bspwm/default.nix @@ -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" '' diff --git a/modules/services/window-managers/i3-sway/i3.nix b/modules/services/window-managers/i3-sway/i3.nix index 5cba45bd..e45d415d 100644 --- a/modules/services/window-managers/i3-sway/i3.nix +++ b/modules/services/window-managers/i3-sway/i3.nix @@ -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 = '' diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 61b430b8..6fed3701 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -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"; diff --git a/modules/services/window-managers/xmonad.nix b/modules/services/window-managers/xmonad.nix index 6d05d68e..78416024 100644 --- a/modules/services/window-managers/xmonad.nix +++ b/modules/services/window-managers/xmonad.nix @@ -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; - } ]); } diff --git a/modules/services/wlsunset.nix b/modules/services/wlsunset.nix index 084dbdb7..28e595af 100644 --- a/modules/services/wlsunset.nix +++ b/modules/services/wlsunset.nix @@ -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."; diff --git a/modules/services/xcape.nix b/modules/services/xcape.nix index f4f77caa..6b29d26e 100644 --- a/modules/services/xcape.nix +++ b/modules/services/xcape.nix @@ -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"; diff --git a/modules/services/xembed-sni-proxy.nix b/modules/services/xembed-sni-proxy.nix index ff63d108..f0a7e29e 100644 --- a/modules/services/xembed-sni-proxy.nix +++ b/modules/services/xembed-sni-proxy.nix @@ -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"; diff --git a/modules/services/xidlehook.nix b/modules/services/xidlehook.nix index da91de85..c39e3e3a 100644 --- a/modules/services/xidlehook.nix +++ b/modules/services/xidlehook.nix @@ -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"; diff --git a/modules/services/xscreensaver.nix b/modules/services/xscreensaver.nix index ac6194e7..3c0661e8 100644 --- a/modules/services/xscreensaver.nix +++ b/modules/services/xscreensaver.nix @@ -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 ]; diff --git a/modules/services/xsettingsd.nix b/modules/services/xsettingsd.nix index 2ae846b6..86336b21 100644 --- a/modules/services/xsettingsd.nix +++ b/modules/services/xsettingsd.nix @@ -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"; diff --git a/modules/services/xsuspender.nix b/modules/services/xsuspender.nix index 7d855f05..54f13c8d 100644 --- a/modules/services/xsuspender.nix +++ b/modules/services/xsuspender.nix @@ -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) { diff --git a/modules/targets/darwin/default.nix b/modules/targets/darwin/default.nix index b971e18d..d2764bd1 100644 --- a/modules/targets/darwin/default.nix +++ b/modules/targets/darwin/default.nix @@ -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} diff --git a/modules/targets/darwin/fonts.nix b/modules/targets/darwin/fonts.nix index bc4042a8..cd26fa08 100644 --- a/modules/targets/darwin/fonts.nix +++ b/modules/targets/darwin/fonts.nix @@ -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 + ''; + }; } diff --git a/modules/targets/darwin/keybindings.nix b/modules/targets/darwin/keybindings.nix index 4481f33b..824daa57 100644 --- a/modules/targets/darwin/keybindings.nix +++ b/modules/targets/darwin/keybindings.nix @@ -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" ] '' diff --git a/modules/targets/darwin/search.nix b/modules/targets/darwin/search.nix index 2afbae4a..8e0df3b2 100644 --- a/modules/targets/darwin/search.nix +++ b/modules/targets/darwin/search.nix @@ -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 = { diff --git a/modules/targets/generic-linux.nix b/modules/targets/generic-linux.nix index 6e17bd28..b7680885 100644 --- a/modules/targets/generic-linux.nix +++ b/modules/targets/generic-linux.nix @@ -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" diff --git a/modules/xcursor.nix b/modules/xcursor.nix index 65b5c770..620e2e28 100644 --- a/modules/xcursor.nix +++ b/modules/xcursor.nix @@ -55,6 +55,10 @@ in { }; config = mkIf (cfg != null) { + assertions = [ + (hm.assertions.assertPlatform "xsession.pointerCursor" pkgs + platforms.linux) + ]; home.packages = [ cfg.package ]; diff --git a/modules/xsession.nix b/modules/xsession.nix index b79c81c4..215d691d 100644 --- a/modules/xsession.nix +++ b/modules/xsession.nix @@ -85,6 +85,9 @@ in { }; config = mkIf cfg.enable { + assertions = + [ (hm.assertions.assertPlatform "xsession" pkgs platforms.linux) ]; + xsession.importedVariables = [ "DBUS_SESSION_BUS_ADDRESS" "DISPLAY"