From 0215073a704e9b8992d8e59761344d83d8c72e8b Mon Sep 17 00:00:00 2001 From: Devin Droddy Date: Thu, 12 Jun 2025 13:31:46 -0400 Subject: [PATCH] ashell: add module --- .../misc/news/2025/06/2025-06-12_13-07-18.nix | 8 ++ modules/modules.nix | 1 + modules/programs/ashell.nix | 89 +++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 modules/misc/news/2025/06/2025-06-12_13-07-18.nix create mode 100644 modules/programs/ashell.nix diff --git a/modules/misc/news/2025/06/2025-06-12_13-07-18.nix b/modules/misc/news/2025/06/2025-06-12_13-07-18.nix new file mode 100644 index 00000000..51950f47 --- /dev/null +++ b/modules/misc/news/2025/06/2025-06-12_13-07-18.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + time = "2025-06-12T17:07:18+00:00"; + condition = pkgs.stdenv.hostPlatform.isLinux; + message = '' + A new module is available: 'programs.ashell'. + ''; +} diff --git a/modules/modules.nix b/modules/modules.nix index 845881b5..7525a516 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -67,6 +67,7 @@ let ./programs/antidote.nix ./programs/anyrun.nix ./programs/aria2.nix + ./programs/ashell.nix ./programs/astroid.nix ./programs/atuin.nix ./programs/autojump.nix diff --git a/modules/programs/ashell.nix b/modules/programs/ashell.nix new file mode 100644 index 00000000..d767634f --- /dev/null +++ b/modules/programs/ashell.nix @@ -0,0 +1,89 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.ashell; + settingsFormat = pkgs.formats.yaml { }; +in +{ + meta.maintainers = [ lib.hm.maintainers.justdeeevin ]; + + options.programs.ashell = { + enable = lib.mkEnableOption "ashell, a ready to go wayland status bar for hyprland"; + + package = lib.mkPackageOption pkgs "ashell" { nullable = true; }; + + settings = lib.mkOption { + type = settingsFormat.type; + default = { }; + example = { + modules = { + left = [ "Workspaces" ]; + center = [ "Window Title" ]; + right = [ + "SystemInfo" + [ + "Clock" + "Privacy" + "Settings" + ] + ]; + }; + workspaces.visibilityMode = "MonitorSpecific"; + }; + description = '' + Ashell configuration written to `$XDG_CONFIG_HOME/ashell.yml`. + For available settings see . + ''; + }; + + systemd = { + enable = lib.mkEnableOption "ashell systemd service"; + target = lib.mkOption { + type = lib.types.str; + default = config.wayland.systemd.target; + defaultText = lib.literalExpression "config.wayland.systemd.target"; + example = "hyprland-session.target"; + description = '' + The systemd target that will automatically start ashell. + + If you set this to a WM-specific target, make sure that systemd integration for that WM is enabled (e.g. `wayland.windowManager.hyprland.systemd.enable`). **This is typically true by default**. + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + assertions = [ + (lib.hm.assertions.assertPlatform "programs.ashell" pkgs lib.platforms.linux) + ]; + + home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; + xdg.configFile."ashell.yml" = lib.mkIf (cfg.settings != { }) { + source = settingsFormat.generate "ashell-config" cfg.settings; + }; + } + (lib.mkIf cfg.systemd.enable { + systemd.user.services.ashell = { + Unit = { + Description = "ashell status bar"; + Documentation = "https://github.com/MalpenZibo/ashell/tree/0.4.1"; + After = [ cfg.systemd.target ]; + }; + + Service = { + ExecStart = "${lib.getExe cfg.package}"; + Restart = "on-failure"; + }; + + Install.WantedBy = [ cfg.systemd.target ]; + }; + }) + ] + ); +}