feat: Use upstream hyprpaper module
Some checks failed
Flake checker / Build Nix targets (push) Has been cancelled
Some checks failed
Flake checker / Build Nix targets (push) Has been cancelled
This commit is contained in:
@@ -1,104 +0,0 @@
|
||||
{
|
||||
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 = attrsOf str;
|
||||
default = {};
|
||||
example = {"DP-1" = ./wallpapers/tensura.png;};
|
||||
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}
|
||||
'') ""
|
||||
cfg.settings.preload)}
|
||||
|
||||
# hyprpaper.settings.wallpapers
|
||||
${(lists.foldl (acc: v:
|
||||
acc
|
||||
+ ''
|
||||
wallpaper = ${v}
|
||||
'') "" (pkgs.lib.attrsets.mapAttrsToList (name: val: name + "," + val)
|
||||
cfg.settings.wallpapers))}
|
||||
|
||||
# hyprpaper.settings.extraConfig
|
||||
${cfg.settings.extraConfig}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user