-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
116 lines (96 loc) · 3.89 KB
/
flake.nix
File metadata and controls
116 lines (96 loc) · 3.89 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
114
115
116
{
description = "CodeDown languages";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-25.05";
inputs.nixpkgs-master.url = "github:NixOS/nixpkgs/master";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, nixpkgs-master, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [];
pkgsStable = import nixpkgs { inherit system overlays; };
pkgsMaster = import nixpkgs-master { inherit system overlays; };
codedown = import ./codedown.nix {
pkgsStableSrc = nixpkgs;
inherit pkgsStable;
pkgsMasterSrc = nixpkgs-master;
inherit pkgsMaster;
};
sampleOutputs = pkgsStable.callPackage ./nix/sample-outputs.nix { inherit codedown pkgsStable; };
linkFarmWithPassthru = name: attrs: pkgsStable.runCommand name {
passthru = attrs;
} ''
mkdir -p $out
${pkgsStable.lib.concatStringsSep "\n" (pkgsStable.lib.mapAttrsToList (n: v: ''
mkdir -p $out/$(dirname "${n}")
ln -s ${v} $out/${n}
'') attrs)}
'';
optionsDoc = pkgsMaster.nixosOptionsDoc {
options = ((pkgsMaster.callPackage ./nix/evaluate-config.nix {
inherit pkgsStable pkgsMaster;
extraSpecialArgs = {
pkgs = {};
};
}) {}).options;
transformOptions = opt: opt // {
# Remove declarations to hide "Declared by" lines
declarations = [];
} // (pkgsMaster.lib.optionalAttrs (pkgsMaster.lib.head (opt.loc or []) == "_module") {
visible = false;
internal = true;
});
warningsAreErrors = false;
};
in
{
devShells = {
default = pkgsStable.mkShell {
NIX_PATH = "nixpkgs=${pkgsStable.path}";
buildInputs = with pkgsStable; [
nixos-render-docs
];
};
};
packages = {
# For nix repl debugging
# inherit codedown;
# For testing out the nixpkgs overlay
# environmentUsingNixpkgsOverlay = ((import nixpkgs {
# inherit system;
# overlays = [(pkgsStable.callPackage ./nix/nixpkgs-overlay.nix {})];
# }).makeEnvironment {
# su.enable = true;
# # su.outputs = ["out" "baz"];
# # _module.check = false;
# });
searcher = codedown.searcher pkgsStable;
testing = linkFarmWithPassthru "codedown-languages-testing" codedown.testing;
# Tests use flake to do packageSearch builds
inherit (codedown) packageSearch;
allSettingsSchemas = pkgsStable.callPackage ./nix/all-settings-schemas.nix { inherit (sampleOutputs) sample_environments; };
jupyter-runner = pkgsMaster.callPackage ./nix/jupyter-runner.nix {};
notebook = with pkgsStable; python3.pkgs.toPythonModule (
python3.pkgs.notebook.overridePythonAttrs (oldAttrs: {
makeWrapperArgs = ["--set JUPYTER_PATH ${sampleOutputs.sample_environments.mega}/lib/codedown"];
})
);
# Documentation generation
inherit (optionsDoc) optionsCommonMark optionsJSON;
# optionsHtml = pkgsStable.runCommand "options-html" {
# buildInputs = [ pkgsStable.nixos-render-docs pkgsStable.which ];
# } ''
# mkdir -p $out
# which nixos-render-docs
# echo "{}" > manpage-urls.json
# nixos-render-docs options commonmark \
# --manpage-urls manpage-urls.json \
# --revision master \
# ${optionsJson} \
# $out/index.html
# '';
}
// sampleOutputs.inner
;
}
);
}