From 17dc5939309bb24c02133d67341fe9a791523c6f Mon Sep 17 00:00:00 2001 From: midchildan Date: Sun, 24 Apr 2022 23:25:54 +0900 Subject: [PATCH] modules: add platform assertions --- modules/services/blueman-applet.nix | 5 +++++ modules/services/dunst.nix | 4 ++++ modules/services/gpg-agent.nix | 4 ++++ modules/services/kdeconnect.nix | 10 ++++++++++ modules/services/keepassx.nix | 4 ++++ modules/services/mpd-discord-rpc.nix | 5 +++++ modules/services/owncloud-client.nix | 5 +++++ modules/services/pasystray.nix | 4 ++++ modules/services/picom.nix | 5 +++++ modules/services/random-background.nix | 5 +++++ modules/services/stalonetray.nix | 5 +++++ modules/services/swayidle.nix | 4 ++++ modules/services/syncthing.nix | 10 ++++++++++ modules/services/taffybar.nix | 4 ++++ modules/services/tahoe-lafs.nix | 4 ++++ modules/services/udiskie.nix | 4 ++++ 16 files changed, 82 insertions(+) diff --git a/modules/services/blueman-applet.nix b/modules/services/blueman-applet.nix index 460dd1677..d81db1dbb 100644 --- a/modules/services/blueman-applet.nix +++ b/modules/services/blueman-applet.nix @@ -21,6 +21,11 @@ with lib; }; config = mkIf config.services.blueman-applet.enable { + assertions = [ + (hm.assertions.assertPlatform "services.blueman-applet" pkgs + platforms.linux) + ]; + systemd.user.services.blueman-applet = { Unit = { Description = "Blueman applet"; diff --git a/modules/services/dunst.nix b/modules/services/dunst.nix index b98b645e4..8606e2481 100644 --- a/modules/services/dunst.nix +++ b/modules/services/dunst.nix @@ -130,6 +130,10 @@ in { config = mkIf cfg.enable (mkMerge [ { + assertions = [ + (hm.assertions.assertPlatform "services.dunst" pkgs platforms.linux) + ]; + home.packages = [ cfg.package ]; xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source = diff --git a/modules/services/gpg-agent.nix b/modules/services/gpg-agent.nix index fb59d7092..39e93669f 100644 --- a/modules/services/gpg-agent.nix +++ b/modules/services/gpg-agent.nix @@ -263,6 +263,10 @@ in { # # directory. { + assertions = [ + (hm.assertions.assertPlatform "services.gpg-agent" pkgs platforms.linux) + ]; + systemd.user.services.gpg-agent = { Unit = { Description = "GnuPG cryptographic agent and passphrase cache"; diff --git a/modules/services/kdeconnect.nix b/modules/services/kdeconnect.nix index 87c57c4e9..0c6aac31e 100644 --- a/modules/services/kdeconnect.nix +++ b/modules/services/kdeconnect.nix @@ -27,6 +27,11 @@ in { (mkIf cfg.enable { home.packages = [ package ]; + assertions = [ + (hm.assertions.assertPlatform "services.kdeconnect" pkgs + platforms.linux) + ]; + systemd.user.services.kdeconnect = { Unit = { Description = @@ -46,6 +51,11 @@ in { }) (mkIf cfg.indicator { + assertions = [ + (hm.assertions.assertPlatform "services.kdeconnect" pkgs + platforms.linux) + ]; + systemd.user.services.kdeconnect-indicator = { Unit = { Description = "kdeconnect-indicator"; diff --git a/modules/services/keepassx.nix b/modules/services/keepassx.nix index dc37066e2..7f8582361 100644 --- a/modules/services/keepassx.nix +++ b/modules/services/keepassx.nix @@ -12,6 +12,10 @@ with lib; }; config = mkIf config.services.keepassx.enable { + assertions = [ + (hm.assertions.assertPlatform "services.keepassx" pkgs platforms.linux) + ]; + systemd.user.services.keepassx = { Unit = { Description = "KeePassX password manager"; diff --git a/modules/services/mpd-discord-rpc.nix b/modules/services/mpd-discord-rpc.nix index 5e7a6664b..50bc824b0 100644 --- a/modules/services/mpd-discord-rpc.nix +++ b/modules/services/mpd-discord-rpc.nix @@ -39,6 +39,11 @@ in { }; config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "services.mpd-discord-rpc" pkgs + platforms.linux) + ]; + xdg.configFile."discord-rpc/config.toml".source = configFile; systemd.user.services.mpd-discord-rpc = { diff --git a/modules/services/owncloud-client.nix b/modules/services/owncloud-client.nix index d55d8ffa2..4eeafcf0a 100644 --- a/modules/services/owncloud-client.nix +++ b/modules/services/owncloud-client.nix @@ -8,6 +8,11 @@ with lib; }; config = mkIf config.services.owncloud-client.enable { + assertions = [ + (hm.assertions.assertPlatform "services.owncloud-client" pkgs + platforms.linux) + ]; + systemd.user.services.owncloud-client = { Unit = { Description = "Owncloud Client"; diff --git a/modules/services/pasystray.nix b/modules/services/pasystray.nix index 15c951e13..32922ad0f 100644 --- a/modules/services/pasystray.nix +++ b/modules/services/pasystray.nix @@ -10,6 +10,10 @@ with lib; }; config = mkIf config.services.pasystray.enable { + assertions = [ + (hm.assertions.assertPlatform "services.pasystray" pkgs platforms.linux) + ]; + systemd.user.services.pasystray = { Unit = { Description = "PulseAudio system tray"; diff --git a/modules/services/picom.nix b/modules/services/picom.nix index f4f8edb43..66f707c0a 100644 --- a/modules/services/picom.nix +++ b/modules/services/picom.nix @@ -270,6 +270,11 @@ in { }; config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.picom" pkgs + lib.platforms.linux) + ]; + services.picom.settings = mkDefaultAttrs { # fading fading = cfg.fade; diff --git a/modules/services/random-background.nix b/modules/services/random-background.nix index 9deee8deb..16c869a9c 100644 --- a/modules/services/random-background.nix +++ b/modules/services/random-background.nix @@ -68,6 +68,11 @@ in { config = mkIf cfg.enable (mkMerge ([ { + assertions = [ + (hm.assertions.assertPlatform "services.random-background" pkgs + platforms.linux) + ]; + systemd.user.services.random-background = { Unit = { Description = "Set random desktop background using feh"; diff --git a/modules/services/stalonetray.nix b/modules/services/stalonetray.nix index 93fff3e7b..172d6dd9d 100644 --- a/modules/services/stalonetray.nix +++ b/modules/services/stalonetray.nix @@ -51,6 +51,11 @@ in { config = mkIf cfg.enable (mkMerge [ { + assertions = [ + (hm.assertions.assertPlatform "services.stalonetray" pkgs + platforms.linux) + ]; + home.packages = [ cfg.package ]; systemd.user.services.stalonetray = { diff --git a/modules/services/swayidle.nix b/modules/services/swayidle.nix index db54f9e27..6e8b55cb8 100644 --- a/modules/services/swayidle.nix +++ b/modules/services/swayidle.nix @@ -108,6 +108,10 @@ in { }; config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "services.swayidle" pkgs platforms.linux) + ]; + systemd.user.services.swayidle = { Unit = { Description = "Idle manager for Wayland"; diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index 2f9cecdb4..bbe9f8660 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -98,6 +98,11 @@ in { }) (mkIf (isAttrs cfg.tray && cfg.tray.enable) { + assertions = [ + (hm.assertions.assertPlatform "services.syncthing.tray" pkgs + platforms.linux) + ]; + systemd.user.services = { ${cfg.tray.package.pname} = { Unit = { @@ -118,6 +123,11 @@ in { # deprecated (mkIf (isBool cfg.tray && cfg.tray) { + assertions = [ + (hm.assertions.assertPlatform "services.syncthing.tray" pkgs + platforms.linux) + ]; + systemd.user.services = { "syncthingtray" = { Unit = { diff --git a/modules/services/taffybar.nix b/modules/services/taffybar.nix index 088827b95..42ca5f7bb 100644 --- a/modules/services/taffybar.nix +++ b/modules/services/taffybar.nix @@ -24,6 +24,10 @@ in { }; config = mkIf config.services.taffybar.enable { + assertions = [ + (hm.assertions.assertPlatform "services.taffybar" pkgs platforms.linux) + ]; + systemd.user.services.taffybar = { Unit = { Description = "Taffybar desktop bar"; diff --git a/modules/services/tahoe-lafs.nix b/modules/services/tahoe-lafs.nix index 742b779b2..105ef3d03 100644 --- a/modules/services/tahoe-lafs.nix +++ b/modules/services/tahoe-lafs.nix @@ -10,6 +10,10 @@ with lib; }; config = mkIf config.services.tahoe-lafs.enable { + assertions = [ + (hm.assertions.assertPlatform "services.tahoe-lafs" pkgs platforms.linux) + ]; + systemd.user.services.tahoe-lafs = { Unit = { Description = "Tahoe-LAFS"; }; diff --git a/modules/services/udiskie.nix b/modules/services/udiskie.nix index d53d7cc8a..562297963 100644 --- a/modules/services/udiskie.nix +++ b/modules/services/udiskie.nix @@ -98,6 +98,10 @@ in { }; config = mkIf config.services.udiskie.enable { + assertions = [ + (hm.assertions.assertPlatform "services.udiskie" pkgs platforms.linux) + ]; + xdg.configFile."udiskie/config.yml".source = yaml.generate "udiskie-config.yml" (mergeSets [ {