Fix branding generation

This commit is contained in:
dump_stack() 2023-01-10 21:42:20 +00:00
parent 077c602860
commit 224fd626e7
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 47 additions and 11 deletions

45
branding.nix Normal file
View File

@ -0,0 +1,45 @@
{ pkgs, ... }:
{
# Terrapin::CommandLine.logger = Logger.new(STDOUT)
branding = ''
${pkgs.librsvg}/bin/rsvg-convert -w '16' -h '16' --keep-aspect-ratio 'app/javascript/images/logo.svg' -o 'app/javascript/icons/favicon-16x16.png'
${pkgs.librsvg}/bin/rsvg-convert -w '32' -h '32' --keep-aspect-ratio 'app/javascript/images/logo.svg' -o 'app/javascript/icons/favicon-32x32.png'
${pkgs.librsvg}/bin/rsvg-convert -w '48' -h '48' --keep-aspect-ratio 'app/javascript/images/logo.svg' -o 'app/javascript/icons/favicon-48x48.png'
${pkgs.imagemagick}/bin/convert 'app/javascript/icons/favicon-16x16.png' 'app/javascript/icons/favicon-32x32.png' 'app/javascript/icons/favicon-48x48.png' 'public/favicon.ico'
${pkgs.librsvg}/bin/rsvg-convert -w '57' -h '57' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-57x57.png'
${pkgs.librsvg}/bin/rsvg-convert -w '60' -h '60' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-60x60.png'
${pkgs.librsvg}/bin/rsvg-convert -w '72' -h '72' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-72x72.png'
${pkgs.librsvg}/bin/rsvg-convert -w '76' -h '76' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-76x76.png'
${pkgs.librsvg}/bin/rsvg-convert -w '114' -h '114' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-114x114.png'
${pkgs.librsvg}/bin/rsvg-convert -w '120' -h '120' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-120x120.png'
${pkgs.librsvg}/bin/rsvg-convert -w '144' -h '144' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-144x144.png'
${pkgs.librsvg}/bin/rsvg-convert -w '152' -h '152' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-152x152.png'
${pkgs.librsvg}/bin/rsvg-convert -w '167' -h '167' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-167x167.png'
${pkgs.librsvg}/bin/rsvg-convert -w '180' -h '180' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-180x180.png'
${pkgs.librsvg}/bin/rsvg-convert -w '1024' -h '1024' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/apple-touch-icon-1024x1024.png'
${pkgs.librsvg}/bin/rsvg-convert -w '36' -h '36' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/android-chrome-36x36.png'
${pkgs.librsvg}/bin/rsvg-convert -w '48' -h '48' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/android-chrome-48x48.png'
${pkgs.librsvg}/bin/rsvg-convert -w '72' -h '72' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/android-chrome-72x72.png'
${pkgs.librsvg}/bin/rsvg-convert -w '96' -h '96' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/android-chrome-96x96.png'
${pkgs.librsvg}/bin/rsvg-convert -w '144' -h '144' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/android-chrome-144x144.png'
${pkgs.librsvg}/bin/rsvg-convert -w '192' -h '192' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/android-chrome-192x192.png'
${pkgs.librsvg}/bin/rsvg-convert -w '256' -h '256' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/android-chrome-256x256.png'
${pkgs.librsvg}/bin/rsvg-convert -w '384' -h '384' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/android-chrome-384x384.png'
${pkgs.librsvg}/bin/rsvg-convert -w '512' -h '512' --keep-aspect-ratio 'app/javascript/images/app-icon.svg' -o 'app/javascript/icons/android-chrome-512x512.png'
${pkgs.librsvg}/bin/rsvg-convert --stylesheet 'lib/assets/wordmark.light.css' -w '192' -h '192' --keep-aspect-ratio 'app/javascript/images/logo-symbol-icon.svg' -o 'public/badge.png'
${pkgs.librsvg}/bin/rsvg-convert --stylesheet 'lib/assets/wordmark.dark.css' -h '102' --keep-aspect-ratio 'app/javascript/images/logo-symbol-wordmark.svg' -o 'lib/assets/wordmark.dark.png'
${pkgs.librsvg}/bin/rsvg-convert --stylesheet 'lib/assets/wordmark.light.css' -h '102' --keep-aspect-ratio 'app/javascript/images/logo-symbol-wordmark.svg' -o 'lib/assets/wordmark.light.png'
${pkgs.librsvg}/bin/rsvg-convert -h '192' --keep-aspect-ratio 'app/javascript/images/icons/icon_cached.svg' -o 'app/javascript/images/mailer/icon_cached.png'
${pkgs.librsvg}/bin/rsvg-convert -h '192' --keep-aspect-ratio 'app/javascript/images/icons/icon_done.svg' -o 'app/javascript/images/mailer/icon_done.png'
${pkgs.librsvg}/bin/rsvg-convert -h '192' --keep-aspect-ratio 'app/javascript/images/icons/icon_email.svg' -o 'app/javascript/images/mailer/icon_email.png'
${pkgs.librsvg}/bin/rsvg-convert -h '192' --keep-aspect-ratio 'app/javascript/images/icons/icon_file_download.svg' -o 'app/javascript/images/mailer/icon_file_download.png'
${pkgs.librsvg}/bin/rsvg-convert -h '192' --keep-aspect-ratio 'app/javascript/images/icons/icon_flag.svg' -o 'app/javascript/images/mailer/icon_flag.png'
${pkgs.librsvg}/bin/rsvg-convert -h '192' --keep-aspect-ratio 'app/javascript/images/icons/icon_grade.svg' -o 'app/javascript/images/mailer/icon_grade.png'
${pkgs.librsvg}/bin/rsvg-convert -h '192' --keep-aspect-ratio 'app/javascript/images/icons/icon_lock_open.svg' -o 'app/javascript/images/mailer/icon_lock_open.png'
${pkgs.librsvg}/bin/rsvg-convert -h '192' --keep-aspect-ratio 'app/javascript/images/icons/icon_person_add.svg' -o 'app/javascript/images/mailer/icon_person_add.png'
${pkgs.librsvg}/bin/rsvg-convert -h '192' --keep-aspect-ratio 'app/javascript/images/icons/icon_reply.svg' -o 'app/javascript/images/mailer/icon_reply.png'
${pkgs.librsvg}/bin/rsvg-convert -h '102' --keep-aspect-ratio 'app/javascript/images/logo-symbol-wordmark.svg' -o 'app/javascript/images/mailer/wordmark.png'
${pkgs.librsvg}/bin/rsvg-convert -h '72' --keep-aspect-ratio 'app/javascript/images/logo-symbol-icon.svg' -o 'app/javascript/images/mailer/logo.png'
'';
}

View File

@ -3,17 +3,7 @@
let let
secrets = import ./secrets.nix; secrets = import ./secrets.nix;
branding = '' mastodon-lor-sh = pkgs.mastodon.override {
PATH=$PATH:${pkgs.librsvg}/bin:${pkgs.imagemagick}/bin \
RAILS_ENV=development rake branding:generate
'';
mastodon-lor-sh = (pkgs.mastodon.overrideAttrs(x: {
patchPhase = branding;
mastodon-modules = pkgs.mastodon.mastodon-modules.overrideAttrs(y: {
patchPhase = branding;
});
})).override {
srcOverride = pkgs.applyPatches { srcOverride = pkgs.applyPatches {
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/mastodon/mastodon.git"; url = "https://github.com/mastodon/mastodon.git";
@ -37,6 +27,7 @@ let
./patches/simple-form.patch ./patches/simple-form.patch
]; ];
postPatch = (import ./branding.nix { pkgs = pkgs; }).branding;
}; };
}; };