-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
133 lines (117 loc) · 3.78 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
{
description = "A Nix flake containing EPICS-related modules and packages";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
bash-lib = {
url = "github:minijackson/bash-lib";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
sphinxcontrib-nixdomain = {
url = "github:minijackson/sphinxcontrib-nixdomain";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
flake-utils,
nixpkgs,
...
} @ inputs: let
overlay = import ./pkgs self.lib inputs;
systemDependentOutputs = system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
overlay
inputs.bash-lib.overlay
inputs.poetry2nix.overlays.default
inputs.sphinxcontrib-nixdomain.overlays.default
];
};
in {
packages = flake-utils.lib.flattenTree pkgs.epnix;
checks =
{
# Everything should always build
allPackages = pkgs.releaseTools.aggregate {
name = "allPackages";
constituents = builtins.attrValues self.packages.${system};
};
}
// (import ./pkgs/tests {inherit pkgs self;})
// (import ./ioc/tests {inherit pkgs self;})
// (import ./nixos/tests/all-tests.nix {inherit nixpkgs pkgs self system;});
devShells.default = pkgs.epnixLib.mkEpnixDevShell {
nixpkgsConfig.system = system;
epnixConfig.epnix = {
meta.name = "epnix";
buildConfig.src = pkgs.emptyDirectory;
devShell.packages = [
{
package = pkgs.poetry;
category = "development tools";
}
{
package = pkgs.vale;
category = "development tools";
}
];
devShell.attrs.inputsFrom = [
pkgs.epnix.docs
];
};
};
devShell = self.devShells.${system}.default;
};
in
# Not eachDefaultSystem right now, because `nix flake check` tries to
# build every derivation of every system, which fails.
# Waiting on: https://github.com/NixOS/nix/pull/7759
(flake-utils.lib.eachSystem ["x86_64-linux"] systemDependentOutputs)
// {
overlays.default = overlay;
lib = let
epnixLib = import ./lib {
inherit (nixpkgs) lib;
inherit epnixLib inputs;
};
in
epnixLib;
nixosModules.default = {
imports = [
self.nixosModules.ioc
self.nixosModules.nixos
];
};
nixosModules.ioc = {
imports = import ./ioc/modules/module-list.nix;
_module.args.epnix = self;
};
nixosModules.nixos = {lib, ...}: {
imports = import ./nixos/module-list.nix;
# use mkBefore so that end users can be sure
# that their overlay can override EPNix packages
nixpkgs.overlays = lib.mkBefore [self.overlays.default];
_module.args.epnixLib = self.lib;
};
templates.top = {
path = ./templates/top;
description = "An EPNix TOP project";
welcomeText = ''
You have created an EPNix top.
Don't forget to run `makeBaseApp.pl` and `eregen` inside the development shell before compiling it.
Useful links:
- EPNix IOC documentation: <https://epics-extensions.github.io/EPNix/ioc/>
- EPNix IOC tutorials: <https://epics-extensions.github.io/EPNix/ioc/tutorials/>
'';
};
templates.default = self.templates.top;
defaultTemplate = self.templates.default;
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
};
}