pkgs: sway-background-image: fetch image directly from source

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2024-06-16 02:19:49 +02:00
parent 59c4b89fd1
commit c7a75452e7
Signed by: c8h4
GPG key ID: 73D5E7FDEE3DE49A
5 changed files with 24 additions and 19 deletions

View file

@ -37,7 +37,3 @@
## License
The code is released into the public domain.
Other conditions apply to the following files:
- `pkgs/sway-background-image/background.jpg`: [Photo](https://unsplash.com/photos/wQLAGv4_OYs) by [Lucas Kapla](https://unsplash.com/@aznbokchoy), [Unsplash License](https://unsplash.com/license)

View file

@ -7,5 +7,5 @@ _: super:
git-multi-shortlog = super.callPackage ./git-multi-shortlog.nix { };
homer = super.callPackage ./homer { };
neomutt-export-patches = super.callPackage ./neomutt-export-patches.nix { };
sway-background-image = super.callPackage ./sway-background-image { };
sway-background-image = super.callPackage ./sway-background-image.nix { };
}

View file

@ -0,0 +1,23 @@
{ stdenv, fetchurl, imagemagick }:
stdenv.mkDerivation rec {
pname = "sway-background-image";
version = "0.1";
src = fetchurl {
url = "https://images.unsplash.com/photo-1541701494587-cb58502866ab";
hash = "sha256-qFD7FFqY2l2Fsev/YPu1/f7f29BntxsO1ezJj2BlMs8=";
};
dontUnpack = true;
nativeBuildInputs = [ imagemagick ];
installPhase = ''
runHook preInstall
mkdir -p $out/share
# significantly reduces image size, 4.8MiB -> 1.7MiB
convert -quality 90 -resize 4096x $src $out/share/background.jpg
runHook postInstall
'';
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

View file

@ -1,14 +0,0 @@
{ stdenv }:
stdenv.mkDerivation rec {
pname = "sway-background-image";
version = "0.1";
dontUnpack = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share
cp -v ${./background.jpg} $out/share/background.jpg
runHook postInstall
'';
}