summaryrefslogtreecommitdiff
path: root/hosts/carrot/hardware.nix
blob: bc7eb3cb89c1280b6582020db404d2d7d1c2aa3c (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
{ inputs, lib, pkgs, ... }:

{
  boot.loader.grub.enable = false;
  boot.loader.generic-extlinux-compatible.enable = true;

  boot.kernelPackages = pkgs.linux-postmarketos-allwinner;
  hardware.firmware = with pkgs; [
    linux-firmware
    pine64-ov5640-firmware
  ];

  fileSystems."/" = {
    device = "/dev/mmcblk0p1";
    fsType = "ext4";
  };

  # fileSystems."/home" = {
  #   device = "/dev/mmcblk0p2";
  #   fsType = "ext4";
  # };

  zramSwap.enable = true;

  services.eg25-manager.enable = true;

  this.bluetooth.enable = true;

  # From PmOS
  boot.initrd.availableKernelModules = lib.mkForce [
    "sun6i_mipi_dsi"
    "sun4i_drm"
    "sun4i_lradc_keys"
    "pwm_sun4i"
    "sun8i_mixer"
    "anx7688"
    "gpio_vibra"
    "pinephone_keyboard"
  ];

  # services.udev = {
  #   path = with pkgs; [
  #     iw
  #   ];
  #   extraRules = ''
  #     ACTION=="add", SUBSYSTEM=="iio", TEST=="in_proximity_raw", ENV{PROXIMITY_NEAR_LEVEL}="250"

  #     SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="iw wlan0 set power_save off"
  #     SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="iw wlan0 set power_save on"

  #     SUBSYSTEM=="leds", DEVPATH=="*/*:flash", RUN+="/bin/chmod g+w /sys%p/brightness /sys%p/flash_strobe", RUN+="chown :video /sys%p/brightness /sys%p/flash_strobe"
  #   '';
  # };

  # services.xserver = {
  #   inputClassSections = [
  #   ''
  #     Identifier "PinePhone Keyboard"
  #     MatchIsKeyboard "True"
  #     MatchDevicePath "/dev/input/event*"
  #     MatchProduct "PinePhone Keyboard"
  #     Option "XkbLayout" "us"
  #     Option "XkbModel" "ppkb"
  #     Option "XkbOptions" "lv3:ralt_switch"
  #   ''
  #   ];
  # };

  nixpkgs.hostPlatform = "aarch64-linux";
}