Skip to content

Commit 47936ff

Browse files
Mic92mergify[bot]
authored andcommitted
switch to nixfmt
1 parent 850fee9 commit 47936ff

File tree

12 files changed

+364
-297
lines changed

12 files changed

+364
-297
lines changed

examples/attic-watch-store.nix

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
{ pkgs
2-
, config
3-
, ...
4-
}: {
1+
{ pkgs, config, ... }:
2+
{
53
# sops-nix (https://github.com/Mic92/sops-nix) is just an example, here.
64
# Replace with your own secret management as needed: https://wiki.nixos.org/wiki/Comparison_of_secret_managing_schemes
7-
sops.secrets."attic/prod-auth-token" = { sopsFile = ../secrets.yaml; };
8-
sops.secrets."attic/netrc-file-pull-push" = { sopsFile = ../secrets.yaml; };
5+
sops.secrets."attic/prod-auth-token" = {
6+
sopsFile = ../secrets.yaml;
7+
};
8+
sops.secrets."attic/netrc-file-pull-push" = {
9+
sopsFile = ../secrets.yaml;
10+
};
911

1012
# Add netrc file for this machine to do its normal thing with the cache, as a machine.
1113
nix.settings.netrc-file = config.sops.secrets."attic/netrc-file-pull-push".path;
@@ -31,4 +33,4 @@
3133
exec attic watch-store prod:prod
3234
'';
3335
};
34-
}
36+
}

examples/default.nix

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1-
{ nixpkgs, system, buildbot-nix, ... }:
1+
{
2+
nixpkgs,
3+
system,
4+
buildbot-nix,
5+
...
6+
}:
27
let
38
# some example configuration to make it eval
4-
dummy = { config, ... }: {
5-
config = {
6-
networking.hostName = "example-common";
7-
system.stateVersion = config.system.nixos.version;
8-
users.users.root.initialPassword = "fnord23";
9-
boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ];
10-
fileSystems."/".device = lib.mkDefault "/dev/sda";
9+
dummy =
10+
{ config, ... }:
11+
{
12+
config = {
13+
networking.hostName = "example-common";
14+
system.stateVersion = config.system.nixos.version;
15+
users.users.root.initialPassword = "fnord23";
16+
boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ];
17+
fileSystems."/".device = lib.mkDefault "/dev/sda";
18+
};
1119
};
12-
};
1320

1421
inherit (nixpkgs) lib;
1522
inherit (lib) nixosSystem;

examples/master.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
github = {
2222
# Use this when you have set up a GitHub App
2323
authType.app = {
24-
id = 000000; # FIXME: replace with App ID obtained from GitHub
24+
id = 0; # FIXME: replace with App ID obtained from GitHub
2525
secretKeyFile = pkgs.writeText "app-secret.key" "00000000000000000000"; # FIXME: replace with App secret key obtained from GitHub
2626
};
2727
#authType.legacy = {

flake.nix

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
1313
};
1414

