forked from samuelngs/apple-emoji-ttf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
113 lines (102 loc) · 2.78 KB
/
flake.nix
File metadata and controls
113 lines (102 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
description = "flake for apple-emoji-linux";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
treefmt-nix,
}:
let
forAllSystems =
function:
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
system: function nixpkgs.legacyPackages.${system}
);
treefmtConfig = forAllSystems (
pkgs:
treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
yamlfmt.enable = true;
ruff-format.enable = true;
mdformat.enable = true;
};
settings.excludes = [
"*.gitignore"
"*.lock"
"*.png"
"*.pyc"
"*.txt"
"*.ttx*"
"AUTHORS"
"CONTRIBUTORS"
"Makefile"
"LICENSE"
"third_party/*"
];
}
);
buildFromSource =
{
lib,
stdenv,
python3,
optipng,
zopfli,
pngquant,
imagemagick,
which,
nototools ? null,
}:
stdenv.mkDerivation {
pname = "apple-emoji-linux";
version = "18.4";
src = ./.;
enableParallelBuilding = true;
nativeBuildInputs = [
which
(python3.withPackages (
python-pkgs:
[
python-pkgs.fonttools
]
++ lib.optional (nototools == null) python-pkgs.nototools
))
optipng
zopfli
pngquant
imagemagick
] ++ lib.optional (nototools != null) nototools;
installPhase = ''
runHook preInstall
mkdir -p $out/share/fonts/truetype
cp ./AppleColorEmoji.ttf $out/share/fonts/truetype
runHook postInstall
'';
};
in
{
# run `nix fmt` to format all code
formatter = forAllSystems (pkgs: treefmtConfig.${pkgs.system}.config.build.wrapper);
# run `nix flake check` to ensure code is formatted
checks = forAllSystems (pkgs: {
formatting = treefmtConfig.${pkgs.system}.config.build.check self;
});
# run `nix develop` to get dropped into a shell with all the dependencies
# and `nix build` to build from source
packages = forAllSystems (pkgs: rec {
apple-emoji-linux = pkgs.callPackage buildFromSource {
nototools = if pkgs ? nototools then pkgs.nototools else null;
};
default = apple-emoji-linux;
});
};
}