nix/option/Wallpaper.nix

66 lines
1.7 KiB
Nix
Raw Normal View History

2025-01-01 13:57:05 +03:00
{
config,
lib,
pkgs,
...
}:
let
2025-01-01 13:57:05 +03:00
cfg = config.module.wallpaper;
purpose = config.module.purpose;
# Set the wallpaper here.
2025-01-06 18:35:57 +03:00
url = "https://cloud.voronind.com/s/dwTkb5iTy2k7EST/download/arctic-spirit-moewalls-com.mp4";
sha256 = "sha256-wl8S4VOxxUQcjtfwgtkGsz1OkPNegXXfD/cjSFU6sog=";
2025-01-01 13:57:05 +03:00
video = true;
2025-01-01 13:57:05 +03:00
# Forse black and white for text.
forceContrastText = false;
2025-01-01 13:57:05 +03:00
# Predefined scheme instead of generated.
# SEE: /etc/stylix/palette.json
# SEE: https://github.com/tinted-theming/schemes
# scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
2024-12-30 05:14:17 +03:00
scheme = null;
2025-01-01 13:57:05 +03:00
# Extract image from video.
2025-01-02 06:43:46 +03:00
videoPath = if video then pkgs.fetchurl { inherit url sha256; } else null;
image =
2025-01-01 13:57:05 +03:00
if video then
pkgs.runCommandNoCC "wallpaper-video-image" { } ''
2025-01-02 06:43:46 +03:00
${pkgs.ffmpeg}/bin/ffmpeg -hide_banner -loglevel error -ss 00:00:00 -i ${videoPath} -frames:v 1 -q:v 1 Image.jpg
2025-01-05 07:27:40 +03:00
mv Image.jpg $out
2025-01-01 13:57:05 +03:00
''
else
2025-01-02 06:43:46 +03:00
pkgs.fetchurl { inherit url sha256; };
in
2024-11-04 04:37:29 +03:00
{
options.module.wallpaper = {
forceContrastText = lib.mkOption {
default = lib.warnIf forceContrastText "Wallpaper: Forced text contrast." forceContrastText;
type = lib.types.bool;
};
path = lib.mkOption {
2025-01-02 06:43:46 +03:00
default = image;
type = lib.types.path;
};
2025-01-01 13:57:05 +03:00
video = lib.mkOption {
default = video && purpose.desktop;
2025-01-01 13:57:05 +03:00
type = lib.types.bool;
};
videoPath = lib.mkOption {
2025-01-02 06:43:46 +03:00
default = videoPath;
2025-01-01 13:57:05 +03:00
type = with lib.types; nullOr path;
};
2024-12-30 05:14:17 +03:00
scheme = lib.mkOption {
default = scheme;
type =
with lib.types;
nullOr (oneOf [
path
lines
attrs
]);
};
};
2024-11-04 04:37:29 +03:00
}