summaryrefslogtreecommitdiff
path: root/pkgs/static/wallpapers/default.nix
blob: a0efda3f7b6e4649fcf946baf288bf3ccb4190e1 (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
{
  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