-
Notifications
You must be signed in to change notification settings - Fork 0
/
codedown.nix
71 lines (53 loc) · 2.29 KB
/
codedown.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
{ pkgsStable
, pkgsMaster
, requiredPackages ? []
, system ? "x86_64-linux"
}:
let
common = pkgsStable.callPackage ./modules/kernels/common.nix {};
callPackage = pkgsStable.callPackage;
lib = pkgsStable.lib;
in
rec {
spellchecker = pkgsMaster.callPackage ./modules/language_servers/markdown-spellcheck-lsp {};
testing = {
builds-forever = pkgsMaster.callPackage ./modules/testing/builds-forever.nix {};
};
# Exported so clients can build searchers for other package sets, like "codedown.searcher nixpkgs"
searcher = common.searcher;
settingsSchemas = lib.mapAttrs (attr: value: value.meta.settingsSchema or []) kernels;
evaluateConfig = callPackage ./nix/evaluate-config.nix {
inherit pkgsStable pkgsMaster;
};
everythingConfig = let
base = evaluateConfig {};
kernelNames = builtins.attrNames base.options.kernels;
shellNames = builtins.attrNames base.options.shells;
exporterNames = builtins.attrNames base.options.exporters;
in
builtins.foldl' lib.recursiveUpdate {} (
(map (n: { kernels.${n}.enable = true; }) kernelNames)
++ (map (n: { shells.${n}.enable = true; }) shellNames)
++ (map (n: { exporters.${n}.enable = true; }) exporterNames)
);
everythingEnv = evaluateConfig everythingConfig;
packageSearch = common.searcher' {
# Note that we deliberately don't include "testing" packages in the searcher
packages =
(lib.mapAttrs' (n: v: lib.nameValuePair ("kernels." + n) v) everythingEnv.config.builtKernels)
// (lib.mapAttrs' (n: v: lib.nameValuePair ("exporters." + n) v) everythingEnv.config.builtExporters)
// (lib.mapAttrs' (n: v: lib.nameValuePair n v) everythingEnv.config.packages)
// { "language-servers.spellchecker" = spellchecker; }
;
};
kernels = everythingEnv.config.builtKernels;
makeEnvironment = callPackage ./nix/makeEnvironment.nix {
inherit pkgsStable pkgsMaster;
};
validateEnvironment = callPackage ./nix/validateEnvironment.nix {};
# Exposed for consumers to pin and use to gather metadata from other channels like Nixpkgs
chooseMeta = callPackage ./nix/choose-meta.nix {};
nixpkgsOverlay = callPackage ./nix/nixpkgs-overlay.nix {};
# Exposed so it's easier to compute build dependencies in the presence of IFD
inherit pkgsStable pkgsMaster requiredPackages;
}