-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
.drone.jsonnet
105 lines (88 loc) · 2.63 KB
/
.drone.jsonnet
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
// Create/Update flake info file with:
// nix flake show --json > info.json
local info = import 'info.json';
// Test configuration with:
// nix-shell -p jsonnet --run 'jsonnet .drone.jsonnet'
local hosts = std.objectFields(info.nixosConfigurations);
local packages = std.objectFields(info.packages['x86_64-linux']);
// To overerride the lists use:
// local hosts = ['ahorn', 'birne', 'bob', 'kartoffel', 'kfbox', 'porree'];
// local packages = [ 'filebrowser', 'fritzbox_exporter', 'hello-custom', ];
local steps_hosts() = std.flatMap(function(host) [
{
name: 'Build host: %s' % host,
commands: [
"nix build '.#nixosConfigurations.%s.config.system.build.toplevel'" % host,
],
},
{
name: 'Upload host: %s' % host,
commands: [
"nix run 'github:lounge-rocks/the-lounge#s3uploader' result"
],
// depends_on: [ 'Build host: %s' % host ],
environment: {
AWS_ACCESS_KEY_ID: { from_secret: 's3_access_key' },
AWS_SECRET_ACCESS_KEY: { from_secret: 's3_secret_key' },
},
}
], hosts);
local steps_packages() = std.flatMap(function(package) [
{
name: 'Build package: %s' % package,
commands: [
"nix build '.#%s'" % package,
],
},
{
name: 'Upload package: %s' % package,
commands: [
"nix run 'github:lounge-rocks/the-lounge#s3uploader' result"
],
// depends_on: [ 'Upload package: %s' % package ],
environment: {
AWS_ACCESS_KEY_ID: { from_secret: 's3_access_key' },
AWS_SECRET_ACCESS_KEY: { from_secret: 's3_secret_key' },
},
}
], packages);
{
kind: 'pipeline',
type: 'exec',
name: 'Build all hosts',
platform: {
os: 'linux',
arch: 'amd64',
},
clone: { depth: 1 },
steps: [
// {
// name: 'Notify Test',
// commands: [
// "nix run nixpkgs#curl -- -u $ntfy-user:$ntfy-pass -H 'Title: $DRONE_REPO build: $DRONE_BUILD_STATUS' -H 'Priority: low' -H 'Tags: drone,build,nixos' -d '[$DRONE_REPO] $DRONE_COMMIT '$DRONE_COMMIT_MESSAGE': $DRONE_BUILD_STATUS' https://push.pablo.tools/drone_build ",
// ],
// }
{
name: 'Show flake info',
commands: [
"nix --experimental-features 'nix-command flakes' flake show",
"nix --experimental-features 'nix-command flakes' flake metadata",
],
},
{
name: 'Run flake checks',
commands: [
"nix --experimental-features 'nix-command flakes' flake check --show-trace",
],
},
] + steps_hosts() + steps_packages() + [
],
environment: {
LOGNAME: 'drone',
NOTIFY_TOKEN: { from_secret: 'notify_token' },
},
trigger: {
branch: ['main', 'go-task'],
event: ['push'],
},
}