blob: 4abeb38c86b9258cb01f98cbeb8c152c60ff4699 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
{ stdenv, fetchurl, imagemagick, lib }:
let
fetchWallpaper =
{ name, url, sha256, resolution ? "1920x1080", offset ? "0x0" }:
stdenv.mkDerivation {
inherit name;
src = fetchurl {
inherit url sha256;
};
buildInputs = [ imagemagick ];
phases = [ "unpackPhase" ];
unpackPhase = ''
convert "$src" -resize "${resolution}^" \
-crop "${resolution}+${offset}" \
"$out"
'';
};
sources = lib.importJSON ./sources.json;
in {
fetcher = fetchWallpaper;
} // builtins.mapAttrs (_: fetchWallpaper) sources
|