]> Git — Sourcephile - julm/julm-nix.git/blob - nixos/profiles/builder.nix
nix: tweak nix-daemon and nix-gc schedulings
[julm/julm-nix.git] / nixos / profiles / builder.nix
1 { lib, inputs, ... }:
2 {
3 nix.settings.experimental-features = [ "nix-command" "flakes" "repl-flake" ];
4 #nix.registry.self.flake = inputs.self;
5 # Pin the rev to the revision of the public Nixpkgs that the system was built from.
6 # This is the version which will be locked by flakes using flake:nixpkgs
7 nix.registry.nixpkgs = {
8 from = { id = "nixpkgs"; type = "indirect"; };
9 to = {
10 owner = "NixOS";
11 repo = "nixpkgs";
12 inherit (inputs.nixpkgs) rev;
13 type = "github";
14 };
15 };
16 nix.nixPath = [
17 "nixpkgs=${inputs.nixpkgs}"
18 ];
19
20 systemd.services.nix-daemon.serviceConfig = {
21 CPUSchedulingPolicy = lib.mkForce "batch";
22 IOSchedulingClass = lib.mkForce "best-effort";
23 # 0: high priority, 7: low priority
24 IOSchedulingPriority = lib.mkForce 4;
25 Nice = 0;
26 };
27
28 systemd.services.nix-gc.serviceConfig = {
29 CPUSchedulingPolicy = "batch";
30 IOSchedulingClass = "best-effort";
31 IOSchedulingPriority = 7;
32 Nice = 5;
33 };
34
35 systemd.sleep.extraConfig = ''
36 AllowSuspend=no
37 AllowHibernation=no
38 '';
39 }