1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-07 17:41:03 +01:00

hyprlauncher: add module

This commit is contained in:
Aguirre Matteo 2025-12-04 22:49:50 -03:00 committed by Austin Horstman
parent ccd22c13b2
commit 2e02e22e28
4 changed files with 127 additions and 0 deletions

View file

@ -0,0 +1,86 @@
{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.services.hyprlauncher;
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.services.hyprlauncher = {
enable = mkEnableOption "hyprlauncher";
package = mkPackageOption pkgs "hyprlauncher" { nullable = true; };
settings = mkOption {
type =
with lib.types;
let
valueType =
nullOr (oneOf [
bool
int
float
str
path
(attrsOf valueType)
(listOf valueType)
])
// {
description = "Hyprland configuration value";
};
in
valueType;
default = { };
example = {
general.grab_focus = true;
cache.enabled = true;
ui.window_size = "400 260";
finders = {
math_prefix = "=";
desktop_icons = true;
};
};
description = ''
Configuration settings for hyprlauncher. All the available options can be found here:
<https://wiki.hypr.land/Hypr-Ecosystem/hyprlauncher/#config>
'';
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.hyprlauncher" pkgs lib.platforms.linux)
];
home.packages = mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."hypr/hyprlauncher.conf" = mkIf (cfg.settings != { }) {
text = lib.hm.generators.toHyprconf { attrs = cfg.settings; };
};
systemd.user.services.hyprlauncher = mkIf (cfg.package != null) {
Install.WantedBy = [ config.wayland.systemd.target ];
Unit = {
Description = "hyprlauncher";
After = [ config.wayland.systemd.target ];
PartOf = [ config.wayland.systemd.target ];
X-Restart-Triggers = lib.mkIf (cfg.settings != { }) [
"${config.xdg.configFile."hypr/hyprlauncher.conf".source}"
];
};
Service = {
ExecStart = "${lib.getExe cfg.package} -d";
Restart = "always";
RestartSec = "10";
};
};
};
}

View file

@ -0,0 +1,5 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
hyprlauncher-settings = ./settings.nix;
}

View file

@ -0,0 +1,16 @@
cache {
enabled=true
}
finders {
desktop_icons=true
math_prefix==
}
general {
grab_focus=true
}
ui {
window_size=400 260
}

View file

@ -0,0 +1,20 @@
{
services.hyprlauncher = {
enable = true;
settings = {
general.grab_focus = true;
cache.enabled = true;
ui.window_size = "400 260";
finders = {
math_prefix = "=";
desktop_icons = true;
};
};
};
nmt.script = ''
assertFileExists home-files/.config/hypr/hyprlauncher.conf
assertFileContent home-files/.config/hypr/hyprlauncher.conf \
${./hyprlauncher.conf}
'';
}