nixconfig/home/gui/theme/wallpaper-gen.nix
2023-10-12 16:16:29 +02:00

45 lines
1.3 KiB
Nix

{ pkgs, config }:
let
scheme = config.colorScheme;
colors = scheme.colors;
dither = "atkinson"; # none | floyd-steinberg | atkinson | jjn | burkes | sierra | sierra-lite
in
pkgs.stdenv.mkDerivation rec {
pname = "generated-wallpaper";
version = "a1676fc2a0e3dfb7bf95d8a89e592830";
src = pkgs.fetchFromGitea {
domain = "git.helcel.net";
owner = "sora";
repo = "nixconfig-wallpaper";
rev = version;
sha256 = "sha256-ZhBjTaKzoiEq1ptMmNWWRPCjLJsvy9My/HuzRaDjX1c=";
};
buildInputs = with pkgs; [
custom.repalette
nodejs
imagemagick
gifsicle
];
configurePhase = ''
echo "${colors.base00},${colors.base01},\
${colors.base02},${colors.base03},\
${colors.base04},${colors.base05},\
${colors.base06},${colors.base07},\
${colors.base08},${colors.base09},\
${colors.base0A},${colors.base0B},\
${colors.base0C},${colors.base0D},\
${colors.base0E},${colors.base0F}" > palette.in
'';
buildPhase = ''
make DITHER=${dither} PALETTE_SIZE=0 all
'';
installPhase = ''
mkdir -p $out/share/wallpaper
cp -r build/* $out/share/wallpaper/
'';
}