From 3eff37c8aa98e12d62d669a94c27a4fee9a9e6e5 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 2 Aug 2024 16:42:37 -0400 Subject: [PATCH] home: convert mako to systemd service --- homeManagerModules/apps/default.nix | 1 - homeManagerModules/apps/mako/default.nix | 28 ----------- .../desktop/hyprland/settings.nix | 1 - homeManagerModules/desktop/sway/settings.nix | 1 - .../desktop/wayland/default.nix | 2 +- homeManagerModules/options.nix | 26 +++++----- homeManagerModules/services/default.nix | 1 + homeManagerModules/services/mako/default.nix | 49 +++++++++++++++++++ 8 files changed, 64 insertions(+), 45 deletions(-) delete mode 100644 homeManagerModules/apps/mako/default.nix create mode 100644 homeManagerModules/services/mako/default.nix diff --git a/homeManagerModules/apps/default.nix b/homeManagerModules/apps/default.nix index 395e2eb6..f34f7bef 100644 --- a/homeManagerModules/apps/default.nix +++ b/homeManagerModules/apps/default.nix @@ -12,7 +12,6 @@ ./kitty ./keepassxc ./librewolf - ./mako ./nemo ./rofi ./swaylock diff --git a/homeManagerModules/apps/mako/default.nix b/homeManagerModules/apps/mako/default.nix deleted file mode 100644 index bc4d0113..00000000 --- a/homeManagerModules/apps/mako/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - ... -}: { - config = lib.mkIf config.ar.home.apps.mako.enable { - services.mako = { - enable = true; - anchor = "top-center"; - backgroundColor = "${config.ar.home.theme.colors.background}CC"; - borderColor = "${config.ar.home.theme.colors.primary}EE"; - borderSize = 2; - borderRadius = 10; - defaultTimeout = 10000; - font = "${config.gtk.font.name} Regular ${toString config.gtk.font.size}"; - height = 300; - layer = "top"; - padding = "15"; - textColor = "${config.ar.home.theme.colors.text}"; - width = 400; - margin = "20,0"; - extraConfig = '' - [mode=do-not-disturb] - invisible=1 - ''; - }; - }; -} diff --git a/homeManagerModules/desktop/hyprland/settings.nix b/homeManagerModules/desktop/hyprland/settings.nix index 7076e268..9e3dc27b 100644 --- a/homeManagerModules/desktop/hyprland/settings.nix +++ b/homeManagerModules/desktop/hyprland/settings.nix @@ -126,7 +126,6 @@ in { exec-once = [ "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1" - (lib.getExe pkgs.mako) (lib.getExe pkgs.waybar) (lib.getExe pkgs.wayland-pipewire-idle-inhibit) ] diff --git a/homeManagerModules/desktop/sway/settings.nix b/homeManagerModules/desktop/sway/settings.nix index 67a1e10f..9dc9958d 100644 --- a/homeManagerModules/desktop/sway/settings.nix +++ b/homeManagerModules/desktop/sway/settings.nix @@ -159,7 +159,6 @@ in { [ {command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";} {command = lib.getExe pkgs.autotiling;} - {command = lib.getExe pkgs.mako;} {command = lib.getExe pkgs.wayland-pipewire-idle-inhibit;} ] ++ lib.optional cfg.desktop.randomWallpaper {command = "${helpers.wallpaperD}";} diff --git a/homeManagerModules/desktop/wayland/default.nix b/homeManagerModules/desktop/wayland/default.nix index 8e6dffed..b428b3fe 100644 --- a/homeManagerModules/desktop/wayland/default.nix +++ b/homeManagerModules/desktop/wayland/default.nix @@ -8,13 +8,13 @@ ar.home = { apps = { kitty.enable = lib.mkDefault true; - mako.enable = lib.mkDefault true; rofi.enable = lib.mkDefault true; swaylock.enable = lib.mkDefault true; waybar.enable = lib.mkDefault true; }; services = { + mako.enable = lib.mkDefault true; swayidle.enable = lib.mkDefault true; }; }; diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index dbcffe08..ebc180e7 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -53,7 +53,6 @@ in { kitty.enable = lib.mkEnableOption "Kitty terminal."; librewolf.enable = lib.mkEnableOption "Librewolf web browser."; - mako.enable = lib.mkEnableOption "Mako notification daemon."; nemo.enable = lib.mkOption { description = "Cinnamon Nemo file manager."; @@ -196,18 +195,6 @@ in { }; services = { - mpd = { - enable = lib.mkEnableOption "MPD user service."; - - musicDirectory = lib.mkOption { - description = "Name of music directory"; - default = config.xdg.userDirs.music; - type = lib.types.str; - }; - }; - - gammastep.enable = lib.mkEnableOption "Gammastep redshift daemon."; - easyeffects = { enable = lib.mkEnableOption "EasyEffects user service."; @@ -218,6 +205,19 @@ in { }; }; + gammastep.enable = lib.mkEnableOption "Gammastep redshift daemon."; + mako.enable = lib.mkEnableOption "Mako notification daemon."; + + mpd = { + enable = lib.mkEnableOption "MPD user service."; + + musicDirectory = lib.mkOption { + description = "Name of music directory"; + default = config.xdg.userDirs.music; + type = lib.types.str; + }; + }; + swayidle.enable = lib.mkEnableOption "Swayidle idle daemon."; }; diff --git a/homeManagerModules/services/default.nix b/homeManagerModules/services/default.nix index cd6882b7..d0105b03 100644 --- a/homeManagerModules/services/default.nix +++ b/homeManagerModules/services/default.nix @@ -2,6 +2,7 @@ imports = [ ./easyeffects ./gammastep + ./mako ./mpd ./swayidle ]; diff --git a/homeManagerModules/services/mako/default.nix b/homeManagerModules/services/mako/default.nix new file mode 100644 index 00000000..a22d787e --- /dev/null +++ b/homeManagerModules/services/mako/default.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + pkgs, + ... +}: { + config = lib.mkIf config.ar.home.services.mako.enable { + services.mako = { + enable = true; + anchor = "top-center"; + backgroundColor = "${config.ar.home.theme.colors.background}CC"; + borderColor = "${config.ar.home.theme.colors.primary}EE"; + borderSize = 2; + borderRadius = 10; + defaultTimeout = 10000; + font = "${config.gtk.font.name} Regular ${toString config.gtk.font.size}"; + height = 300; + layer = "top"; + padding = "15"; + textColor = "${config.ar.home.theme.colors.text}"; + width = 400; + margin = "20,0"; + extraConfig = '' + [mode=do-not-disturb] + invisible=1 + ''; + }; + + systemd.user.services.mako = { + Unit = { + After = "graphical-session.target"; + Description = "Lightweight Wayland notification daemon"; + Documentation = "man:mako(1)"; + PartOf = "graphical-session.target"; + }; + + Service = { + BusName = "org.freedesktop.Notifications"; + ExecReload = ''${lib.getExe' pkgs.mako "makoctl"} reload''; + ExecStart = "${lib.getExe pkgs.mako}"; + Restart = "on-failure"; + RestartSec = 5; + Type = "dbus"; + }; + + Install.WantedBy = ["hyprland-session.target" "sway-session.target"]; + }; + }; +}