Skip to content

Commit

Permalink
system76-wallpapers: init at 0-unstable-2024-04-26
Browse files Browse the repository at this point in the history
(cherry picked from commit 2565eb3)
  • Loading branch information
Pandapip1 authored and github-actions[bot] committed Mar 10, 2025
1 parent f16fe69 commit b84e167
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
52 changes: 52 additions & 0 deletions pkgs/by-name/sy/system76-wallpapers/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
BACKGROUNDS=$(wildcard backgrounds/*)
SCALED=$(sort $(patsubst backgrounds/%, scaled/%, $(BACKGROUNDS)))

prefix ?= /usr
datarootdir = $(prefix)/share
datadir = $(datarootdir)

.PHONY: all clean install uninstall

all: $(SCALED) scaled/info.xml

clean:
rm -rf build scaled

install: all
for file in $(SCALED); do \
install -D -m 0644 "$$file" "$(DESTDIR)$(datadir)/backgrounds/system76/$$(basename "$$file")"; \
done
install -D -m 0644 "scaled/info.xml" "$(DESTDIR)$(datadir)/gnome-background-properties/system76-wallpapers.xml"

uninstall:
for file in $(SCALED); do \
rm -f "$(DESTDIR)$(datadir)/backgrounds/system76/$$(basename "$$file")"; \
done
rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(datadir)/backgrounds/system76/"
rm -f "$(DESTDIR)$(datadir)/gnome-background-properties/system76-wallpapers.xml"
rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(datadir)/gnome-background-properties/"

scaled/%: backgrounds/%
@mkdir -p build scaled
magick "$<" -resize "3840x2160^" "build/$*"
mv "build/$*" "$@"

scaled/info.xml: $(SCALED)
@mkdir -p build scaled
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > "build/info.xml"
echo "<!DOCTYPE wallpapers SYSTEM \"gnome-wp-list.dtd\">" >> "build/info.xml"
echo "<wallpapers>" >> "build/info.xml"
for file in $(SCALED); do \
filename="$$(basename "$$file")"; \
name="$${filename%.*}"; \
echo " <wallpaper>" >> "build/info.xml"; \
echo " <name>$$name</name>" >> "build/info.xml"; \
echo " <filename>/usr/share/backgrounds/system76/$$(basename "$$file")</filename>" >> "build/info.xml"; \
echo " <options>zoom</options>" >> "build/info.xml"; \
echo " <pcolor>#000000</pcolor>" >> "build/info.xml"; \
echo " <scolor>#000000</scolor>" >> "build/info.xml"; \
echo " <shade_type>solid</shade_type>" >> "build/info.xml"; \
echo " </wallpaper>" >> "build/info.xml"; \
done
echo "</wallpapers>" >> "build/info.xml"
mv "build/info.xml" "$@"
42 changes: 42 additions & 0 deletions pkgs/by-name/sy/system76-wallpapers/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
fetchpatch,
imagemagick,
nix-update-script,
}:

stdenvNoCC.mkDerivation {
pname = "system76-wallpapers";
version = "0-unstable-2024-04-26";

src = fetchFromGitHub {
owner = "pop-os";
repo = "system76-wallpapers";
rev = "ff1e25c79d10c699dfb695374d5ae7b3f8031b2b";
forceFetchGit = true;
fetchLFS = true;
hash = "sha256-5rddxbi/hRPy93DqswG54HzWK33Y5TteGB8SKjLXJZk=";
};

prePatch = ''
cp ${./Makefile} Makefile
'';

nativeBuildInputs = [ imagemagick ];

makeFlags = [ "prefix=$(out)" ];

passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };

meta = {
description = "Wallpapers for System76 products";
homepage = "https://system76.com/";
license = with lib.licenses; [
unfree # No license specified
];
maintainers = with lib.maintainers; [ pandapip1 ];
platforms = lib.platforms.all;
};
}

0 comments on commit b84e167

Please sign in to comment.