15-
outputs = inputs@{ self, flake-parts, ... }:
16-
flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }:
15+
outputs =
16+
inputs@{ self, flake-parts, ... }:
17+
flake-parts.lib.mkFlake { inherit inputs; } (
18+
{ lib, ... }:
1719
{
1820
imports = [
1921
./nix/checks/flake-module.nix
@@ -22,48 +24,72 @@
2224
flake = {
2325
nixosModules.buildbot-master.imports = [
2426
./nix/master.nix
25-
({ pkgs, ... }: {
26-
services.buildbot-nix.master.buildbotNixpkgs = lib.mkDefault inputs.nixpkgs.legacyPackages.${pkgs.hostPlatform.system};
27-
})
27+
(
28+
{ pkgs, ... }:
29+
{
30+
services.buildbot-nix.master.buildbotNixpkgs =
31+
lib.mkDefault
32+
inputs.nixpkgs.legacyPackages.${pkgs.hostPlatform.system};
33+
}
34+
)
2835
];
2936
nixosModules.buildbot-worker.imports = [
3037
./nix/worker.nix
31-
({ pkgs, ... }: {
32-
services.buildbot-nix.worker.buildbotNixpkgs = lib.mkDefault inputs.nixpkgs.legacyPackages.${pkgs.hostPlatform.system};
33-
})
38+
(
39+
{ pkgs, ... }:
40+
{
41+
services.buildbot-nix.worker.buildbotNixpkgs =
42+
lib.mkDefault
43+
inputs.nixpkgs.legacyPackages.${pkgs.hostPlatform.system};
44+
}
45+
)
3446
];
3547

3648
nixosConfigurations =
3749
let
38-
examplesFor = system: import ./examples {
39-
inherit system;
40-
inherit (inputs) nixpkgs;
41-
buildbot-nix = self;
42-
};
50+
examplesFor =
51+
system:
52+
import ./examples {
53+
inherit system;
54+
inherit (inputs) nixpkgs;
55+
buildbot-nix = self;
56+
};
4357
in
4458
examplesFor "x86_64-linux" // examplesFor "aarch64-linux";
4559

4660
lib = {
47-
interpolate = value:
48-
{ _type = "interpolate"; inherit value; };
61+
interpolate = value: {
62+
_type = "interpolate";
63+
inherit value;
64+
};
4965
};
5066
};
51-
perSystem = { self', pkgs, system, ... }: {
52-
packages.default = pkgs.mkShell {
53-
packages = [
54-
pkgs.bashInteractive
55-
pkgs.mypy
56-
pkgs.ruff
57-
];
67+
perSystem =
68+
{
69+
self',
70+
pkgs,
71+
system,
72+
...
73+
}:
74+
{
75+
packages.default = pkgs.mkShell {
76+
packages = [
77+
pkgs.bashInteractive
78+
pkgs.mypy
79+
pkgs.ruff
80+
];
81+
};
82+
packages.buildbot-nix = pkgs.python3.pkgs.callPackage ./default.nix { };
83+
checks =
84+
let
85+
nixosMachines = lib.mapAttrs' (
86+
name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel
87+
) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
88+
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
89+
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
90+
in
91+
nixosMachines // packages // devShells;
5892
};
59-
packages.buildbot-nix = pkgs.python3.pkgs.callPackage ./default.nix { };
60-
checks =
61-
let
62-
nixosMachines = lib.mapAttrs' (name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
63-
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
64-
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
65-
in
66-
nixosMachines // packages // devShells;
67-
};
68-
});
93+
}
94+
);
6995
}

