summary refs log tree commit diff stats
path: root/system/settings/configuration/nix.nix
blob: 25b9696fb424a7a1836b97d833d8a7de82d60eef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ config
, lib
, pkgs
, ...
}: {
  imports = [
    ../../../pin.nix
  ];
  nix = {
    settings = {
      cores = 0;
      auto-optimise-store = true;
      use-xdg-base-directories = true;
    };

    daemonCPUSchedPolicy = "idle";
    daemonIOSchedClass = "idle";

    extraOptions = ''
      keep-outputs = true
      keep-derivations = true
      experimental-features = nix-command flakes
      warn-dirty = false
    '';

    gc = {
      automatic = lib.mkDefault true;
      options = "--delete-older-than 14d";
    };
  };

  system.autoUpgrade = {
    enable = true;
    flags = [ "--max-jobs" "2" ];
    flake = "/home/alan/projects/alanpearce/nixfiles";
  };
  systemd.services.nixos-upgrade = {
    script = pkgs.lib.mkForce ''
      ${pkgs.nix}/bin/nix-channel --update
      ${config.system.build.nixos-rebuild}/bin/nixos-rebuild boot --no-build-output ${toString config.system.autoUpgrade.flags}
    '';
  };
}