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"; + }; }; }