forked from aakropotkin/ak-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
168 lines (118 loc) · 5.51 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
{
description = "Misc Nix derivations and expressions";
inputs.nix.url = "github:NixOS/nix";
inputs.nix.inputs.nixpkgs.follows = "/nixpkgs";
inputs.yants-src = {
type = "file";
url = "https://code.tvl.fyi/plain/nix/yants/default.nix";
flake = false;
};
/* -------------------------------------------------------------------------- */
outputs = { self, nixpkgs, nix, yants-src, ... }: let
# An extension to `nixpkgs.lib'.
lib = import ./lib { inherit nix yants-src; inherit (nixpkgs) lib; };
inherit (lib) eachDefaultSystemMap;
in {
/* -------------------------------------------------------------------------- */
# Not effected by systems:
inherit lib;
# `nix-repl> :a ( builtins.getFlake "ak-core" ).repl'
repl =
( lib // { inNixRepl = true; } ) //
lib.librepl //
builtins //
( { npFor = nixpkgs.legacyPackages.${builtins.currentSystem}; } );
# Wrappers for Pandoc, Makeinfo, and NixOS module options' generators.
docgen = ( eachDefaultSystemMap ( system: import ./pkgs/docgen {
inherit (nixpkgs.legacyPackages.${system}) pandoc texinfo;
} ) ) // { __functor = _self: system: _self.${system}; };
/* -------------------------------------------------------------------------- */
tarutils = ( eachDefaultSystemMap ( system:
import ./pkgs/build-support/trivial/tar.nix {
inherit system lib;
inherit (nixpkgs.legacyPackages.${system})
gzip gnutar coreutils bash findutils;
} ) ) // { __functor = _self: system: _self.${system}; };
/* -------------------------------------------------------------------------- */
linkutils = ( eachDefaultSystemMap ( system:
import ./pkgs/build-support/trivial/link.nix {
inherit system lib;
inherit (nixpkgs.legacyPackages.${system}) coreutils bash;
} ) ) // { __functor = _self: system: _self.${system}; };
/* -------------------------------------------------------------------------- */
copyutils = ( eachDefaultSystemMap ( system:
import ./pkgs/build-support/trivial/copy.nix {
inherit system lib;
inherit (nixpkgs.legacyPackages.${system}) coreutils bash;
} ) ) // { __functor = _self: system: _self.${system}; };
/* -------------------------------------------------------------------------- */
trivial = ( eachDefaultSystemMap ( system:
self.tarutils.${system} // self.linkutils.${system} //
self.copyutils.${system}
) ) // { __functor = _self: system: _self.${system}; };
/* -------------------------------------------------------------------------- */
#packages = eachDefaultSystemMap ( system: {} );
/* -------------------------------------------------------------------------- */
# Merge input overlays in isolation from one another.
overlays.ak-nix = final: prev: let
tarutils = import ./pkgs/build-support/trivial/tar.nix {
inherit (prev) lib gzip gnutar coreutils bash findutils system;
};
linkutils = import ./pkgs/build-support/trivial/link.nix {
inherit (prev) lib coreutils bash system;
};
copyutils = import ./pkgs/build-support/trivial/copy.nix {
inherit (prev) lib coreutils bash system;
};
trivial = tarutils // linkutils // copyutils;
in {
lib = import ./lib { inherit (prev) lib; inherit nix; };
} // trivial;
overlays.default = self.overlays.ak-nix;
/* -------------------------------------------------------------------------- */
nixosModules.ak-nix = { config, ... }: {
overlays = [self.overlays.ak-nix];
};
nixosModules.default = self.nixosModules.ak-nix;
/* -------------------------------------------------------------------------- */
# FIXME: these blow up on `aarch64-darwin' for some reason; there's an issue
# with how `system' is being passed to the test suite.
#checks = eachDefaultSystemMap ( system: let
# pkgsFor = nixpkgs.legacyPackages.${system};
#in {
# trivial = import ./pkgs/build-support/trivial/tests {
# inherit lib system nixpkgs;
# inherit (pkgsFor)
# writeText runCommandNoCC
# gnutar gzip coreutils findutils bash
# ;
# tarutils = self.tarutils.${system};
# linkutils = self.linkutils.${system};
# outputAttr = "writeRunReport";
# # See additional configurable options in the `default.nix' file.
# # We didn't export them here, but if you're modifying this codebase
# # they may be useful to you.
# };
# default = self.checks.${system}.trivial;
#} );
/* -------------------------------------------------------------------------- */
templates = {
default = self.templates.basic;
basic.path = ./templates/basic;
basic.description = "a dank starter flake";
meaty.path = ./templates/meaty;
meaty.description = "a meaty starter flake";
basic-pkg.path = ./templates/basic-pkg;
basic-pkg.description = "a basic GNU build system package";
autotools.path = ./templates/autotools;
autotools.description = "a basic autotools project";
lib-sub.path = ./templates/lib-sub;
lib-sub.description = "a sub library file";
tests.path = ./templates/tests;
tests.description = "a test harness for Nix expressions and drvs";
tests-sub.path = ./templates/tests-sub;
tests-sub.description = "a subset of tests for the `ak-nix' Test harness";
};
/* -------------------------------------------------------------------------- */
};
}