summaryrefslogtreecommitdiffstats
path: root/systems/zu/config.nix
blob: 50faf4bf062e99113d43d134f006894dc12d586c (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{ config, pkgs, ... }: {
  krebs.build.host = config.krebs.hosts.zu;

  imports = [
    ./hardware.nix
    ../../configs/binary-cache
    ../../configs/bluetooth.nix
    ../../configs/btrfs-scrub.nix
    ../../configs/exim-retiolum.nix
    ../../configs/gitrepos.nix
    ../../configs/initrd/sshd.nix
    ../../configs/mail-client.nix
    ../../configs/man.nix
    ../../configs/networkd.nix
    ../../configs/nginx/public_html.nix
    ../../configs/pulse.nix
    ../../configs/retiolum.nix
    ../../configs/xserver
    ../../configs/wiregrill.nix
  ];

  boot.binfmt.emulatedSystems = [ "aarch64-linux" ];

  boot.initrd.luks.devices.zuca.device = "/dev/sda2";

  boot.kernelPackages = pkgs.linuxPackages_latest;

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  fileSystems = {
    "/" = {
      device = "/dev/mapper/zuvga-root";
      fsType = "btrfs";
      options = ["defaults" "noatime" "ssd" "compress=lzo"];
    };
    "/bku" = {
      device = "/dev/mapper/zuvga-bku";
      fsType = "btrfs";
      options = ["defaults" "noatime" "ssd" "compress=lzo"];
    };
    "/home" = {
      device = "/dev/mapper/zuvga-home";
      fsType = "btrfs";
      options = ["defaults" "noatime" "ssd" "compress=lzo"];
    };
    "/boot" = {
      device = "/dev/sda1";
      fsType = "vfat";
    };
  };

  hrm.network.interfaces.eth0.medium = "ethernet";

  hrm.nftables.enable = true;

  networking.interfaces.eth0.useDHCP = true;
  networking.interfaces.wlan0.useDHCP = true;
  networking.usePredictableInterfaceNames = false;

  nix.daemonCPUSchedPolicy = "batch";
  nix.daemonIOSchedPriority = 1;
  nix.settings.extra-sandbox-paths = [ config.programs.ccache.cacheDir ];

  programs.ccache.enable = true;

  services.logind.settings.Login.HandleHibernateKey = "ignore";
  services.logind.settings.Login.HandleLidSwitch = "ignore";
  services.logind.settings.Login.HandleLidSwitchDocked = "ignore";
  services.logind.settings.Login.HandleLidSwitchExternalPower = "ignore";
  services.logind.settings.Login.HandlePowerKey = "ignore";
  services.logind.settings.Login.HandleSuspendKey = "ignore";

  services.printing.enable = true;

  #services.bitlbee.enable = true;
  #services.tor.client.enable = true;
  #services.tor.enable = true;

  # Logitech devices
  services.udev.extraRules = /* sh */ ''
    SUBSYSTEM=="hidraw", KERNEL=="hidraw*", DRIVERS=="logitech-hidpp-device", GROUP="plugdev", MODE="0660"
  '';

  # powertop: VM writeback timeout
  system.activationScripts.vm-writeback-timeout = ''
    echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
  '';

  # The NixOS release to be compatible with for stateful data such as databases.
  system.stateVersion = "15.09";

  systemd.network.links."10-ethernet" = {
    matchConfig.Name = "eth0";
    linkConfig.WakeOnLan = "magic";
  };

  users.groups.plugdev = {}; # https://github.com/NixOS/nixpkgs/pull/272506
}