forked from dcoapp/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
126 lines (109 loc) · 3.46 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
{
description = "Hackworth Ltd's fork of dcoapp/app";
inputs = {
hacknix.url = github:hackworthltd/hacknix;
nixpkgs.follows = "hacknix/nixpkgs";
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";
};
outputs = inputs@ { flake-parts, ... }:
let
allOverlays = [
inputs.hacknix.overlays.default
];
in
flake-parts.lib.mkFlake { inherit inputs; } {
debug = true;
imports = [
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;
};
pre-commit = {
check.enable = true;
settings = {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
prettier = {
# Disabled for the time being.
enable = false;
};
actionlint = {
enable = true;
name = "actionlint";
entry = "${pkgs.actionlint}/bin/actionlint";
language = "system";
files = "^.github/workflows/";
};
};
};
};
devShells.default = pkgs.mkShell {
buildInputs = (with pkgs; [
actionlint
nixpkgs-fmt
nodejs-16_x
rnix-lsp
]);
# Make sure the Nix shell includes node_modules's bin dir in
# the path, or else our editors may not see the editor
# tooling that we include in the Node packaging.
shellHook = ''
export PATH="$(pwd)/node_modules/.bin:$PATH"
if ! type -P pnpm ; then
npx pnpm add pnpm
else
pnpm install
fi
'';
};
};
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;
};
};
}