summaryrefslogtreecommitdiff
path: root/hosts/laptop/configuration.nix
blob: 933f79c07df7abeac5b05176a7985968456868f0 (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
{
  config,
  lib,
  pkgs,
  inputs,
  ...
}:

{
  imports = [
    # Include the results of the hardware scan.
    ./hardware-configuration.nix
    ../../modules/common.nix
    ../../modules/re.nix
    ../../modules/wireguard.nix
    ../../modules/nfs.nix
  ];

  boot.loader.grub = {
    enable = true;
    device = "nodev";
    efiSupport = true;
  };
  boot.loader.efi.canTouchEfiVariables = false;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";

  networking.hostName = "laptop";
  networking.networkmanager.enable = lib.mkForce false;
  networking.wireless.iwd.enable = true;
  networking.wireless.iwd.settings = {
    General.EnableNetworkConfiguration = true;
    General.PowerSaveDisable = true;
    General.AddressRandomization = "disabled";
  };
  networking.nameservers = [
    "1.1.1.1"
    "8.8.8.8"
  ];

  programs.light.enable = true;

  programs.bash.shellAliases = {
    battery = "echo $(($(cat /sys/class/power_supply/BAT0/charge_now)*100/$(cat /sys/class/power_supply/BAT0/charge_full)))%";
    hibernate = "systemctl hibernate";
  };

  programs.fish.shellAliases = {
    hibernate = "systemctl hibernate";
  };

  home-manager.users.christian.programs.fish.functions = {
    battery.body = ''
      set now (cat /sys/class/power_supply/BAT0/charge_now)
      set full (cat /sys/class/power_supply/BAT0/charge_full)
      echo (math "$now * 100 / $full")%
    '';
  };

  services.logind.settings.Login = {
    HandlePowerKey = "ignore";
    HandlePowerKeyLongPress = "ignore";
  };

  services.keyd = {
    enable = true;
    keyboards.default = {
      ids = [ "*" ];
      settings.main.capslock = "overload(control, esc)";
    };
  };

  custom.wireguardAddress = "10.67.40.2/32";

  home-manager.users.christian.custom.xmobarBattery = true;

  swapDevices = [
    {
      device = "/swapfile";
      size = 8192; # 8GB in MiB
    }
  ];

  boot.resumeDevice = "/dev/disk/by-uuid/56ae0488-d952-41d8-8128-60a46e979d91";
  boot.kernelParams = [ "resume_offset=12832768" ];

  services.tlp = {
    enable = true;
    settings = {
      WIFI_PWR_ON_BAT = "off";
      WIFI_PWR_ON_AC = "off";
    };
  };

  programs.steam.enable = true;

  system.stateVersion = "25.11";
}