Skip to content

Commit 0a73474

Browse files
committed
move checks out of flake.nix
1 parent d70b626 commit 0a73474

File tree

2 files changed

+47
-57
lines changed

2 files changed

+47
-57
lines changed

checks/flake-module.nix

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
{ self, ... }:
22
{
33
perSystem =
4-
{ pkgs, lib, ... }:
4+
{
5+
self',
6+
system,
7+
pkgs,
8+
lib,
9+
...
10+
}:
511
{
612
checks =
713
let
814
# this gives us a reference to our flake but also all flake inputs
915
checkArgs = {
1016
inherit self pkgs;
1117
};
18+
nixosMachines = lib.mapAttrs' (
19+
name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel
20+
) ((lib.filterAttrs (name: _: lib.hasSuffix system name)) self.nixosConfigurations);
21+
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
22+
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
1223
in
13-
lib.mkIf (pkgs.stdenv.hostPlatform.isLinux) {
24+
nixosMachines
25+
// packages
26+
// devShells
27+
// lib.mkIf (pkgs.stdenv.hostPlatform.isLinux) {
1428
master = import ./master.nix checkArgs;
1529
worker = import ./worker.nix checkArgs;
1630
effects = import ./effects.nix checkArgs;

flake.nix

Lines changed: 31 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,61 +18,37 @@
1818

1919
outputs =
2020
inputs@{ self, flake-parts, ... }:
21-
flake-parts.lib.mkFlake { inherit inputs; } (
22-
{
23-
lib,
24-
...
25-
}:
26-
{
27-
imports =
28-
[
29-
./devShells/flake-module.nix
30-
./nixosModules/flake-module.nix
31-
./checks/flake-module.nix
32-
./packages/flake-module.nix
33-
]
34-
++ inputs.nixpkgs.lib.optional (inputs.treefmt-nix ? flakeModule) ./formatter/flake-module.nix
35-
++ inputs.nixpkgs.lib.optionals (inputs.hercules-ci-effects ? flakeModule) [
36-
inputs.hercules-ci-effects.flakeModule
37-
./herculesCI/flake-module.nix
38-
];
39-
systems = [
40-
"x86_64-linux"
41-
"aarch64-linux"
42-
"aarch64-darwin"
21+
flake-parts.lib.mkFlake { inherit inputs; } {
22+
imports =
23+
[
24+
./devShells/flake-module.nix
25+
./nixosModules/flake-module.nix
26+
./checks/flake-module.nix
27+
./packages/flake-module.nix
28+
]
29+
++ inputs.nixpkgs.lib.optional (inputs.treefmt-nix ? flakeModule) ./formatter/flake-module.nix
30+
++ inputs.nixpkgs.lib.optionals (inputs.hercules-ci-effects ? flakeModule) [
31+
inputs.hercules-ci-effects.flakeModule
32+
./herculesCI/flake-module.nix
4333
];
34+
systems = [
35+
"x86_64-linux"
36+
"aarch64-linux"
37+
"aarch64-darwin"
38+
];
4439

45-
flake = {
46-
nixosConfigurations =
47-
let
48-
examplesFor =
49-
system:
50-
import ./examples {
51-
inherit system;
52-
inherit (inputs) nixpkgs;
53-
buildbot-nix = self;
54-
};
55-
in
56-
examplesFor "x86_64-linux" // examplesFor "aarch64-linux";
57-
58-
};
59-
perSystem =
60-
{
61-
self',
62-
system,
63-
...
64-
}:
65-
{
66-
checks =
67-
let
68-
nixosMachines = lib.mapAttrs' (
69-
name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel
70-
) ((lib.filterAttrs (name: _: lib.hasSuffix system name)) self.nixosConfigurations);
71-
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
72-
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
73-
in
74-
nixosMachines // packages // devShells;
75-
};
76-
}
77-
);
40+
flake = {
41+
nixosConfigurations =
42+
let
43+
examplesFor =
44+
system:
45+
import ./examples {
46+
inherit system;
47+
inherit (inputs) nixpkgs;
48+
buildbot-nix = self;
49+
};
50+
in
51+
examplesFor "x86_64-linux" // examplesFor "aarch64-linux";
52+
};
53+
};
7854
}

0 commit comments

Comments
 (0)