summaryrefslogtreecommitdiff
path: root/nixos/pincer.nix
blob: f385f0b2243b9d6c392f36c3ec712ca2dbe1a2cf (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
100
101
102
103
{ config, pkgs, hardware, ... }:

{
  imports = [
    ./configuration.nix
  ];
  networking.hostName = "pincer";
  networking.firewall.allowedTCPPorts = [5201 34196 34197 5556 5558];
  networking.firewall.allowedUDPPorts = [5201 34196 34197];

  # hardware.pulseaudio.systemWide = true;
  # hardware.pulseaudio.enable = true;
  # hardware.pulseaudio.tcp.enable = true;
  # hardware.pulseaudio.tcp.anonymousClients.allowAll = true;
  # hardware.pulseaudio.zeroconf.discovery.enable = true;
  # hardware.pulseaudio.zeroconf.publish.enable = true;

  virtualisation.virtualbox.host.enable = true;

  hardware.opengl.driSupport32Bit = true;
  boot.loader.systemd-boot.enable = true;
  boot.loader.timeout = 0;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.initrd.luks.devices = [
    {
      device = "/dev/sda6";
      name = "cryptroot";
      allowDiscards = true;
    }
  ];
  # boot.kernelPackages = pkgs.linuxPackages_4_7;
  boot.kernelModules = ["tp_smapi" "thinkpad_acpi" "fbcon" "i915" "acpi_call"];
  boot.extraModulePackages = with config.boot.kernelPackages;
      [tp_smapi acpi_call];
  boot.extraModprobeConfig = ''
    options iwlwifi swcrypto=1
  '';


  fileSystems = {
    "/boot" = {
      mountPoint = "/boot";
      device = "/dev/sda1";
      fsType = "vfat";
    };
    "/" = {
      mountPoint = "/";
      device = "/dev/mapper/cryptroot";
      fsType = "btrfs";
      options = ["subvol=active/nixos-root" "discard" "compress=lzo"];
    };
    "/btrfs" = {
      mountPoint = "/btrfs";
      device = "/dev/mapper/cryptroot";
      fsType = "btrfs";
      options = ["discard" "compress=lzo"];
    };
  };

  environment.systemPackages = with pkgs;
    let
      myMinecraft = minecraft.override {
        jre = oraclejre8;
      };
      myFactorio = pwFactorio.overrideDerivation (o: {
        version = "0.14.20";
        src = requireFile {
          name = "factorio_alpha_x64_0.14.20.tar.gz";
	        url = "test";
          sha256 = "c7955fdb19895a38d02a536e0bb225ac3bbbc434fcf9c4968fbb4bd5c49329ae";
        };
      });
    in [
      # myMinecraft
      # myFactorio
      tpacpi-bat
    ];

  systemd.services.battery_threshold = {
    description = "Set battery charging thresholds.";
    path = [ pkgs.tpacpi-bat ];
    after = [ "basic.target" ];
    wantedBy = [ "multi-user.target" ];
    script = ''
      tpacpi-bat -s ST 1 39
      tpacpi-bat -s ST 2 39
      tpacpi-bat -s SP 1 80
      tpacpi-bat -s SP 2 80
    '';
  };

  services.tlp.enable = true;
  services.tlp.extraConfig = ''
    # Needed for either SSD or btrfs.
    SATA_LINKPWR_ON_BAT=max_performance
  '';


  services.xserver.xkbModel = "thinkpad60";

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