joypixels: Refactor src and installPhase for clarity
This commit is contained in:
parent
e0ad840a06
commit
568beeaa28
1 changed files with 41 additions and 28 deletions
|
@ -1,21 +1,32 @@
|
|||
{ stdenv, fetchurl }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
let inherit (stdenv.hostPlatform) system;
|
||||
|
||||
throwSystem = throw "Unsupported system: ${system}";
|
||||
|
||||
pname = "joypixels";
|
||||
version = "6.0.0";
|
||||
systemTag = {
|
||||
x86_64-darwin = "nix-darwin";
|
||||
x86_64-linux = "nix-os";
|
||||
}.${system} or throwSystem;
|
||||
|
||||
url = {
|
||||
x86_64-darwin = "https://cdn.joypixels.com/distributions/nix-darwin/font/6.0.0/Apple%20Color%20Emoji.ttc";
|
||||
x86_64-linux = "https://cdn.joypixels.com/distributions/nix-os/font/${version}/joypixels-android.ttf";
|
||||
capitalized = {
|
||||
x86_64-darwin = systemTag;
|
||||
x86_64-linux = "NixOS";
|
||||
}.${system} or throwSystem;
|
||||
|
||||
fontFile = {
|
||||
x86_64-darwin = "Apple%20Color%20Emoji.ttc";
|
||||
x86_64-linux = "joypixels-android.ttf";
|
||||
}.${system} or throwSystem;
|
||||
|
||||
name = {
|
||||
x86_64-darwin = "joypixels-apple-color-emoji.ttc";
|
||||
x86_64-linux = "joypixels-android.ttf";
|
||||
x86_64-linux = fontFile;
|
||||
}.${system} or throwSystem;
|
||||
|
||||
ext = {
|
||||
x86_64-darwin = "ttc";
|
||||
x86_64-linux = "ttf";
|
||||
}.${system} or throwSystem;
|
||||
|
||||
sha256 = {
|
||||
|
@ -23,20 +34,22 @@ stdenv.mkDerivation rec {
|
|||
x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s";
|
||||
}.${system} or throwSystem;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "joypixels";
|
||||
version = "6.0.0";
|
||||
|
||||
src = fetchurl {
|
||||
inherit url name sha256;
|
||||
inherit name sha256;
|
||||
url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = {
|
||||
x86_64-darwin = ''
|
||||
install -Dm644 $src $out/share/fonts/truetype/joypixels.ttc
|
||||
installPhase = ''
|
||||
install -Dm644 $src $out/share/fonts/truetype/joypixels.${ext}
|
||||
'';
|
||||
x86_64-linux = ''
|
||||
install -Dm644 $src $out/share/fonts/truetype/joypixels.ttf
|
||||
'';
|
||||
}.${system} or throwSystem;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Emoji as a Service (formerly EmojiOne)";
|
||||
|
|
Loading…
Reference in a new issue