summaryrefslogtreecommitdiff
path: root/ilex/configuration.nix
blob: 70ca74d2ba3f0a507dfaec949d455c77727ba732 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports = [
    ./hardware-configuration.nix
    # ../modules/glitchtip.nix
    ../modules/crs-tools.nix
  ];


  networking.firewall.allowedTCPPorts = [ 5000 ];

  boot.kernelPackages =
    pkgs.linuxKernel.packageAliases.linux_latest;
  hardware.opengl.driSupport32Bit = true;

  hardware.bluetooth.enable = true;
  services.blueman.enable = true;

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "ilex";
  time.timeZone = "Europe/Amsterdam";

  networking = {
    networkmanager.enable = true;
    useDHCP = false;
    interfaces = {
      enp1s0f0.useDHCP = true;
    };
  };

  system.stateVersion = "22.11";

  services.postgresql = {
    enable = true;
    ensureDatabases = [ "tracktrain" "glitchtrip" "crstracker" "travelynx" "bookwyrm" ];
    ensureUsers = [ {
      name = "tracktrain";
      ensureDBOwnership = true;
    } {
      name = "travelynx";
      ensureDBOwnership = true;
    } {
      name = "glitchtrip";
      ensureDBOwnership = true;
    } {
      name = "bookwyrm";
      ensureDBOwnership = true;
    } {
      name = "crstracker";
      ensureDBOwnership = true;
    } ];
    authentication = ''
      local   all   all                              trust
      host    all   all        127.0.0.1/32          trust
      host    all   all        ::1/127               trust
    '';
    # package = pkgs.postgresql_11;
  };

  services.redis.servers."bookwyrm" = {
    enable = true;
    port = 6379;
  };

  # services.glitchtip = {
  #   enable = true;
  #   databaseUrl = "postgres://glitchtrip@localhost:5432/glitchtrip";
  # };
  # services.redis.servers.glitchtip = {
  #   enable = true;
  #   port = 6379;
  # };

  # services.crs-tracker = {
  #   enable = true;
  #   nginxVirtualHostConfig = {
  #     listen = [{
  #       addr = "127.0.0.1";
  #       port = 8080;
  #       ssl = false;
  #     }];
  #   };
  # };


  # for testing nomsring
  # services.fcgiwrap.enable = true;
  # services.nginx = {
  #   enable = true;
  #   virtualHosts.default = {
  #     locations."~ (.*)".extraConfig = ''
  #       fastcgi_pass  unix:${config.services.fcgiwrap.socketAddress};
  #       include       ${pkgs.nginx}/conf/fastcgi_params;
  #       fastcgi_param SCRIPT_FILENAME     /tmp/dingsda;
  #       fastcgi_param PATH_INFO           $1;
  #     '';
  #   };
  # };
  services.tlp = {
    enable = true;
    settings = {
      START_CHARGE_THRESH_BAT0 = 75;
      STOP_CHARGE_THRESH_BAT0 = 80;
      PLATFORM_PROFILE_ON_AC = "performance";
      PLATFORM_PROFILE_ON_BAT = "low-power";
      CPU_SCALING_GOVERNOR_ON_AC = "performance";
      CPU_SCALING_GOVERNOR_ON_BAT = "schedutil";
      DEVICES_TO_ENABLE_ON_STARTUP = "wifi";
      DEVICES_TO_DISABLE_ON_STARTUP = "bluetooth wwan";
      DEVICES_TO_DISABLE_ON_LAN_CONNECT = "wifi";
      DEVICES_TO_ENABLE_ON_LAN_DISCONNECT = "wifi";
      WIFI_PWR_ON_AC = "off";
      WIFI_PWR_ON_BAT = "on";
      USB_AUTOSUSPEND = 1;
      USB_EXCLUDE_AUDIO = 1;
    };
  };



}