joypixels: Refactor to group system-specific variables
This commit is contained in:
parent
cd255a375e
commit
a880ab2e98
@ -4,47 +4,35 @@ let inherit (stdenv.hostPlatform) system;
|
|||||||
|
|
||||||
throwSystem = throw "Unsupported system: ${system}";
|
throwSystem = throw "Unsupported system: ${system}";
|
||||||
|
|
||||||
systemTag = {
|
systemSpecific = {
|
||||||
x86_64-darwin = "nix-darwin";
|
x86_64-darwin = rec {
|
||||||
x86_64-linux = "nix-os";
|
systemTag = "nix-darwin";
|
||||||
|
capitalized = systemTag;
|
||||||
|
ext = "ttc";
|
||||||
|
fontFile = "Apple%20Color%20Emoji.ttc";
|
||||||
|
name = "joypixels-apple-color-emoji.ttc";
|
||||||
|
};
|
||||||
|
x86_64-linux = rec {
|
||||||
|
systemTag = "nix-os";
|
||||||
|
capitalized = "NixOS";
|
||||||
|
ext = "ttf";
|
||||||
|
fontFile = "joypixels-android.ttf";
|
||||||
|
name = fontFile;
|
||||||
|
};
|
||||||
}.${system} or throwSystem;
|
}.${system} or throwSystem;
|
||||||
|
|
||||||
capitalized = {
|
joypixels-free-license = with systemSpecific; {
|
||||||
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 = fontFile;
|
|
||||||
}.${system} or throwSystem;
|
|
||||||
|
|
||||||
ext = {
|
|
||||||
x86_64-darwin = "ttc";
|
|
||||||
x86_64-linux = "ttf";
|
|
||||||
}.${system} or throwSystem;
|
|
||||||
|
|
||||||
joypixels-free-license = {
|
|
||||||
spdxId = "LicenseRef-JoyPixels-Free-6.0";
|
spdxId = "LicenseRef-JoyPixels-Free-6.0";
|
||||||
fullName = "JoyPixels Free License Agreement 6.0";
|
fullName = "JoyPixels Free License Agreement 6.0";
|
||||||
url = "https://cdn.joypixels.com/distributions/${systemTag}/license/free-license.pdf";
|
url = "https://cdn.joypixels.com/distributions/${systemTag}/license/free-license.pdf";
|
||||||
};
|
};
|
||||||
joypixels-license-appendix = {
|
|
||||||
|
joypixels-license-appendix = with systemSpecific; {
|
||||||
spdxId = "LicenseRef-JoyPixels-NixOS-Appendix";
|
spdxId = "LicenseRef-JoyPixels-NixOS-Appendix";
|
||||||
fullName = "JoyPixels ${capitalized} License Appendix";
|
fullName = "JoyPixels ${capitalized} License Appendix";
|
||||||
url = "https://cdn.joypixels.com/distributions/${systemTag}/appendix/joypixels-license-appendix.pdf";
|
url = "https://cdn.joypixels.com/distributions/${systemTag}/appendix/joypixels-license-appendix.pdf";
|
||||||
};
|
};
|
||||||
|
|
||||||
sha256 = {
|
|
||||||
x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq";
|
|
||||||
x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s";
|
|
||||||
}.${system} or throwSystem;
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
assert !acceptLicense -> throw ''
|
assert !acceptLicense -> throw ''
|
||||||
@ -63,14 +51,18 @@ stdenv.mkDerivation rec {
|
|||||||
pname = "joypixels";
|
pname = "joypixels";
|
||||||
version = "6.0.0";
|
version = "6.0.0";
|
||||||
|
|
||||||
src = fetchurl {
|
src = with systemSpecific; fetchurl {
|
||||||
inherit name sha256;
|
inherit name;
|
||||||
url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}";
|
url = "https://cdn.joypixels.com/distributions/${systemTag}/font/${version}/${fontFile}";
|
||||||
|
sha256 = {
|
||||||
|
x86_64-darwin = "043980g0dlp8vd4qkbx6298fwz8ns0iwbxm0f8czd9s7n2xm4npq";
|
||||||
|
x86_64-linux = "1vxqsqs93g4jyp01r47lrpcm0fmib2n1vysx32ksmfxmprimb75s";
|
||||||
|
}.${system} or throwSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = with systemSpecific; ''
|
||||||
install -Dm644 $src $out/share/fonts/truetype/joypixels.${ext}
|
install -Dm644 $src $out/share/fonts/truetype/joypixels.${ext}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user