diff options
| author | aristote <quentin.aristote@irif.fr> | 2023-12-18 17:04:26 +0100 |
|---|---|---|
| committer | aristote <quentin.aristote@irif.fr> | 2023-12-18 17:04:26 +0100 |
| commit | 29f64105bca9f528d2b9812cb7d490a27c6a2633 (patch) | |
| tree | e46ffdefe5d4b447596ede8a2b8d7c1542273ee0 /pkgs/static/wallpapers/default.nix | |
| parent | 9499aa240e5ad0d040e52bd9732619350fc0b950 (diff) | |
pkgs: wallpapers: change options
Diffstat (limited to 'pkgs/static/wallpapers/default.nix')
| -rw-r--r-- | pkgs/static/wallpapers/default.nix | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/pkgs/static/wallpapers/default.nix b/pkgs/static/wallpapers/default.nix index f0b8d46..a0efda3 100644 --- a/pkgs/static/wallpapers/default.nix +++ b/pkgs/static/wallpapers/default.nix @@ -1,22 +1,36 @@ -{ stdenv, fetchurl, imagemagick, lib }: - -let +{ + stdenv, + fetchurl, + imagemagick, + lib, +}: let fetchWallpaper = lib.makeOverridable ( - { 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" - ''; - }); + { + 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 +in + { + fetcher = fetchWallpaper; + } + // builtins.mapAttrs (_: fetchWallpaper) sources |
