diff options
| author | Quentin Aristote <quentin@aristote.fr> | 2023-03-01 13:50:55 +0100 |
|---|---|---|
| committer | Quentin Aristote <quentin@aristote.fr> | 2023-03-01 14:03:57 +0100 |
| commit | 21034a5a36d62fbad795c4139c98c32e0516ec93 (patch) | |
| tree | db063cbb3e91bf7231c0eb54fb54b3cb5ac51dfe /pkgs/static/wallpapers/default.nix | |
| parent | ceb6a8075e1b6e1228b7c75a8da36ed520d32b5f (diff) | |
restructure pkgs
Diffstat (limited to 'pkgs/static/wallpapers/default.nix')
| -rw-r--r-- | pkgs/static/wallpapers/default.nix | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/static/wallpapers/default.nix b/pkgs/static/wallpapers/default.nix new file mode 100644 index 0000000..4abeb38 --- /dev/null +++ b/pkgs/static/wallpapers/default.nix @@ -0,0 +1,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 |
