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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
{ config, pkgs, lib, ... }:
let
aliases = import ../data/aliases.nix;
my-overlay = self: super: {
my-linuxPackages = super.unstable.linuxPackages_latest;
};
in {
orbekk.gaming.enable = true;
orbekk.desktop.enable = true;
orbekk.builder.enableRemoteBuilds = true;
orbekk.rtc-wakeup.enable = true;
orbekk.vpn.enable = true;
# orbekk.pms7003-exporter.enable = false;
# Don't run gc on startup.
nix.gc.persistent = false;
systemd.watchdog.runtimeTime = "30s";
services.fwupd.enable = true;
orbekk.simple-firewall.allowedTCPPorts = [
69
22
aliases.services.prometheus-pms7003-exporter.port
"1714-1764"
];
orbekk.simple-firewall.allowedUDPPorts = [
# avahi
5353
69
"1714-1764"
];
environment.systemPackages = with pkgs; [
# minecraft
gnomeExtensions.appindicator
(kodi.withPackages (p:
with p; [
inputstream-adaptive
# controllers.default
joystick
inputstreamhelper
pvr-iptvsimple
]))
retroarch
wmctrl # for steam launcher
];
nixpkgs.config.retroarch = {
enableMGBA = true;
# enableCitra = true;
# enableDolphin = true;
};
nixpkgs.overlays = [ my-overlay ];
hardware.uinput.enable = true;
services.joycond.enable = true;
services.openssh.enable = true;
# systemd.services.display-manager.wants = [ "systemd-user-sessions.service" "multi-user.target" "network-online.target" ];
# systemd.services.display-manager.after = [ "systemd-user-sessions.service" "multi-user.target" "network-online.target" ];
# services.xserver.displayManager.lightdm.enable = lib.mkForce false;
services.xserver.displayManager.sddm.enable = lib.mkForce false;
services.xserver.displayManager.lightdm.enable = true;
services.xserver.displayManager.defaultSession = "plasmawayland";
services.xserver.displayManager.autoLogin = {
enable = true;
user = "guest";
};
networking.firewall.allowedTCPPorts = [ 22 4713 ];
networking.networkmanager.enable = true;
networking.networkmanager.wifi.powersave = false;
networking.vlans = {
"enp37s0.admin" = {
id = 255;
interface = "enp37s0";
};
};
networking.interfaces."enp37s0.admin".useDHCP = true;
systemd.extraConfig = "DefaultLimitNOFILE=1048576";
security.pam.loginLimits = [{
domain = "*";
type = "hard";
item = "nofile";
value = "1048576";
}];
# services.blueman.enable = true;
# services.xserver.videoDrivers = [ "amdgpu" ];
# services.xserver.resolutions = [{
# x = 2560;
# y = 1440;
# }];
hardware.cpu.amd.updateMicrocode = true;
hardware.enableAllFirmware = true;
hardware.enableRedistributableFirmware = true;
# To use steam driver instead:
# boot.blacklistedKernelModules = [ "hid_playstation" ];
boot.loader.timeout = 1;
boot.loader.grub.enable = true;
boot.loader.grub.devices = [ "nodev" ];
boot.loader.grub.efiSupport = true;
boot.loader.efi.canTouchEfiVariables = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.kernelPackages = pkgs.my-linuxPackages;
boot.kernelModules = [ "i2c-dev" ];
# https://bugzilla.kernel.org/show_bug.cgi?id=203709
boot.extraModprobeConfig = ''
# options iwlwifi power_save=0
# options iwlwifi swcrypto=1
# options iwlwifi disable_11ax=1
# options iwlwifi bt_coex_active=0
# options iwlmvm power_scheme=1
# options bluetooth disable_ertm=1
# For xpadneo
# alias hid:b0005g*v0000045Ep000002E0 hid_xpadneo
# alias hid:b0005g*v0000045Ep000002FD hid_xpadneo
# alias hid:b0005g*v0000045Ep00000B05 hid_xpadneo
# alias hid:b0005g*v0000045Ep00000B13 hid_xpadneo
'';
systemd.services.monitor-switch-to-me = {
description = "Switch monitor to this computer";
path = [ pkgs.ddcutil ];
script = let target = "0x0f";
in ''
# Would like to avoid switching if possible; sadly this doesn't reliably
# report other input sources.
# ddcutil --mfg HPN getvcp 60 | grep sl=${target} || \
ddcutil --mfg HPN setvcp 60 ${target} --sleep-multiplier 4
# Prevent from getting executed multiple times in succession.
sleep 15
'';
};
services.udev.extraRules = ''
# ACTION!="add", GOTO="display_switch_end"
# # Trigger on Planck keyboard.
# ATTRS{idVendor}=="feed",\
# ATTRS{idProduct}=="6060",\
# RUN+="${pkgs.systemd}/bin/systemctl start --no-block monitor-switch-to-me.service"
# LABEL="display_switch_end"
# For xpadneo
ACTION=="add", KERNEL=="0005:045E:02FD.*|0005:045E:02E0.*|0005:045E:0B05.*|0005:045E:0B13.*", SUBSYSTEM=="hid", DRIVER!="xpadneo", ATTR{driver/unbind}="%k", ATTR{[drivers/hid:xpadneo]bind}="%k"
ACTION=="add", DRIVERS=="xpadneo", SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="1", TAG+="uaccess", MODE="0664", ENV{LIBINPUT_IGNORE_DEVICE}="1"
'';
# boot.kernelPackages = let
# linux_pkg = { fetchgit, buildLinux, ... } @ args:
# buildLinux (args // rec {
# version = "5.6";
# modDirVersion = "5.6.0";
# src = pkgs.fetchgit {
# url = "https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux.git";
# rev = "v5.6";
# sha256 = "06xddhg04gv9azqikvv98xcv8x6h0x3xy2zc6r7m7jjd28a5bh6j";
# };
# kernelPatches = [];
# } // (args.argsOverride or {}));
# linux = pkgs.callPackage linux_pkg {};
# in pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux);
boot.kernelParams = [ ];
networking.hostName = "firelink"; # Define your hostname.
system.stateVersion = lib.mkForce "20.03";
# SSD configuration
fileSystems."/" = {
device = "/dev/mapper/cryptsystem";
fsType = "ext4";
options = [ "noatime" "discard" ];
};
boot.initrd.luks.devices."cryptsystem" = {
device = "/dev/disk/by-uuid/8acc11c2-e540-4561-8c88-34176fca1a72";
allowDiscards = true;
keyFile = "/dev/zero";
keyFileSize = 32;
fallbackToPassword = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/C636-D264";
fsType = "vfat";
};
programs.ssh.askPassword = "${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass";
# 60 fps
services.xserver.xrandrHeads = let
monitor = name: {
output = name;
monitorConfig = ''
ModeLine "3840x2160" 594.00 3840 4016 4104 4400 2160 2168 2178 2250 +hsync +vsync
Option "PreferredMode" "3840x2160_60"
'';
};
in [ (monitor "HDMI-0") (monitor "HDMI-1") ];
}
|