-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
124 lines (107 loc) · 3.34 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
{
description = "Hackworth Ltd .github repo.";
inputs = {
hacknix.url = "github:hackworthltd/hacknix";
nixpkgs.follows = "hacknix/nixpkgs";
systems.url = "github:nix-systems/default";
flake-utils.url = "github:numtide/flake-utils";
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs:
let
allOverlays = [
inputs.hacknix.overlays.default
];
in
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
debug = true;
imports = [
inputs.treefmt-nix.flakeModule
inputs.pre-commit-hooks-nix.flakeModule
];
systems = [ "x86_64-linux" "aarch64-darwin" ];
perSystem = { config, pkgs, system, ... }:
let
in
{
# We need a `pkgs` that includes our own overlays within
# `perSystem`. This isn't done by default, so we do this
# workaround. See:
#
# https://github.com/hercules-ci/flake-parts/issues/106#issuecomment-1399041045
_module.args.pkgs = import inputs.nixpkgs
{
inherit system;
config = {
allowUnfree = true;
allowBroken = true;
};
overlays = allOverlays;
};
treefmt.config =
{
projectRootFile = "flake.nix";
programs = {
prettier.enable = true;
nixpkgs-fmt.enable = true;
};
};
pre-commit = {
check.enable = true;
settings = {
src = ".";
hooks = {
treefmt.enable = true;
actionlint.enable = true;
actionlint.files = "^.github/workflows/";
};
};
};
devShells.default = pkgs.mkShell {
inputsFrom = [
config.treefmt.build.devShell
config.pre-commit.devShell
];
buildInputs = (with pkgs;
[
actionlint
nixd
]);
};
};
flake =
let
# See above, we need to use our own `pkgs` within the flake.
pkgs = import inputs.nixpkgs
{
system = "x86_64-linux";
config = {
allowUnfree = true;
allowBroken = true;
};
overlays = allOverlays;
};
in
{
hydraJobs = {
inherit (inputs.self) checks;
inherit (inputs.self) devShells;
required = pkgs.releaseTools.aggregate {
name = "required-nix-ci";
constituents = builtins.map builtins.attrValues (with inputs.self.hydraJobs; [
checks.x86_64-linux
checks.aarch64-darwin
]);
meta.description = "Required Nix CI builds";
};
};
ciJobs = pkgs.lib.flakes.recurseIntoHydraJobs inputs.self.hydraJobs;
};
};
}