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