-
Notifications
You must be signed in to change notification settings - Fork 11
/
flake.nix
96 lines (89 loc) · 2.83 KB
/
flake.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
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
{
description = "Utilities to use arkenfox's user.js for Firefox";
inputs = {
nixpkgs.url = "nixpkgs/release-23.05";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
pre-commit,
flake-utils,
...
}: let
inherit (nixpkgs.lib) mapAttrs' nameValuePair;
ppVer = builtins.replaceStrings ["."] ["_"];
docs = pkgs:
(mapAttrs'
(version: extracted:
nameValuePair "arkenfox-v${ppVer version}-doc-static"
(pkgs.callPackage ./doc {inherit extracted version;}))
self.lib.arkenfox.extracted)
// (mapAttrs'
(version: extracted:
nameValuePair "arkenfox-v${ppVer version}-doc"
(pkgs.callPackage ./doc {
inherit extracted version;
css = "/style.css";
}))
self.lib.arkenfox.extracted);
outputs = flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
extractor = pkgs.callPackage ./extractor {};
generator = pkgs.callPackage ./generator {arkenfox-extractor = extractor;};
in {
checks.pre-commit-check = pre-commit.lib."${system}".run {
src = ./.;
hooks = {
alejandra.enable = true;
alejandra.excludes = ["autogen"];
deadnix.enable = true;
statix.enable = true;
statix.settings.ignore = ["autogen/*"];
perltidy = {
enable = true;
name = "Tidy perl code";
types = ["perl"];
entry = "${pkgs.perl.passthru.pkgs.PerlTidy}/bin/perltidy -b";
};
};
};
packages =
{
arkenfox-extractor = extractor;
arkenfox-generator = generator;
arkenfox-doc-css = pkgs.writeText "style.css" (builtins.readFile ./doc/style.css);
default = extractor;
}
// (docs pkgs);
});
in
outputs
// {
overlays = {
arkenfox = _: prev: (let
extractor = prev.callPackage ./extractor {};
in
{
arkenfox-extractor = prev.callPackage ./extractor {};
arkenfox-generator = prev.callPackage ./generator {arkenfox-extractor = extractor;};
arkenfox-doc-css = prev.writeText "style.css" (builtins.readFile ./doc/style.css);
}
// (docs prev));
default = self.overlays.arkenfox;
};
lib.arkenfox = {
supportedVersions = builtins.attrNames self.lib.arkenfox.extracted;
extracted = import ./autogen;
};
hmModules = {
arkenfox = import ./hm.nix self.lib.arkenfox.supportedVersions self.lib.arkenfox.extracted;
default = self.hmModules.arkenfox;
};
};
}