Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules/nixos: add cgroups and exporter #1466

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hosts/build03/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
inputs.self.nixosModules.buildbot
inputs.self.nixosModules.builder
inputs.self.nixosModules.ci-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 @@ -5,6 +5,7 @@
inputs.self.nixosModules.disko-zfs
inputs.self.nixosModules.builder
inputs.self.nixosModules.ci-builder
inputs.self.nixosModules.cgroups
inputs.self.nixosModules.hercules-ci
inputs.self.nixosModules.remote-builder
];
Expand Down
31 changes: 31 additions & 0 deletions modules/nixos/cgroups.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
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"
];

auto-allocate-uids = true;
use-cgroups = true;
};
};
}
4 changes: 2 additions & 2 deletions modules/nixos/hydra.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
(pkgs.runCommand "etc-nix-machines" { machines = config.environment.etc."nix/machines".text; } ''
printf "$machines" | grep build04 > $out
substituteInPlace $out --replace-fail 'ssh-ng://' 'ssh://'
substituteInPlace $out --replace-fail ' 80 ' ' 2 '
substituteInPlace $out --replace-fail ' 80 ' ' 3 '
'')

(pkgs.writeText "local" ''
localhost x86_64-linux,builtin - 2 1 ${pkgs.lib.concatStringsSep "," config.nix.settings.system-features} - -
localhost x86_64-linux,builtin - 3 1 ${pkgs.lib.concatStringsSep "," config.nix.settings.system-features} - -
'')
];
hydraURL = "https://hydra.nix-community.org";
Expand Down