From 3ff7dab1cca0900655fae33ff612764482043fa4 Mon Sep 17 00:00:00 2001 From: isabel Date: Sun, 5 Apr 2026 19:35:14 +0100 Subject: [PATCH] nix: add cgroups This reverts commit 4dbf890b2901a0523525b074568f13027a9eafc9. Once again i would like to have cgroups --- modules/base/nix/nix.nix | 4 ++++ modules/nixos/nix.nix | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/base/nix/nix.nix b/modules/base/nix/nix.nix index 9aa041ab..45b31553 100644 --- a/modules/base/nix/nix.nix +++ b/modules/base/nix/nix.nix @@ -116,6 +116,10 @@ in # which is BEYOND annoying, which makes this a really nice feature to have "auto-allocate-uids" + # allows Nix to execute builds inside cgroups + # remember you must also enable use-cgroups in the nix.conf or settings + "cgroups" + # allow usage of the pipe operator in nix expressions "pipe-operator" diff --git a/modules/nixos/nix.nix b/modules/nixos/nix.nix index a429835b..932b92dd 100644 --- a/modules/nixos/nix.nix +++ b/modules/nixos/nix.nix @@ -14,8 +14,18 @@ # daemonIOSchedClass = "idle"; # daemonIOSchedPriority = 7; - # set the build dir to /var/tmp to avoid issues on tmpfs - # https://github.com/NixOS/nixpkgs/issues/293114#issuecomment-2663470083 - settings.build-dir = "/var/tmp"; + settings = { + # the defaults to false even if the experimental feature is enabled so we + # need to enable it here, this is also only available on linux and the + # option is explicitly removed on darwin so we have to have this here. it + # is also important to enable auto-allocate-uids since this is implicated + # as a requirement + use-cgroups = true; + auto-allocate-uids = true; + + # set the build dir to /var/tmp to avoid issues on tmpfs + # https://github.com/NixOS/nixpkgs/issues/293114#issuecomment-2663470083 + build-dir = "/var/tmp"; + }; }; } -- 2.51.2