summaryrefslogtreecommitdiff
path: root/modules/nix/default.nix
diff options
context:
space:
mode:
authorMalo Bourgon <mbourgon@gmail.com>2022-08-14 13:38:11 -0700
committerMalo Bourgon <mbourgon@gmail.com>2022-08-16 10:41:51 -0700
commit08edc0e19ac33435bd2b5dede373a2bea9f13b49 (patch)
tree0577383ea890ac23e17878ff693c6f8a8522d41b /modules/nix/default.nix
parent7e74c1c9fbb19638d95933b8bcac1757a184519e (diff)
Update/adapt daemon CPU/IO priority options in `nix` module
Stop using `nice` related options like NixOS, and because `launchd` recommends using `ProcessType` instead. Note this commit also changes the default `ProcessType` for the `nix-daemon` from `Interactive` to `Standard`.
Diffstat (limited to 'modules/nix/default.nix')
-rw-r--r--modules/nix/default.nix43
1 files changed, 31 insertions, 12 deletions
diff --git a/modules/nix/default.nix b/modules/nix/default.nix
index edc8d4f..c816648 100644
--- a/modules/nix/default.nix
+++ b/modules/nix/default.nix
@@ -131,12 +131,26 @@ let
in
{
- imports = [
- (mkRemovedOptionModule [ "nix" "profile" ] "Use `nix.package` instead.")
- (mkRemovedOptionModule [ "nix" "version" ] "Consider using `nix.package.version` instead.")
- (mkRenamedOptionModule [ "users" "nix" "configureBuildUsers" ] [ "nix" "configureBuildUsers" ])
- (mkRenamedOptionModule [ "users" "nix" "nrBuildUsers" ] [ "nix" "nrBuildUsers" ])
- ] ++ mapAttrsToList (oldConf: newConf: mkRenamedOptionModule [ "nix" oldConf ] [ "nix" "settings" newConf ]) legacyConfMappings;
+ imports =
+ let
+ altOption = alt: "No `nix-darwin` equivilant to this NixOS option, consider using `${alt}` instead.";
+ consider = alt: "Consider using `${alt}` instead.";
+ in
+ [
+ # Only ever in NixOS
+ (mkRemovedOptionModule [ "nix" "enable" ] "No `nix-darwin` equivilant to this NixOS option.")
+ (mkRemovedOptionModule [ "nix" "daemonCPUSchedPolicy" ] (altOption "nix.daemonProcessType"))
+ (mkRemovedOptionModule [ "nix" "daemonIOSchedClass" ] (altOption "nix.daemonProcessType"))
+ (mkRemovedOptionModule [ "nix" "daemonIOSchedPriority" ] (altOption "nix.daemonIOLowPriority"))
+
+ # Option changes in `nix-darwin`
+ (mkRemovedOptionModule [ "nix" "profile" ] "Use `nix.package` instead.")
+ (mkRemovedOptionModule [ "nix" "version" ] (consider "nix.package.version"))
+ (mkRenamedOptionModule [ "users" "nix" "configureBuildUsers" ] [ "nix" "configureBuildUsers" ])
+ (mkRenamedOptionModule [ "users" "nix" "nrBuildUsers" ] [ "nix" "nrBuildUsers" ])
+ (mkRenamedOptionModule [ "nix" "daemonIONice" ] [ "nix" "daemonIOLowPriority" ])
+ (mkRemovedOptionModule [ "nix" "daemonNiceLevel" ] (consider "nix.daemonProcessType"))
+ ] ++ mapAttrsToList (oldConf: newConf: mkRenamedOptionModule [ "nix" oldConf ] [ "nix" "settings" newConf ]) legacyConfMappings;
###### interface
@@ -177,17 +191,22 @@ in
};
# Not in NixOS module
- daemonNiceLevel = mkOption {
- type = types.int;
- default = 0;
+ daemonProcessType = mkOption {
+ type = types.enum [ "Background" "Standard" "Adaptive" "Interactive" ];
+ default = "Standard";
description = ''
- Nix daemon process priority. This priority propagates to build processes.
- 0 is the default Unix process priority, 19 is the lowest.
+ Nix daemon process resource limits class. These limits propagate to
+ build processes. <literal>Standard</literal> is the default process type
+ and will apply light resource limits, throttling its CPU usage and I/O
+ bandwidth.
+
+ See <command>man launchd.plist</command> for explanation of other
+ process types.
'';
};
# Not in NixOS module
- daemonIONice = mkOption {
+ daemonIOLowPriority = mkOption {
type = types.bool;
default = false;
description = ''