-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathoxipng.nix
56 lines (53 loc) · 1.17 KB
/
oxipng.nix
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
{
lib,
config,
mkFormatterModule,
...
}:
let
cfg = config.programs.oxipng;
in
{
meta.maintainers = [ "nim65s" ];
imports = [
(mkFormatterModule {
name = "oxipng";
includes = [ "*.png" ];
})
];
options.programs.oxipng = {
alpha = lib.mkEnableOption "Perform additional optimization on images with an alpha channel";
opt = lib.mkOption {
description = "Set the optimization level preset";
type = with lib.types; str;
example = "max";
default = "2";
};
scale16 = lib.mkEnableOption "Forcibly reduce images with 16 bits per channel to 8 bits per channel";
strip = lib.mkOption {
description = "Strip metadata chunks";
type = with lib.types; nullOr str;
example = "safe";
default = null;
};
};
config = lib.mkIf cfg.enable {
settings.formatter.oxipng = {
options =
[
"--opt"
cfg.opt
]
++ lib.optionals cfg.alpha [
"--alpha"
]
++ lib.optionals cfg.scale16 [
"--scale16"
]
++ lib.optionals (cfg.strip != null) [
"--strip"
cfg.strip
];
};
};
}