Rename mkTarget's 'configElements' argument to 'config' and 'extraOptions' to 'options' to provide a more transparent interface with the underlying Nixpkgs module system.
33 lines
838 B
Nix
33 lines
838 B
Nix
{ mkTarget, lib, ... }:
|
|
mkTarget {
|
|
name = "wpaperd";
|
|
humanName = "wpaperd";
|
|
|
|
config =
|
|
{ imageScalingMode, image }:
|
|
(
|
|
let
|
|
# wpaperd doesn't have any mode close to the described behavior of center
|
|
modeMap = {
|
|
"stretch" = "stretch";
|
|
# wpaperd's center mode is closest to the described behavior of fill
|
|
"fill" = "center";
|
|
"fit" = "fit";
|
|
"tile" = "tile";
|
|
};
|
|
|
|
modeAttrs =
|
|
if builtins.hasAttr imageScalingMode modeMap then
|
|
{ mode = modeMap.${imageScalingMode}; }
|
|
else
|
|
lib.info "stylix: wpaperd: unsupported image scaling mode: ${imageScalingMode}"
|
|
{ };
|
|
in
|
|
{
|
|
services.wpaperd.settings.any = {
|
|
path = image;
|
|
}
|
|
// modeAttrs;
|
|
}
|
|
);
|
|
}
|