/
lib-compat.nix
43 lines (40 loc) · 1.02 KB
/
lib-compat.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
/*
This function sits at the root of the `styx` derivation for compatibility reasons
when styx is invoked with 'import pkgs.styx'
Therefore, the entire source tree is copied into the derivation.
Callers:
- site.nix (import pkgs.styx) -- musn't be impure within this flake, e.g. tests
*/
{
themes ? [],
config ? [],
env ? {},
pkgs ? import ./pkgs.nix,
debug ? false,
}: let
# configuration set
styxlib = import ./src/renderers/styxlib.nix {
inputs = {
nixpkgs = pkgs;
cells = {
data.styxthemes = import ./themes-compat.nix;
app = {
cli = {inherit (pkgs) styx;};
parsers = import ./src/app/parsers.nix {
inputs = {nixpkgs = pkgs;};
cell = null;
};
};
};
};
cell = null;
};
loaded = styxlib.themes.load {
lib = styxlib;
inherit themes env config;
};
in
pkgs.lib.traceIf debug "site config: ${pkgs.lib.generators.toPretty {} loaded.lib.config}" {
inherit (loaded) lib conf decls;
themes = loaded;
}