-
Notifications
You must be signed in to change notification settings - Fork 16
/
flake.nix
105 lines (96 loc) · 2.68 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
# SPDX-FileCopyrightText: 2021 Richard Brežák and NixNG contributors
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-24.05";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs =
{
nixpkgs,
self,
treefmt-nix,
}:
let
supportedSystems = [
"x86_64-linux"
"i686-linux"
"aarch64-linux"
];
forAllSystems' = nixpkgs.lib.genAttrs;
forAllSystems = forAllSystems' supportedSystems;
pkgsForSystem =
system:
import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
treefmtEval = forAllSystems (
system: treefmt-nix.lib.evalModule (pkgsForSystem system) ./treefmt.nix
);
inherit (nixpkgs.lib) recurseIntoAttrs;
in
{
nglib = import ./lib nixpkgs.lib;
examples = import ./examples {
inherit nixpkgs;
inherit (self) nglib;
nixng = self;
};
overlays.default = import ./overlay;
legacyPackages = forAllSystems (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import ./overlay) ];
};
lib = pkgs.lib;
in
lib.genAttrs (lib.attrNames (import ./overlay null null)) (packageName: pkgs.${packageName})
);
packages = forAllSystems (
system:
let
lib = nixpkgs.lib;
in
lib.filterAttrs (_: v: lib.isDerivation v) self.legacyPackages.${system}
);
devShells = forAllSystems (
system:
let
pkgs = pkgsForSystem system;
in
{
default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ ]; };
}
);
checks =
{
formatting = forAllSystems (system: treefmtEval.${system}.config.build.check self);
examples = recurseIntoAttrs (
nixpkgs.lib.mapAttrs (n: v: v.config.system.build.toplevel) self.examples
);
}
// forAllSystems (
system:
let
pkgs = pkgsForSystem system;
in
{
with-lib = pkgs.callPackage ./checks/with-lib.nix { inherit self; } {
allowed = [
"/doc/style_and_vocabulary.org"
"/checks"
];
};
}
);
formatter = forAllSystems (system: (treefmtEval.${system}.config.build.wrapper));
};
}