File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 4242 imports = [
4343 ./packages.nix
4444 ./cachix.nix
45+ ./niks3.nix
4546 ( mkRenamedOptionModule
4647 [
4748 "services"
Original file line number Diff line number Diff line change 1+ {
2+ lib ,
3+ config ,
4+ pkgs ,
5+ ...
6+ } :
7+ let
8+ cfg = config . services . buildbot-nix . master ;
9+ interpolate = value : {
10+ _type = "interpolate" ;
11+ inherit value ;
12+ } ;
13+ in
14+ {
15+ options . services . buildbot-nix . master . niks3 = {
16+ enable = lib . mkEnableOption "Enable niks3 integration" ;
17+
18+ serverUrl = lib . mkOption {
19+ type = lib . types . str ;
20+ description = "niks3 server URL" ;
21+ example = "https://niks3.yourdomain.com" ;
22+ } ;
23+
24+ authTokenFile = lib . mkOption {
25+ type = lib . types . path ;
26+ description = ''
27+ Path to a file containing the niks3 API authentication token.
28+ '' ;
29+ } ;
30+
31+ package = lib . mkOption {
32+ type = lib . types . package ;
33+ default =
34+ pkgs . niks3 or ( throw "niks3 package not found in pkgs. Please add niks3 flake input and overlay." ) ;
35+ description = "The niks3 package to use" ;
36+ } ;
37+ } ;
38+
39+ config = lib . mkIf cfg . niks3 . enable {
40+ systemd . services . buildbot-master . serviceConfig . LoadCredential = [
41+ "niks3-auth-token:${ builtins . toString cfg . niks3 . authTokenFile } "
42+ ] ;
43+
44+ systemd . services . buildbot-worker . path = [ cfg . niks3 . package ] ;
45+
46+ services . buildbot-nix . master . postBuildSteps = [
47+ {
48+ name = "Upload to niks3" ;
49+ environment = {
50+ NIKS3_SERVER_URL = cfg . niks3 . serverUrl ;
51+ } ;
52+ command = [
53+ "niks3" # note that this is the niks3 from the worker's $PATH
54+ "push"
55+ "--auth-token"
56+ ( interpolate "%(secret:niks3-auth-token)s" )
57+ ( interpolate "result-%(prop:attr)s" )
58+ ] ;
59+ }
60+ ] ;
61+ } ;
62+ }
You can’t perform that action at this time.
0 commit comments