mirror of
https://github.com/nix-community/home-manager
synced 2024-06-14 02:33:38 +02:00
109 lines
2.8 KiB
Nix
109 lines
2.8 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let cfg = config.programs.hyprpaper;
|
|
in {
|
|
meta.maintainers = [ lib.maintainers.silmarp ];
|
|
|
|
options = {
|
|
programs.hyprpaper = {
|
|
enable = mkEnableOption "hyprpaper";
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = pkgs.hyprpaper;
|
|
defaultText = literalExpression "pkgs.hyprpaper";
|
|
description = "The package to use for the hyprpaper binary.";
|
|
};
|
|
|
|
systemd = {
|
|
enable =
|
|
mkEnableOption "Whether to enable hyprpaper systemd integration.";
|
|
|
|
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
|
|
'';
|
|
example = [ "monitor,./wallpapers/tensura.png" ];
|
|
};
|
|
};
|
|
|
|
extraConfig = mkOption {
|
|
type = types.str;
|
|
default = "";
|
|
description =
|
|
"Check https://github.com/hyprwm/hyprpaper#usage for info";
|
|
example = ''
|
|
newConfigOption = foo,bar
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = {
|
|
home.packages = mkIf cfg.enable [ cfg.package ];
|
|
|
|
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}
|
|
'') "" cfg.settings.preload)}
|
|
|
|
# hyprpaper.settings.wallpapers
|
|
${(lists.foldl (acc: v:
|
|
acc + ''
|
|
wallpaper = ${v}
|
|
'') "" cfg.settings.wallpapers)}
|
|
|
|
# hyprpaper.extraConfig
|
|
${cfg.extraConfig}
|
|
'';
|
|
};
|
|
};
|
|
}
|