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