{ lib, config, pkgs, ... }:
with lib;
let
util = import ../util pkgs;
cfg = config.services.hyprlax;
in {
options.services.hyprlax = {
enable = mkEnableOption "hyprlax";
settings = mkOption {
type = types.submodule {
freeformType = types.anything;
options = {
layers = mkOption {
type = types.listOf (types.submodule (entry: {
options = let
floatOp = default: mkOption { type = types.float; inherit default; };
in {
path = mkOption { type = types.path; };
shift_multiplier = floatOp 1.0;
scale = floatOp 1.0;
opacity = floatOp 1.0;
blur = floatOp 0.0;
# TODO
};
}));
default = [];
};
};
};
default = {};
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.hyprlax ];
xdg.configFile."hyprlax/conf.toml".text = util.generators.toTOML { global = cfg.settings; };
systemd.user.services.hyprlax = {
Unit = {
Description = "wallpaper";
After = [ "niri.target" ];
};
Service.ExecStart = "${pkgs.hyprlax}/bin/hyprlax --config ${config.xdg.configHome}/hyprlax/conf.toml";
Install.WantedBy = [ "default.target" ];
};
};
}