summaryrefslogtreecommitdiff
path: root/pkgs/static/wallpapers/default.nix
blob: 7f228b9a2e9e2d18d0c909a6d272764d61ccb066 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  stdenv,
  fetchurl,
  imagemagick,
  lib,
}:
let
  fetchWallpaper = lib.makeOverridable (
    {
      name,
      url,
      sha256,
      resolution ? "1920x1080",
      ratio ? "16:9",
      gravity ? "center",
    }:
    stdenv.mkDerivation {
      inherit name;
      src = fetchurl {
        inherit url sha256;
      };
      buildInputs = [ imagemagick ];
      phases = [ "unpackPhase" ];
      unpackPhase = ''
        convert "$src" -gravity '${gravity}' \
                       -extent '${ratio}' \
                       -resize '${resolution}!' \
                "$out"
      '';
    }
  );
  sources = lib.importJSON ./sources.json;
in
{
  fetcher = fetchWallpaper;
}
// builtins.mapAttrs (_: fetchWallpaper) sources