From 224fd626e701324aece32c7e10b24893dd25d085 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Tue, 10 Jan 2023 21:42:20 +0000 Subject: [PATCH] Fix branding generation --- branding.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ mastodon.nix | 13 ++----------- 2 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 branding.nix diff --git a/branding.nix b/branding.nix new file mode 100644 index 0000000..f22c6a7 --- /dev/null +++ b/branding.nix @@ -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' + ''; +} diff --git a/mastodon.nix b/mastodon.nix index a443f63..f9e4aba 100644 --- a/mastodon.nix +++ b/mastodon.nix @@ -3,17 +3,7 @@ let secrets = import ./secrets.nix; - branding = '' - 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 { + mastodon-lor-sh = pkgs.mastodon.override { srcOverride = pkgs.applyPatches { src = pkgs.fetchgit { url = "https://github.com/mastodon/mastodon.git"; @@ -37,6 +27,7 @@ let ./patches/simple-form.patch ]; + postPatch = (import ./branding.nix { pkgs = pkgs; }).branding; }; };