nix/buildbot-gitea.nix

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
{ buildPythonPackage
2-
, fetchPypi
3-
, lib
1+
{
2+
buildPythonPackage,
3+
fetchPypi,
4+
lib,
45

5-
, pip
6-
, buildbot
7-
, requests
6+
pip,
7+
buildbot,
8+
requests,
89
}:
9-
buildPythonPackage (lib.fix (self: {
10-
pname = "buildbot-gitea";
11-
version = "1.8.0";
10+
buildPythonPackage (
11+
lib.fix (self: {
12+
pname = "buildbot-gitea";
13+
version = "1.8.0";
1214

13-
propagatedBuildInputs = [
14-
pip
15-
buildbot
16-
requests
17-
];
15+
propagatedBuildInputs = [
16+
pip
17+
buildbot
18+
requests
19+
];
1820

19-
patches = [ ./0001-reporter-create-status-in-the-base-repository-of-a-p.patch ];
21+
patches = [ ./0001-reporter-create-status-in-the-base-repository-of-a-p.patch ];
2022

21-
src = fetchPypi {
22-
inherit (self) pname version;
23-
hash = "sha256-zYcILPp42QuQyfEIzmYKV9vWf47sBAQI8FOKJlZ60yA=";
24-
};
25-
}))
23+
src = fetchPypi {
24+
inherit (self) pname version;
25+
hash = "sha256-zYcILPp42QuQyfEIzmYKV9vWf47sBAQI8FOKJlZ60yA=";
26+
};
27+
})
28+
)

nix/checks/flake-module.nix

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
{ self, ... }: {
1+
{ self, ... }:
2+
{
23
perSystem =
3-
{ pkgs
4-
, ...
5-
}: {
4+
{ pkgs, ... }:
5+
{
66
checks =
77
let
88
# this gives us a reference to our flake but also all flake inputs
9-
checkArgs = { inherit self pkgs; };
9+
checkArgs = {
10+
inherit self pkgs;
11+
};
1012
in
1113
{
1214
master = import ./master.nix checkArgs;

nix/checks/lib.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ in
1515
# This makes `self` available in the NixOS configuration of our virtual machines.
1616
# This is useful for referencing modules or packages from your own flake
1717
# as well as importing from other flakes.
18-
node.specialArgs = { inherit self; };
18+
node.specialArgs = {
19+
inherit self;
20+
};
1921
imports = [ test ];
2022
}).config.result

nix/checks/master.nix

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22
name = "from-nixos";
33
nodes = {
44
# `self` here is set by using specialArgs in `lib.nix`
5-
node1 = { self, pkgs, ... }: {
6-
imports = [
7-
self.nixosModules.buildbot-master
8-
];
9-
services.buildbot-nix.master = {
10-
enable = true;
11-
domain = "buildbot2.thalheim.io";
12-
workersFile = pkgs.writeText "workers.json" ''
13-
[
14-
{ "name": "eve", "pass": "XXXXXXXXXXXXXXXXXXXX", "cores": 16 }
15-
]
16-
'';
17-
admins = [ "Mic92" ];
18-
github = {
19-
authType.legacy = {
20-
tokenFile = pkgs.writeText "github-token" "ghp_000000000000000000000000000000000000";
5+
node1 =
6+
{ self, pkgs, ... }:
7+
{
8+
imports = [ self.nixosModules.buildbot-master ];
9+
services.buildbot-nix.master = {
10+
enable = true;
11+
domain = "buildbot2.thalheim.io";
12+
workersFile = pkgs.writeText "workers.json" ''
13+
[
14+
{ "name": "eve", "pass": "XXXXXXXXXXXXXXXXXXXX", "cores": 16 }
15+
]
16+
'';
17+
admins = [ "Mic92" ];
18+
github = {
19+
authType.legacy = {
20+
tokenFile = pkgs.writeText "github-token" "ghp_000000000000000000000000000000000000";
21+
};
22+
webhookSecretFile = pkgs.writeText "webhookSecret" "00000000000000000000";
23+
oauthSecretFile = pkgs.writeText "oauthSecret" "ffffffffffffffffffffffffffffffffffffffff";
24+
oauthId = "aaaaaaaaaaaaaaaaaaaa";
2125
};
22-
webhookSecretFile = pkgs.writeText "webhookSecret" "00000000000000000000";
23-
oauthSecretFile = pkgs.writeText "oauthSecret" "ffffffffffffffffffffffffffffffffffffffff";
24-
oauthId = "aaaaaaaaaaaaaaaaaaaa";
2526
};
2627
};
27-
};
2828
};
2929
# This is the test code that will check if our service is running correctly:
3030
testScript = ''

nix/checks/worker.nix

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
name = "from-nixos";
33
nodes = {
44
# `self` here is set by using specialArgs in `lib.nix`
5-
node1 = { self, config, pkgs, ... }: {
6-
imports = [
7-
self.nixosModules.buildbot-worker
8-
];
9-
services.buildbot-nix.worker = {
10-
enable = true;
11-
workerPasswordFile = pkgs.writeText "password" "password";
5+
node1 =
6+
{
7+
self,
8+
config,
9+
pkgs,
10+
...
11+
}:
12+
{
13+
imports = [ self.nixosModules.buildbot-worker ];
14+
services.buildbot-nix.worker = {
15+
enable = true;
16+
workerPasswordFile = pkgs.writeText "password" "password";
17+
};
1218
};
13-
};
1419
};
1520
# This is the test code that will check if our service is running correctly:
1621
testScript = ''

0 commit comments

Comments
 (0)