[feat] Add hyprpaper
This commit is contained in:
98
config/nix/modules/hyprpaper.nix
Normal file
98
config/nix/modules/hyprpaper.nix
Normal file
@@ -0,0 +1,98 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.hyprpaper;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.hyprpaper = {
|
||||
enable = mkEnableOption "Hyprpaper - Wayland wallpaper utility";
|
||||
|
||||
systemd = {
|
||||
enable = mkEnableOption "autostart service for Hyprpaper";
|
||||
|
||||
target = mkOption {
|
||||
type = types.str;
|
||||
default = "graphical-session.target";
|
||||
example = "hyprland-session.target";
|
||||
description = ''
|
||||
The systemd target that will automatically start the Hyprpaper service.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settings = with types; {
|
||||
preload = mkOption {
|
||||
type = listOf path;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Wallpaper images that should be preloaded into memory
|
||||
'';
|
||||
example = [ ./wallpapers/tensura.png ];
|
||||
};
|
||||
|
||||
wallpapers = mkOption {
|
||||
type = listOf str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Wallpaper to monitor mapper
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = "Check https://github.com/hyprwm/hyprpaper#usage for info";
|
||||
example = ''
|
||||
newConfigOption = foo,bar
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
home.packages = mkIf cfg.enable [
|
||||
pkgs.hyprpaper
|
||||
];
|
||||
|
||||
systemd.user.services.hyprpaper = mkIf cfg.systemd.enable {
|
||||
Unit = {
|
||||
Description = "autostart service for Hyprpaper";
|
||||
Documentation = "https://github.com/hyprwm/hyprpaper";
|
||||
BindsTo = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.hyprpaper}/bin/hyprpaper";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
|
||||
Restart = "on-failure";
|
||||
KillMode = "mixed";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [
|
||||
cfg.systemd.target
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile = mkIf cfg.enable {
|
||||
"hypr/hyprpaper.conf".text = ''
|
||||
# Auto-generated by Nix home-manager module
|
||||
|
||||
# hyprpaper.settings.preload
|
||||
${(lists.foldl (acc: v: acc + "preload = ${v}\n") "" cfg.settings.preload)}
|
||||
|
||||
# hyprpaper.settings.wallpapers
|
||||
${(lists.foldl (acc: v: acc + "wallpaper = ${v}\n") "" cfg.settings.wallpapers)}
|
||||
|
||||
# hyprpaper.settings.extraConfig
|
||||
${cfg.settings.extraConfig}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user