66 lines
1.6 KiB
Nix
66 lines
1.6 KiB
Nix
# Download the wallpaper here.
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.module.wallpaper;
|
|
|
|
url = "https://www.desktophut.com/files/Ob4WzyO9kcDtKft_Above%20the%20clouds_1_155846.mp4";
|
|
sha256 = "sha256-3ginS0XeRl2qVOGPrxlJwWx8FnxuVGQRgo4Ha6+KbqM=";
|
|
|
|
# Use video.
|
|
video = true;
|
|
|
|
# Forse black and white for text.
|
|
forceContrastText = false;
|
|
|
|
# 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";
|
|
scheme = null;
|
|
|
|
# Extract image from video.
|
|
videoImage =
|
|
if video then
|
|
pkgs.runCommandNoCC "wallpaper-video-image" { } ''
|
|
${pkgs.ffmpeg}/bin/ffmpeg -hide_banner -loglevel error -ss 00:00:00 -i ${cfg.videoPath} -frames:v 1 -q:v 1 Image.jpg
|
|
cp Image.jpg $out
|
|
''
|
|
else
|
|
null;
|
|
in
|
|
{
|
|
options.module.wallpaper = {
|
|
forceContrastText = lib.mkOption {
|
|
default = lib.warnIf forceContrastText "Wallpaper: Forced text contrast." forceContrastText;
|
|
type = lib.types.bool;
|
|
};
|
|
path = lib.mkOption {
|
|
default = if video then videoImage else pkgs.fetchurl { inherit url sha256; };
|
|
type = lib.types.path;
|
|
};
|
|
video = lib.mkOption {
|
|
default = video;
|
|
type = lib.types.bool;
|
|
};
|
|
videoPath = lib.mkOption {
|
|
default = if video then pkgs.fetchurl { inherit url sha256; } else null;
|
|
type = with lib.types; nullOr path;
|
|
};
|
|
scheme = lib.mkOption {
|
|
default = scheme;
|
|
type =
|
|
with lib.types;
|
|
nullOr (oneOf [
|
|
path
|
|
lines
|
|
attrs
|
|
]);
|
|
};
|
|
};
|
|
}
|