-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
34 lines (31 loc) · 840 Bytes
/
default.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
{
pkgs ? import <nixpkgs> { },
lib ? pkgs.lib,
configuration ? if builtins.pathExists ./configuration.nix then ./configuration.nix else { },
}:
let
eval = lib.evalModules {
modules =
lib.mapAttrsToList (n: v: ./modules + "/${n}/module.nix") (builtins.readDir ./modules)
++ [
(
{ config, ... }:
{
_module.args = {
inherit pkgs;
inherit (config.system) targetPkgs crossPkgs;
};
}
)
configuration
];
};
failedAssertions = map (x: x.message) (lib.filter (x: !x.assertion) eval.config.assertions);
cli = pkgs.callPackage ./cli.nix {
inherit eval;
};
in
if failedAssertions != [ ] then
throw "\nFailed assertions:\n${lib.concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
else
cli