Skip to content

Commit

Permalink
modules/nixos: add cgroups and exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
zowoq committed Nov 12, 2024
1 parent 5f28d26 commit 050b449
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
flake.nixosModules = {
buildbot = ./modules/nixos/buildbot.nix;
builder = ./modules/nixos/builder.nix;
cgroups = ./modules/nixos/cgroups.nix;
community-builder = ./modules/nixos/community-builder;
disko-zfs = ./modules/nixos/disko-zfs.nix;
github-org-backup = ./modules/nixos/github-org-backup.nix;
Expand Down
1 change: 1 addition & 0 deletions hosts/build03/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
inputs.self.nixosModules.disko-zfs
inputs.self.nixosModules.buildbot
inputs.self.nixosModules.builder
inputs.self.nixosModules.cgroups
inputs.self.nixosModules.hercules-ci
inputs.self.nixosModules.watch-store
./builders.nix
Expand Down
1 change: 1 addition & 0 deletions hosts/build04/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
inputs.srvos.nixosModules.hardware-hetzner-online-arm
inputs.self.nixosModules.disko-zfs
inputs.self.nixosModules.builder
inputs.self.nixosModules.cgroups
inputs.self.nixosModules.hercules-ci
inputs.self.nixosModules.remote-builder
];
Expand Down
33 changes: 33 additions & 0 deletions modules/nixos/cgroups.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
config,
inputs,
pkgs,
...
}:
{
imports = [
inputs.cgroup-exporter.nixosModules.default
];

services.prometheus.exporters.cgroup.enable = true;

services.telegraf.extraConfig.inputs.prometheus.urls = [
"http://localhost:${toString config.services.prometheus.exporters.cgroup.port}/metrics"
];

nix = {
package = pkgs.nixVersions.nix_2_25;

settings = {
experimental-features = [
"auto-allocate-uids"
"cgroups"
];

extra-system-features = [ "uid-range" ];

auto-allocate-uids = true;
use-cgroups = true;
};
};
}

0 comments on commit 050b449

Please sign in to comment.