Skip to content

Commit ed651bc

Browse files
committed
reformat with treefmt
1 parent c30232e commit ed651bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+2069
-1819
lines changed

build/common.nix

+47-22
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
{ config, pkgs, lib, ... }:
1+
{
2+
config,
3+
pkgs,
4+
lib,
5+
...
6+
}:
27

38
with lib;
49

510
{
6-
imports =
7-
[ ./diffoscope.nix
8-
../modules/common.nix
9-
../modules/prometheus
10-
../modules/wireguard.nix
11-
];
11+
imports = [
12+
./diffoscope.nix
13+
../modules/common.nix
14+
../modules/prometheus
15+
../modules/wireguard.nix
16+
];
1217

1318
nixpkgs.config.allowUnfree = true;
1419

@@ -18,19 +23,35 @@ with lib;
1823

1924
# Prevent "out of sync" errors on the KVM switch.
2025
boot.vesa = false;
21-
boot.blacklistedKernelModules = [ "radeonfb" "radeon" "i915" ];
26+
boot.blacklistedKernelModules = [
27+
"radeonfb"
28+
"radeon"
29+
"i915"
30+
];
2231
boot.kernelParams = [ "nomodeset" ];
2332

2433
hardware.enableAllFirmware = true;
2534
hardware.cpu.amd.updateMicrocode = true;
2635
hardware.cpu.intel.updateMicrocode = true;
2736

28-
environment.systemPackages =
29-
[ pkgs.emacs pkgs.sysstat pkgs.hdparm pkgs.sdparm # pkgs.lsiutil
30-
pkgs.htop pkgs.sqlite pkgs.iotop pkgs.lm_sensors pkgs.hwloc
31-
pkgs.lsof pkgs.numactl pkgs.gcc pkgs.smartmontools pkgs.tcpdump pkgs.gdb
32-
pkgs.elfutils
33-
];
37+
environment.systemPackages = [
38+
pkgs.emacs
39+
pkgs.sysstat
40+
pkgs.hdparm
41+
pkgs.sdparm # pkgs.lsiutil
42+
pkgs.htop
43+
pkgs.sqlite
44+
pkgs.iotop
45+
pkgs.lm_sensors
46+
pkgs.hwloc
47+
pkgs.lsof
48+
pkgs.numactl
49+
pkgs.gcc
50+
pkgs.smartmontools
51+
pkgs.tcpdump
52+
pkgs.gdb
53+
pkgs.elfutils
54+
];
3455

3556
services.openssh.enable = true;
3657

@@ -39,11 +60,10 @@ with lib;
3960

4061
nix.nrBuildUsers = 100;
4162

42-
nix.extraOptions =
43-
''
44-
allowed-impure-host-deps = /etc/protocols /etc/services /etc/nsswitch.conf
45-
allowed-uris = https://github.com/ https://git.savannah.gnu.org/ github:
46-
'';
63+
nix.extraOptions = ''
64+
allowed-impure-host-deps = /etc/protocols /etc/services /etc/nsswitch.conf
65+
allowed-uris = https://github.com/ https://git.savannah.gnu.org/ github:
66+
'';
4767

4868
networking.useDHCP = false;
4969

@@ -65,9 +85,14 @@ with lib;
6585

6686
# Bump the open files limit so that non-root users can run NixOS VM
6787
# tests (Samba opens lot of files).
68-
security.pam.loginLimits =
69-
[ { domain = "*"; item = "nofile"; type = "-"; value = "16384"; }
70-
];
88+
security.pam.loginLimits = [
89+
{
90+
domain = "*";
91+
item = "nofile";
92+
type = "-";
93+
value = "16384";
94+
}
95+
];
7196

7297
# Enable Kernel Samepage Merging (reduces memory footprint of VMs).
7398
hardware.ksm.enable = true;

build/datadog/hydra.nix

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
{ pkgs, ...}:
1+
{ pkgs, ... }:
22
{
33
systemd.services.dd-agent.environment.PYTHONPATH = "${pkgs.pythonPackages.requests}/lib/python2.7/site-packages";
44
environment.etc =
55
let
6-
hydra-config =
7-
pkgs.writeText "hydra.yaml" ''
8-
init_config:
9-
10-
instances:
11-
- check: 1
12-
'';
13-
in [
14-
{ source = hydra-config;
6+
hydra-config = pkgs.writeText "hydra.yaml" ''
7+
init_config:
8+
9+
instances:
10+
- check: 1
11+
'';
12+
in
13+
[
14+
{
15+
source = hydra-config;
1516
target = "dd-agent/conf.d/hydra.yaml";
1617
}
17-
{ source = ./hydra.py;
18+
{
19+
source = ./hydra.py;
1820
target = "dd-agent/checks.d/hydra.py";
1921
}
2022
];

build/diffoscope.nix

+13-15
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,30 @@ with pkgs.lib;
44

55
let
66

7-
diffoscopeWrapper = pkgs.writeScript "diffoscope-wrapper"
8-
''
9-
#! ${pkgs.stdenv.shell}
10-
exec >&2
11-
echo ""
12-
echo "non-determinism detected in $2; diff with previous round follows:"
13-
echo ""
14-
time ${pkgs.utillinux}/bin/runuser -u diffoscope -- ${pkgs.diffoscope}/bin/diffoscope "$1" "$2"
15-
exit 0
16-
'';
7+
diffoscopeWrapper = pkgs.writeScript "diffoscope-wrapper" ''
8+
#! ${pkgs.stdenv.shell}
9+
exec >&2
10+
echo ""
11+
echo "non-determinism detected in $2; diff with previous round follows:"
12+
echo ""
13+
time ${pkgs.utillinux}/bin/runuser -u diffoscope -- ${pkgs.diffoscope}/bin/diffoscope "$1" "$2"
14+
exit 0
15+
'';
1716

1817
in
1918

2019
{
2120

22-
nix.extraOptions =
23-
''
24-
diff-hook = ${diffoscopeWrapper}
25-
'';
21+
nix.extraOptions = ''
22+
diff-hook = ${diffoscopeWrapper}
23+
'';
2624

2725
# Don't run diffoscope as root.
2826
users.extraUsers.diffoscope = {
2927
description = "Diffoscope containment user";
3028
group = "diffoscope";
3129
isSystemUser = true;
3230
};
33-
users.groups.diffoscope = {};
31+
users.groups.diffoscope = { };
3432

3533
}

build/flake.nix

+33-18
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,20 @@
2626
inputs.rfc39.url = "github:NixOS/rfc39";
2727
inputs.rfc39.inputs.nixpkgs.follows = "nixpkgs";
2828

29-
outputs = { self, agenix, colmena, disko, hydra, hydra-scale-equinix-metal, nix, nixpkgs, nixos-channel-scripts, nix-netboot-serve, rfc39 }:
29+
outputs =
30+
{
31+
self,
32+
agenix,
33+
colmena,
34+
disko,
35+
hydra,
36+
hydra-scale-equinix-metal,
37+
nix,
38+
nixpkgs,
39+
nixos-channel-scripts,
40+
nix-netboot-serve,
41+
rfc39,
42+
}:
3043
let
3144
inherit (nixpkgs) lib;
3245

@@ -45,7 +58,8 @@
4558
rfc39.overlays.default
4659
];
4760
};
48-
in {
61+
in
62+
{
4963
nixosConfigurations.haumea = nixpkgs.lib.nixosSystem {
5064
system = "x86_64-linux";
5165

@@ -73,15 +87,14 @@
7387
];
7488
};
7589

76-
colmena = {
77-
meta = {
78-
description = "NixOS.org infrastructure";
79-
nixpkgs = import nixpkgs {
80-
system = "x86_64-linux";
90+
colmena =
91+
{
92+
meta = {
93+
description = "NixOS.org infrastructure";
94+
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
8195
};
82-
};
83-
} // builtins.mapAttrs
84-
(name: value: {
96+
}
97+
// builtins.mapAttrs (name: value: {
8598
nixpkgs.system = value.config.nixpkgs.system;
8699
imports = value._module.args.modules;
87100
deployment = {
@@ -90,13 +103,15 @@
90103
}) self.nixosConfigurations;
91104

92105
# TODO: flake-utils.lib.eachDefaultSystem
93-
devShell.x86_64-linux = let
94-
pkgs = import nixpkgs { system = "x86_64-linux"; };
95-
in pkgs.mkShell {
96-
buildInputs = with pkgs; [
97-
agenix.packages.x86_64-linux.agenix
98-
colmena.packages.x86_64-linux.colmena
99-
];
100-
};
106+
devShell.x86_64-linux =
107+
let
108+
pkgs = import nixpkgs { system = "x86_64-linux"; };
109+
in
110+
pkgs.mkShell {
111+
buildInputs = with pkgs; [
112+
agenix.packages.x86_64-linux.agenix
113+
colmena.packages.x86_64-linux.colmena
114+
];
115+
};
101116
};
102117
}

build/haumea/boot.nix

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
copyKernels = true;
88
configurationLimit = 10; # 230 MB /boot capacity
99
};
10-
boot.initrd.availableKernelModules = [ "ahci" "nvme" "usbhid" ];
10+
boot.initrd.availableKernelModules = [
11+
"ahci"
12+
"nvme"
13+
"usbhid"
14+
];
1115
boot.kernelModules = [ "kvm-amd" ];
1216
}

build/haumea/default.nix

+25-24
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
{ lib
2-
, modulesPath
3-
, pkgs
4-
, ...
1+
{
2+
lib,
3+
modulesPath,
4+
pkgs,
5+
...
56
}:
67

78
{
@@ -13,7 +14,7 @@
1314
./postgresql.nix
1415
./zrepl.nix
1516
];
16-
17+
1718
networking = {
1819
hostId = "83c81a23";
1920
hostName = "haumea";
@@ -22,25 +23,25 @@
2223

2324
environment.systemPackages = [ pkgs.lz4 ];
2425

25-
fileSystems."/" =
26-
{ device = "rpool/safe/root";
27-
fsType = "zfs";
28-
};
29-
30-
fileSystems."/boot" =
31-
{ device = "/dev/disk/by-label/boot0";
32-
fsType = "ext4";
33-
};
34-
35-
fileSystems."/nix" =
36-
{ device = "rpool/local/nix";
37-
fsType = "zfs";
38-
};
39-
40-
fileSystems."/var/db/postgresql" =
41-
{ device = "rpool/safe/postgres";
42-
fsType = "zfs";
43-
};
26+
fileSystems."/" = {
27+
device = "rpool/safe/root";
28+
fsType = "zfs";
29+
};
30+
31+
fileSystems."/boot" = {
32+
device = "/dev/disk/by-label/boot0";
33+
fsType = "ext4";
34+
};
35+
36+
fileSystems."/nix" = {
37+
device = "rpool/local/nix";
38+
fsType = "zfs";
39+
};
40+
41+
fileSystems."/var/db/postgresql" = {
42+
device = "rpool/safe/postgres";
43+
fsType = "zfs";
44+
};
4445

4546
services.zfs.autoScrub.enable = true;
4647

build/haumea/network.nix

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
"46.4.89.205/27"
1212
"2a01:4f8:212:41c9::1/64"
1313
];
14-
routes = [ {
15-
routeConfig.Gateway = "46.4.89.193";
16-
} {
17-
routeConfig.Gateway = "fe80::1";
18-
} ];
14+
routes = [
15+
{ routeConfig.Gateway = "46.4.89.193"; }
16+
{ routeConfig.Gateway = "fe80::1"; }
17+
];
1918
networkConfig.Description = "WAN";
2019
linkConfig.RequiredForOnline = true;
2120
};

build/haumea/postgresql.nix

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
{ lib
2-
, pkgs
3-
, ...
4-
}:
1+
{ lib, pkgs, ... }:
52

63
{
74
systemd.services.postgresql = {
@@ -38,7 +35,7 @@
3835
log_statement = "none";
3936

4037
# pgbadger-compatible logging
41-
log_transaction_sample_rate = 0.01;
38+
log_transaction_sample_rate = 1.0e-2;
4239
log_min_duration_statement = 5000;
4340
log_checkpoints = "on";
4441
log_connections = "on";
@@ -83,8 +80,8 @@
8380
# benefit from frequent vacuums, so this should
8481
# help. In particular, I'm thinking the jobsets
8582
# pages.
86-
autovacuum_vacuum_scale_factor = 0.02;
87-
autovacuum_analyze_scale_factor = 0.01;
83+
autovacuum_vacuum_scale_factor = 2.0e-2;
84+
autovacuum_analyze_scale_factor = 1.0e-2;
8885

8986
shared_preload_libraries = "pg_stat_statements";
9087
compute_query_id = "on";
@@ -101,4 +98,5 @@
10198
prometheus root root
10299
prometheus postgres-exporter root
103100
'';
104-
};}
101+
};
102+
}

0 commit comments

Comments
 (0)