forked from circuithub/nix-buildkite-buildkite-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
131 lines (108 loc) · 3.81 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
{
description = "A Buildkite plugin for Nix builds.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/22.05";
# We use this for some convenience functions only.
hacknix.url = "github:hackworthltd/hacknix";
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
flake-parts.url = "github:hercules-ci/flake-parts";
hacknix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@ { flake-parts, ... }:
let
in
flake-parts.lib.mkFlake { inherit inputs; }
{
debug = true;
imports = [
];
systems = [ "x86_64-linux" "aarch64-darwin" ];
perSystem = { config, pkgs, system, ... }: {
# 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 = [ inputs.self.overlays.default ];
};
packages = {
inherit (pkgs.haskellPackages) nix-buildkite;
};
checks = { };
apps =
let
mkApp = pkg: script: {
type = "app";
program = "${pkg}/bin/${script}";
};
in
(pkgs.lib.mapAttrs (name: pkg: mkApp pkg name) {
inherit (pkgs.haskellPackages) nix-buildkite;
});
devShells.default = pkgs.haskellPackages.nix-buildkite.env;
};
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 = [ inputs.self.overlays.default ];
};
in
{
overlays.default = (final: prev:
let
inherit (prev) haskell haskellPackages;
inherit (haskellPackages) callCabal2nix;
inherit (haskell.lib) appendConfigureFlag packagesFromDirectory;
inherit (prev.lib) composeExtensions;
WError =
drv: appendConfigureFlag drv "--ghc-option=-Werror";
configurations =
self: super: {
nix-buildkite = WError (callCabal2nix "nix-buildkite" (builtins.path { path = ./.; name = "nix-buildkite"; }) { });
};
in
{
haskellPackages =
prev.haskellPackages.override
(
old:
{
overrides = configurations;
}
);
}
);
hydraJobs = {
inherit (inputs.self) checks;
inherit (inputs.self) packages;
inherit (inputs.self) devShells;
required = pkgs.releaseTools.aggregate {
name = "required-nix-ci";
constituents = builtins.map builtins.attrValues (with inputs.self.hydraJobs; [
packages.x86_64-linux
packages.aarch64-darwin
checks.x86_64-linux
checks.aarch64-darwin
]);
meta.description = "Required Nix CI builds";
};
};
ciJobs = inputs.hacknix.lib.flakes.recurseIntoHydraJobs inputs.self.hydraJobs;
};
};
}