blob: 9e306ef70a1b688bcae8e8bafaba304f90cbf3cc (
plain) (
blame)
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
|
{
description = "A NixOS Configuration";
inputs = {};
outputs = {self, ...}: let
raw_sources = import ./unflake.nix;
system = "x86_64-linux";
# Filter out the nixpkgs's from the sources, so we always use the `packageSets`.
sources = builtins.removeAttrs raw_sources ["nixpkgs-stable" "nixpkgs-unstable" "library"];
packageSets = rec {
stable = raw_sources.nixpkgs-stable.legacyPackages.${system};
unstable = raw_sources.nixpkgs-unstable.legacyPackages.${system};
in_tree = import ./pkgs {
unstable_pkgs = unstable;
stable_pkgs = stable;
inherit extra_lib;
};
};
lib = packageSets.unstable.lib;
extra_lib = raw_sources.library.nixLib;
extra_modules = [
sources.agenix.nixosModules.default
sources.turtle.nixosModules.nixos
sources.disko.nixosModules.default
sources.impermanence.nixosModules.impermanence
sources.simple-nixos-mailserver.nixosModule
sources.rocie.nixosModules.default
];
module_args = {
inherit
sources
# extra package sources
openPRsNixpkgs
packageSets
# extra information
system
;
};
special_args = {
inherit
self
# Needs to be a special argument, because it is used for determining the `imports`
# value (via `mkByName`).
extra_lib
;
};
openPRsNixpkgs = {};
treefmtEval = import ./treefmt.nix {
inherit (sources) treefmt-nix;
pkgs = packageSets.unstable;
};
hosts = import ./hosts {
inherit
self
extra_lib
module_args
special_args
extra_modules
system
;
inherit
(raw_sources)
nixpkgs-unstable
nixpkgs-stable
deploy-rs
;
};
deployChecks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) sources.deploy-rs.lib;
tests = lib.attrsets.filterAttrs (_: v: !(v ? meta && v.meta.broken)) (import ./tests
{
inherit sources packageSets extra_modules module_args special_args extra_lib;
});
# myPkgsFlat =
# builtins.listToAttrs
# # Filter out the `override` and `overrideDerivation` functions
# (builtins.filter
# ({ name, value, }: lib.attrsets.isDerivation value)
# (lib.lists.flatten
# (lib.attrsets.mapAttrsToList
# (name: value:
# if lib.attrsets.isDerivation value then
# [ { inherit name value; } ]
# else
# lib.attrsets.mapAttrsToList
# (name: value: { inherit name value; })
# value
# )
# packageSets.in_tree
# )
# )
# );
in {
checks."${system}" =
extra_lib.warnMerge
deployChecks."${system}"
(extra_lib.warnMerge
tests
{formatting = treefmtEval.config.build.check self;}
"the flake checks and formatting")
"the flake checks and deploy rs checks";
legacyPackages."${system}" = packageSets.unstable;
packages."${system}" = packageSets.in_tree;
formatter."${system}" = treefmtEval.config.build.wrapper;
devShells."${system}" = {
default = packageSets.unstable.mkShell {
packages = [
packageSets.unstable.deploy-rs
# Used to update the stalwart-mail spamfilter
packageSets.unstable.nix-update
(sources.agenix.packages."${system}".default.override {
nix = packageSets.unstable.lixPackageSets.latest.lix;
})
];
};
};
deploy.nodes = hosts.nodes;
inherit (hosts) nixosConfigurations;
};
}
|