branding/flake.nix
2024-11-09 20:58:43 +01:00

69 lines
2.2 KiB
Nix

{
description = "Florp.social branding";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }: let
inherit (nixpkgs) lib;
eachSystem = conf: lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] conf;
in {
packages = eachSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = lib.singleton (final: prev: {
libavif-svt = prev.libavif.overrideAttrs (finalAttrs: prevAttrs: {
cmakeFlags = prevAttrs.cmakeFlags ++ [
"-DAVIF_CODEC_SVT=ON"
];
propagatedBuildInputs = prevAttrs.propagatedBuildInputs ++ [
final.svt-av1-psy
];
});
});
};
in {
wallpaper = pkgs.runCommand "sylvia-ritter-15012023.avif" {
src = ./media/SylviaRitter_Speedpainting_15012023_7680x4320px.png;
nativeBuildInputs = with pkgs; [
imagemagick
libavif-svt
];
} ''
magick $src -resize 50% resize.png
avifenc -q 80 --speed 0 --codec svt --depth 8 --yuv 420 -a tune=2 \
-a enable-variance-boost=1 -a variance-boost-strength=3 -a enable-overlays=1 \
-a enable-qm=1 -a qm-min=0 -a enable-tf=1 resize.png $out
'';
logo = pkgs.runCommand "florp_logo.avif" {
src = ./media/florp_logo.png;
nativeBuildInputs = with pkgs; [
libavif-svt
];
} ''
avifenc -q 80 --speed 0 --codec svt --depth 8 --yuv 420 -a tune=2 \
-a enable-variance-boost=1 -a variance-boost-strength=3 -a enable-overlays=1 \
-a enable-qm=1 -a qm-min=0 -a enable-tf=1 $src $out
'';
banner = pkgs.runCommand "florp_banner.avif" {
src = ./media/florphd0001-0024.mp4;
nativeBuildInputs = with pkgs; [
libavif-svt
ffmpeg-headless
];
} ''
ffmpeg -i $src -f yuv4mpegpipe -pix_fmt yuv420p - | \
avifenc -q 80 --speed 0 --depth 8 --yuv 420 -a tune=ssim --stdin $out
'';
favicon = pkgs.runCommand "favicon.png" {
src = ./media/florp_logo.png;
nativeBuildInputs = with pkgs; [
imagemagick
];
} ''
magick $src -resize 96x96 $out
'';
});
};
}