From d63ef9f1255985e72fab98edbe70819d6df1e657 Mon Sep 17 00:00:00 2001 From: knoff Date: Fri, 12 Apr 2024 20:42:39 +0200 Subject: [PATCH] pyperland: added pyprland module to home-manager pyperland is a hyperland plugin manager. --- modules/lib/maintainers.nix | 6 ++++ modules/services/pyprland.nix | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 modules/services/pyprland.nix diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 2c4fbd9da..6143e3c30 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -518,4 +518,10 @@ github = "zorrobert"; githubId = 118135271; }; + knoc-off = { + name = "Niko Selby"; + email = "selby@niko.ink"; + github = "knoc-off"; + githubId = 36494048; + }; } diff --git a/modules/services/pyprland.nix b/modules/services/pyprland.nix new file mode 100644 index 000000000..0f6f1aa69 --- /dev/null +++ b/modules/services/pyprland.nix @@ -0,0 +1,56 @@ +{ options, config, lib, pkgs, ... }: +let + cfg = config.services.pyprland; + settingsFormat = pkgs.formats.toml { }; +in with lib; { + + meta.maintainers = [ maintainers.knoc-off ]; + options.services.pyprland = { + enable = mkEnableOption "pyperland"; + + package = mkOption { + default = pkgs.pyprland; + type = types.package; + description = "The pyprland package to use"; + }; + + extraPlugins = mkOption { + default = [ ]; + type = with types; listOf str; + description = "Additional plugins to enable"; + }; + + settings = mkOption { + type = types.submodule { + freeformType = settingsFormat.type; + + options.scratchpads = mkOption { + default = { }; + type = with types; attrsOf attrs; + description = "Scratchpad configurations"; + }; + }; + default = { }; + description = '' + Configuration for pyprland, see + + for supported values. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + services.pyprland.settings = { + pyprland = { + plugins = cfg.extraPlugins + ++ (optional (cfg.settings.scratchpads != { }) "scratchpads"); + }; + }; + + home.file.".config/hypr/pyprland.toml".source = + settingsFormat.generate "pyprland-config.toml" cfg.settings; + }; +} +