nix/hosts/wyndle/configuration.nix (view raw)
1{ self, config, pkgs, lib, ... }:
2
3{
4 imports =
5 [
6 ./hardware-configuration.nix
7 ];
8
9 boot = {
10 loader.systemd-boot.enable = true;
11 loader.efi.canTouchEfiVariables = true;
12 kernel.sysctl."net.ipv4.ip_forward" = 1;
13 resumeDevice = "/dev/nvme0n1p2";
14 kernelPackages = pkgs.linuxPackages;
15 };
16
17 networking = {
18 nameservers = [ "8.8.8.8" "8.8.4.4" ];
19 networkmanager.enable = true;
20 # wireless = {
21 # enable = true;
22 # interfaces = [ "wlp6s0" ];
23 # environmentFile = "/home/icy/secrets/wireless.env";
24 # networks = {
25 # Sanic.psk = "@PSK_SANI@";
26 # Gopalan5G.psk = "@PSK_GOPA@";
27 # denim.psk = "@PSK_DENI@";
28 # };
29 # extraConfig = ''
30 # ctrl_interface=/run/wpa_supplicant
31 # ctrl_interface_group=wheel
32 # '';
33 # };
34 # dhcpcd.enable = true;
35 hostName = "wyndle";
36 useDHCP = false;
37 interfaces.wlp6s0.useDHCP = true;
38 firewall.checkReversePath = "loose";
39 };
40
41 i18n.defaultLocale = "en_US.UTF-8";
42 time.timeZone = "Asia/Kolkata";
43
44 nixpkgs.config = {
45 allowUnfree = true;
46 allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
47 "steam"
48 "steam-original"
49 "steam-runtime"
50 ];
51 st = {
52 conf = builtins.readFile ../../programs/st/config.h;
53 extraLibs = with pkgs; [ harfbuzz ];
54 patches = [
55 ../../patches/st/xres.diff
56 ../../patches/st/bright.diff
57 ../../patches/st/ligatures.diff
58 ];
59 };
60 chromium = {
61 commandLineArgs = "--ozone-platform=wayland";
62 };
63 firefox.enablePlasmaBrowserIntegration = true;
64 };
65
66 nixpkgs.overlays = with self.overlays; [
67 nvim-nightly
68 prompt
69 plan9patched
70 ];
71
72 environment = {
73 etc = {
74 "supergfxd.conf" = {
75 mode = "0644";
76 source = (pkgs.formats.json { }).generate "supergfxd.conf" {
77 mode = "hybrid";
78 vfio_enable = false;
79 vfio_save = false;
80 always_reboot = false;
81 no_logind = false;
82 logout_timeout_s = 180;
83 };
84 };
85 };
86 sessionVariables = rec {
87 NIXOS_OZONE_WL = "1";
88 };
89 variables = {
90 MOZ_USE_XINPUT2 = "1";
91 GDK_SCALE = "2";
92 GDK_DPI_SCALE = "0.5";
93 };
94 systemPackages = with pkgs; [
95 man-pages
96 git
97 man-pages-posix
98 (lib.hiPrio pkgs.bashInteractive_5)
99 ];
100 etc = {
101 "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
102 bluez_monitor.properties = {
103 ["bluez5.enable-sbc-xq"] = true,
104 ["bluez5.enable-msbc"] = true,
105 ["bluez5.enable-hw-volume"] = true,
106 ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
107 }
108 '';
109 };
110 };
111
112 documentation = {
113 dev.enable = true;
114 man.generateCaches = true;
115 };
116
117 users.motd = with config; ''
118 Host ${networking.hostName}
119 OS NixOS ${system.nixos.release} (${system.nixos.codeName})
120 Version ${system.nixos.version}
121 Kernel ${boot.kernelPackages.kernel.version}
122 '';
123
124 console = {
125 font = "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
126 keyMap = "us";
127 };
128
129 sound.enable = true;
130 hardware = {
131 opengl.driSupport = true;
132 bluetooth = {
133 enable = true;
134 powerOnBoot = true;
135 disabledPlugins = [ "sap" ];
136 };
137 nvidia.prime = {
138 offload.enable = true;
139 amdgpuBusId = "PCI:8:0:0";
140 nvidiaBusId = "PCI:1:0:0";
141 };
142 logitech.wireless = {
143 enable = true;
144 enableGraphical = true;
145 };
146 };
147
148 services = {
149 asusd = {
150 enable = true;
151 enableUserService = true;
152 };
153 supergfxd = {
154 enable = true;
155 };
156 pipewire = {
157 enable = true;
158 alsa.enable = true;
159 alsa.support32Bit = true;
160 pulse.enable = true;
161 };
162 xserver = {
163 enable = true;
164 layout = "us";
165 desktopManager.plasma5.enable = true;
166 displayManager.sddm = {
167 enable = true;
168 enableHidpi = true;
169 };
170 dpi = 192;
171 videoDrivers = [ "nvidia" ];
172 screenSection = ''
173 Option "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
174 Option "AllowIndirectGLXProtocol" "off"
175 Option "TripleBuffer" "on"
176 '';
177 libinput = {
178 enable = true;
179 mouse = {
180 scrollButton = 8;
181 scrollMethod = "button";
182 };
183 };
184 };
185 tailscale.enable = true;
186 auto-cpufreq.enable = true;
187 # 1. chmod for rootless backligh1t
188 # 2. lotus58 bootloader mode for rootless qmk flashing
189 udev = {
190 extraRules = ''
191 ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl1", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness"
192 ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1"
193 '';
194 extraHwdb = ''
195 evdev:input:b0003v0B05p19B6*
196 KEYBOARD_KEY_ff31007c=f20 # x11 mic-mute
197 '';
198 path = [
199 pkgs.coreutils
200 ];
201 };
202 logind.extraConfig = ''
203 HandlePowerKey=hibernate
204 '';
205 };
206
207 virtualisation.docker = {
208 enable = true;
209 logDriver = "json-file";
210 };
211
212 security = {
213 doas.enable = true;
214 sudo.enable = true;
215 doas.extraConfig = ''
216 permit nopass :wheel
217 '';
218 doas.extraRules = [{
219 users = [ "icy" ];
220 }];
221 pki.certificateFiles = [ "/home/icy/.local/share/caddy/pki/authorities/local/root.crt" ];
222 };
223
224 powerManagement = {
225 enable = true;
226 powertop.enable = true;
227 };
228
229 users.users.icy = {
230 isNormalUser = true;
231 extraGroups = [ "wheel" "docker" "audio" "video" "dialout" ];
232 };
233
234 programs = {
235 steam.enable = true;
236 gamemode.enable = true;
237 };
238
239 nix = {
240 package = pkgs.nixVersions.stable;
241 extraOptions = ''
242 experimental-features = nix-command flakes ca-derivations
243 warn-dirty = false
244 keep-outputs = false
245 '';
246 settings = {
247 trusted-users = [
248 "root"
249 "icy"
250 ];
251 };
252 };
253
254
255 # This value determines the NixOS release from which the default
256 # settings for stateful data, like file locations and database versions
257 # on your system were taken. It‘s perfectly fine and recommended to leave
258 # this value at the release version of the first install of this system.
259 # Before changing this value read the documentation for this option
260 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
261 system.stateVersion = "21.11"; # Did you read the comment?
262
263}
264