blob: b31139dfc9ce52c2e62a8e607f204f48240b31bf [file] [log] [blame]
Skyler Grey4e10d632022-05-18 21:55:27 +01001{ pkgs, lib, modulesPath, config, ... }:
2let
Skyler Grey2577b192022-05-19 06:51:08 +01003 nixScripts = import ./utils/nixFilesIn.nix lib ./nix/system;
Skyler Greyed68b702022-05-27 23:00:07 +01004 nixApps = import ./utils/nixFilesIn.nix lib ./apps/system;
Skyler Grey4e10d632022-05-18 21:55:27 +01005in {
Skyler Greyed68b702022-05-27 23:00:07 +01006 imports = nixScripts ++ nixApps ++ [ (modulesPath + "/installer/scan/not-detected.nix") ];
Skyler Grey4e10d632022-05-18 21:55:27 +01007
8
9 # Prepare nix flakes
10 nix = {
11 package = pkgs.nixFlakes;
12 extraOptions = ''
13 experimental-features = nix-command flakes
Skyler Grey087b2f62022-05-23 17:32:12 +010014 auto-optimise-store = true
Skyler Grey4e10d632022-05-18 21:55:27 +010015 '';
16 };
17
18 # Use the systemd-boot EFI boot loader.
19 boot.loader.systemd-boot.enable = true;
20 boot.loader.efi.canTouchEfiVariables = true;
21 boot.loader.grub.useOSProber = true;
22
23 # Enable emulated systems
24 boot.binfmt.emulatedSystems = [ "aarch64-linux" "armv6l-linux" ];
25
26 boot.resumeDevice = "/dev/nvme0n1p5";
27
28 # Enable apparmor
29 security.apparmor.enable = true;
30 security.apparmor.killUnconfinedConfinables = true;
31
32 # Set your time zone.
33 time.timeZone = "Europe/London";
34
35 # Select internationalisation properties.
36 i18n.defaultLocale = "en_US.UTF-8";
37 console = {
38 font = "Lat2-Terminus16";
39 keyMap = "uk";
40 };
41
42 # Enable the X11 windowing system.
43 services.xserver = {
44 enable = true;
45 desktopManager = {
46 xterm.enable = false;
47 # xfce.enable = true;
48 };
49 displayManager.startx.enable = true;
50 # displayManager.sddm.enable = true;
51 };
52
53 services.zeronet.enable = true;
54
55 services = {
56 syncthing = {
57 enable = true;
58 user = "minion";
59 dataDir = "/home/minion/Documents"; # Default folder for new synced folders
60 configDir = "/home/minion/.config/syncthing"; # Folder for Syncthing's settings and keys
61 };
62 };
63
64 # And wayland
65/* programs.sway = {
66 enable = true;
67 wrapperFeatures.gtk = true; # so that gtk works properly
68 extraPackages = with pkgs; [
69 swaylock
70 swayidle
71 wl-clipboard
72 mako # notification daemon
73 alacritty # Alacritty is the default terminal in the config
74 ];
75 };*/
76
Skyler Greybf042332022-05-24 16:39:26 +010077 programs.light.enable = true; # Needs udev rules to properly work
78
Skyler Grey4e10d632022-05-18 21:55:27 +010079 programs.qt5ct = {
80 enable = true;
81 };
82# programs.waybar.enable = false; # true;
83
84 # Get screensharing to work
85 xdg = {
86 portal = {
87 enable = true;
88 extraPortals = with pkgs; [
Skyler Greyffc104a2022-05-24 08:47:15 +010089 xdg-desktop-portal-gtk
Skyler Greyd8c63b52022-05-24 15:23:41 +010090 xdg-desktop-portal-kde
Skyler Grey4e10d632022-05-18 21:55:27 +010091 ];
Skyler Greyffc104a2022-05-24 08:47:15 +010092 gtkUsePortal = true;
Skyler Greyd8c63b52022-05-24 15:23:41 +010093 wlr.enable = true;
Skyler Grey4e10d632022-05-18 21:55:27 +010094 };
95 };
96
97 systemd.user.services.xdg-desktop-portal = {
98 unitConfig = {
99 After = "graphical-session.target";
100 };
101 };
102
103 # Configure keymap in X11
104 services.xserver.layout = "gb";
105 # services.xserver.xkbOptions = "eurosign:e";
106 services.upower.enable = true;
107
108 # Permit and install steam
109 nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
110 "steam"
111 "steam-original"
112 "steam-runtime"
113 "mongodb"
114 "nvidia-x11"
115 "nvidia-settings"
116 ];
117
118 programs.steam.enable = true;
119
120
121 # Enable CUPS to print documents.
122 services.printing.enable = true;
123
124 # Enable sound.
125 sound.enable = true;
126 hardware.pulseaudio.enable = false;
127 services.pipewire = {
128 enable = true;
129 alsa = {
130 enable = true;
131 support32Bit = true;
132 };
133 pulse.enable = true;
134 /*config.pipewire = {
135 "context.modules" = [
136 {
137 name = "libpipewire-module-filter-chain";
138 args = {
139 "node.name" = "effect_output.virtual-surround-7.1-hesuvi";
140 "node.description" = "Virtual Surround Sink";
141 "media.name" = "Virtual Surround Sink";
142 nodes = [
143 # duplicate inputs
144 { type = "builtin"; label = "copy"; name = "copyFL"; }
145 { type = "builtin"; label = "copy"; name = "copyFR"; }
146 { type = "builtin"; label = "copy"; name = "copyFC"; }
147 { type = "builtin"; label = "copy"; name = "copyRL"; }
148 { type = "builtin"; label = "copy"; name = "copyRR"; }
149 { type = "builtin"; label = "copy"; name = "copySL"; }
150 { type = "builtin"; label = "copy"; name = "copySR"; }
151 { type = "builtin"; label = "copy"; name = "copyLFE"; }
152
153 # apply hrir - HeSuVi 14-channel WAV (not the *-.wav variants) (note: 44 in HeSuVi are the same, but resampled to 44100)
154 { type = "builtin"; label = "convolver"; name = "convFL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 0; }; }
155 { type = "builtin"; label = "convolver"; name = "convFL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 1; }; }
156 { type = "builtin"; label = "convolver"; name = "convSL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 2; }; }
157 { type = "builtin"; label = "convolver"; name = "convSL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 3; }; }
158 { type = "builtin"; label = "convolver"; name = "convRL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 4; }; }
159 { type = "builtin"; label = "convolver"; name = "convRL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 5; }; }
160 { type = "builtin"; label = "convolver"; name = "convFC_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
161 { type = "builtin"; label = "convolver"; name = "convFR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 7; }; }
162 { type = "builtin"; label = "convolver"; name = "convFR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 8; }; }
163 { type = "builtin"; label = "convolver"; name = "convSR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 9; }; }
164 { type = "builtin"; label = "convolver"; name = "convSR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 10; }; }
165 { type = "builtin"; label = "convolver"; name = "convRR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 11; }; }
166 { type = "builtin"; label = "convolver"; name = "convRR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 12; }; }
167 { type = "builtin"; label = "convolver"; name = "convFC_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
168
169 # treat LFE as FC
170 { type = "builtin"; label = "convolver"; name = "convLFE_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
171 { type = "builtin"; label = "convolver"; name = "convLFE_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
172
173 # stereo output
174 { type = "builtin"; label = "mixer"; name = "mixR"; }
175 { type = "builtin"; label = "mixer"; name = "mixL"; }
176 ];
177 links = [
178 # input
179 { output = "copyFL:Out"; input="convFL_L:In"; }
180 { output = "copyFL:Out"; input="convFL_R:In"; }
181 { output = "copySL:Out"; input="convSL_L:In"; }
182 { output = "copySL:Out"; input="convSL_R:In"; }
183 { output = "copyRL:Out"; input="convRL_L:In"; }
184 { output = "copyRL:Out"; input="convRL_R:In"; }
185 { output = "copyFC:Out"; input="convFC_L:In"; }
186 { output = "copyFR:Out"; input="convFR_R:In"; }
187 { output = "copyFR:Out"; input="convFR_L:In"; }
188 { output = "copySR:Out"; input="convSR_R:In"; }
189 { output = "copySR:Out"; input="convSR_L:In"; }
190 { output = "copyRR:Out"; input="convRR_R:In"; }
191 { output = "copyRR:Out"; input="convRR_L:In"; }
192 { output = "copyFC:Out"; input="convFC_R:In"; }
193 { output = "copyLFE:Out"; input="convLFE_L:In"; }
194 { output = "copyLFE:Out"; input="convLFE_R:In"; }
195
196 # output
197 { output = "convFL_L:Out"; input="mixL:In 1"; }
198 { output = "convFL_R:Out"; input="mixR:In 1"; }
199 { output = "convSL_L:Out"; input="mixL:In 2"; }
200 { output = "convSL_R:Out"; input="mixR:In 2"; }
201 { output = "convRL_L:Out"; input="mixL:In 3"; }
202 { output = "convRL_R:Out"; input="mixR:In 3"; }
203 { output = "convFC_L:Out"; input="mixL:In 4"; }
204 { output = "convFC_R:Out"; input="mixR:In 4"; }
205 { output = "convFR_R:Out"; input="mixR:In 5"; }
206 { output = "convFR_L:Out"; input="mixL:In 5"; }
207 { output = "convSR_R:Out"; input="mixR:In 6"; }
208 { output = "convSR_L:Out"; input="mixL:In 6"; }
209 { output = "convRR_R:Out"; input="mixR:In 7"; }
210 { output = "convRR_L:Out"; input="mixL:In 7"; }
211 { output = "convLFE_R:Out"; input="mixR:In 8"; }
212 { output = "convLFE_L:Out"; input="mixL:In 8"; }
213 ];
214 inputs = [ "copyFL:In" "copyFR:In" "copyFC:In" "copyLFE:In" "copyRL:In" "copyRR:In" "copySL:In" "copySR:In" ];
215 outputs = [ "mixL:Out" "mixR:Out" ];
216 };
217 "capture.props" = {
218 "media.class" = "Audio/Sink";
219 "audio.channels" = 8;
220 "audio.position" = [ "FL" "FR" "FC" "LFE" "RL" "RR" "SL" "SR" ];
221 };
222 "playback.props" = {
223 "node.passive" = true;
224 "audio.channels" = 2;
225 "audio.position" = [ "FL" "FR" ];
226 };
227 }
228 ];
229 };*/
230 };
231 environment.etc."pipewire/7.1-surround-sound.conf".source = ./pipewire/7.1-surround-sound.conf;
232
233 hardware.openrazer.enable = true;
234 hardware.openrazer.users = [ "minion" ];
235
236 hardware.steam-hardware.enable = true;
237
238 # Enable touchpad support (enabled default in most desktopManager).
239 services.xserver.libinput.enable = true;
240
241 programs.dconf.enable = true;
242
243 # Define a user account. Don't forget to set a password with ‘passwd’.
244 users.users.minion = {
245 isNormalUser = true;
Skyler Grey1ec54612022-05-22 07:14:17 +0100246 extraGroups = [ "wheel" "kvm" "docker" "containerd" "dialout" "libvirtd" "video" ]; # Enable ‘sudo’ for the user.
Skyler Grey4e10d632022-05-18 21:55:27 +0100247 shell = pkgs.zsh;
248 };
249
250 programs.zsh.enable = true;
251
252 # List packages installed in system profile. To search, run:
253 # $ nix search wget
254 environment.systemPackages = with pkgs; [
255 vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
256 ((emacsPackagesNgGen emacs).emacsWithPackages (epkgs: [
257 epkgs.vterm
258 epkgs.emacsql-sqlite
259 ])) # Emacs + vterm-module (needed for vterm)
260 wget
261 firefox
262 chromium # Install chromium if needed
263 texlive.combined.scheme-full
264 keybase-gui
265 bluez
266 macchanger
267 comic-relief
268 qemu_kvm
269 polkit_gnome
270 gtk-engine-murrine
271 gtk_engines
272 gsettings-desktop-schemas
273 lxappearance
274 libsForQt5.qt5.qtwayland
275 texworks
276 wlogout
277 wob
278 wlsunset
Skyler Greyc9ba9bf2022-05-18 22:11:33 +0100279 cni-plugins
280 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100281
282# environment.systemPackages = [
283# import /scripts/jetbrains.rider.nix
284# ];
285
Skyler Grey8dd715f2022-05-24 21:45:06 +0100286 nixpkgs.config.chromium.commandLineArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebUIDarkMode --force-dark-mode --enable-features=WebRTCPipeWireCapturer --enable-gpu";
287
Skyler Grey4e10d632022-05-18 21:55:27 +0100288 services.mongodb = {
289 package = pkgs.mongodb-4_2;
290 enable = true;
291 dbpath = "/tmp/mongodb";
292 };
293
Skyler Greyc57308f2022-05-20 10:23:54 +0100294 fonts = {
295 fonts = with pkgs; [
296 nerdfonts
297 noto-fonts
298 noto-fonts-cjk
299 noto-fonts-emoji
300 liberation_ttf
301 fira-code
302 fira-code-symbols
303 mplus-outline-fonts
304 dina-font
305 proggyfonts
306 roboto
307 roboto-mono
308 roboto-slab
309 twemoji-color-font
310 ubuntu_font_family
311 ];
312
313 enableDefaultFonts = true;
Skyler Grey63786912022-05-20 11:31:40 +0100314 fontDir.enable = true;
Skyler Greyc57308f2022-05-20 10:23:54 +0100315
316 fontconfig = {
317 defaultFonts = {
Skyler Grey63786912022-05-20 11:31:40 +0100318 serif = [ "Roboto Slab" ];
319 sansSerif = [ "Roboto" "Ubuntu" ];
320 monospace = [ "Roboto Mono" "Ubuntu Mono" ];
321 emoji = [ "Twitter Color Emoji" ];
Skyler Greyc57308f2022-05-20 10:23:54 +0100322 };
323 };
324 };
Skyler Grey4e10d632022-05-18 21:55:27 +0100325
326 # Some programs need SUID wrappers, can be configured further or are
327 # started in user sessions.
328 programs.mtr.enable = true;
329 programs.kdeconnect.enable = true;
330 programs.gnupg.agent = {
331 enable = true;
332 enableSSHSupport = true;
333 };
334
335 # List services that you want to enable:
336
337 # Enable the OpenSSH daemon.
338 services.openssh.enable = true;
339 services.keybase.enable = true;
340 services.kbfs.enable = true;
341 services.kbfs.enableRedirector = true;
342 security.wrappers.keybase-redirector.owner = "root";
343 security.wrappers.keybase-redirector.group = "users";
344 services.gnome.gnome-keyring.enable = true;
345 services.i2p.enable = true;
346 services.tlp.enable = true;
347
348 virtualisation.docker.enable = true;
349 virtualisation.docker.enableOnBoot = false;
350 virtualisation.libvirtd.enable = true;
351 virtualisation.libvirtd.onBoot = "ignore";
352
353 hardware.bluetooth.enable = true;
354
355 environment.pathsToLink = [ "/share/zsh" "/libexec" ];
356
357 virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
358 virtualisation.kvmgt.enable = true;
359
360 services.openvpn.servers = {
361 clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; };
362 };
363
364 environment.etc = {
365 "pam.d/swaylock" = {
366 mode = "0644";
367 text = ''
368 auth include login
369 '';
370 };
371 };
372
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100373 nixpkgs.overlays = [
374 (self: super: {
375 steam = super.steam.override {
376 extraPkgs = pkgs: with pkgs; [
377 cups
378 ];
379 };
Skyler Grey33b23e32022-05-19 06:42:03 +0100380# polkit = super.polkit.overrideAttrs (oldAttrs: {
381# patches = oldAttrs.patches ++ [
382# (super.fetchpatch {
383# url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
384# sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
385# })];
386# });
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100387 })
388 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100389
390 xdg.mime.defaultApplications = {
391 "text/html" = "chromium-browser.desktop";
392 "x-scheme-handler/http" = "chromium-browser.desktop";
393 "x-scheme-handler/https" = "chromium-browser.desktop";
394 "x-scheme-handler/about" = "chromium-browser.desktop";
395 "x-scheme-handler/unknown" = "chromium-browser.desktop";
396 };
397
398 # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
399
400
401 boot.supportedFilesystems = [ "kbfs" ];
402
403 # This value determines the NixOS release from which the default
404 # settings for stateful data, like file locations and database versions
405 # on your system were taken. It‘s perfectly fine and recommended to leave
406 # this value at the release version of the first install of this system.
407 # Before changing this value read the documentation for this option
408 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
409 system.stateVersion = "21.11"; # Did you read the comment?
410
411 boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
412 boot.initrd.kernelModules = [ ];
413 boot.kernelModules = [ "kvm-intel" ];
414# boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; # Broken in nixpkgs; seems to be mountable and usable anyway
415
416 fileSystems."/" =
417 { device = "/dev/disk/by-label/nixos";
418 fsType = "ext4";
419 };
420
421 fileSystems."/boot" =
422 { device = "/dev/disk/by-label/boot";
423 fsType = "vfat";
424 };
425
426 swapDevices =
427 [ { device = "/dev/disk/by-label/swap"; }
428 ];
429
430 powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
431 hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
432
433# hardware.nvidia.modesetting.enable = true;
434# services.xserver.videoDrivers = [ "nvidia" ];
435
436# hardware.opentabletdriver.enable = true;
437
438 virtualisation.containerd.enable = true;
439
440 virtualisation.containerd.settings = {
441 version = 2;
442# grpc = {
443# uid = 1000;
444# };
445 };
446
447 networking.hostName = "python";
448
449 networking.wireless.iwd.enable = true;
450 networking.wireless.iwd.settings = {
451 Settings = {
452 AutoConnect = true;
453 AlwaysRandomizeAddress = true;
454 };
455 };
456}