blob: 8f2ede53f8e9c4264035f82b9d2cf36aaab81b74 [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
285 services.mongodb = {
286 package = pkgs.mongodb-4_2;
287 enable = true;
288 dbpath = "/tmp/mongodb";
289 };
290
Skyler Greyc57308f2022-05-20 10:23:54 +0100291 fonts = {
292 fonts = with pkgs; [
293 nerdfonts
294 noto-fonts
295 noto-fonts-cjk
296 noto-fonts-emoji
297 liberation_ttf
298 fira-code
299 fira-code-symbols
300 mplus-outline-fonts
301 dina-font
302 proggyfonts
303 roboto
304 roboto-mono
305 roboto-slab
306 twemoji-color-font
307 ubuntu_font_family
308 ];
309
310 enableDefaultFonts = true;
Skyler Grey63786912022-05-20 11:31:40 +0100311 fontDir.enable = true;
Skyler Greyc57308f2022-05-20 10:23:54 +0100312
313 fontconfig = {
314 defaultFonts = {
Skyler Grey63786912022-05-20 11:31:40 +0100315 serif = [ "Roboto Slab" ];
316 sansSerif = [ "Roboto" "Ubuntu" ];
317 monospace = [ "Roboto Mono" "Ubuntu Mono" ];
318 emoji = [ "Twitter Color Emoji" ];
Skyler Greyc57308f2022-05-20 10:23:54 +0100319 };
320 };
321 };
Skyler Grey4e10d632022-05-18 21:55:27 +0100322
323 # Some programs need SUID wrappers, can be configured further or are
324 # started in user sessions.
325 programs.mtr.enable = true;
326 programs.kdeconnect.enable = true;
327 programs.gnupg.agent = {
328 enable = true;
329 enableSSHSupport = true;
330 };
331
332 # List services that you want to enable:
333
334 # Enable the OpenSSH daemon.
335 services.openssh.enable = true;
336 services.keybase.enable = true;
337 services.kbfs.enable = true;
338 services.kbfs.enableRedirector = true;
339 security.wrappers.keybase-redirector.owner = "root";
340 security.wrappers.keybase-redirector.group = "users";
341 services.gnome.gnome-keyring.enable = true;
342 services.i2p.enable = true;
343 services.tlp.enable = true;
344
345 virtualisation.docker.enable = true;
346 virtualisation.docker.enableOnBoot = false;
347 virtualisation.libvirtd.enable = true;
348 virtualisation.libvirtd.onBoot = "ignore";
349
350 hardware.bluetooth.enable = true;
351
352 environment.pathsToLink = [ "/share/zsh" "/libexec" ];
353
354 virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
355 virtualisation.kvmgt.enable = true;
356
357 services.openvpn.servers = {
358 clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; };
359 };
360
361 environment.etc = {
362 "pam.d/swaylock" = {
363 mode = "0644";
364 text = ''
365 auth include login
366 '';
367 };
368 };
369
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100370 nixpkgs.overlays = [
371 (self: super: {
372 steam = super.steam.override {
373 extraPkgs = pkgs: with pkgs; [
374 cups
375 ];
376 };
Skyler Grey33b23e32022-05-19 06:42:03 +0100377# polkit = super.polkit.overrideAttrs (oldAttrs: {
378# patches = oldAttrs.patches ++ [
379# (super.fetchpatch {
380# url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
381# sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
382# })];
383# });
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100384 })
385 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100386
387 xdg.mime.defaultApplications = {
388 "text/html" = "chromium-browser.desktop";
389 "x-scheme-handler/http" = "chromium-browser.desktop";
390 "x-scheme-handler/https" = "chromium-browser.desktop";
391 "x-scheme-handler/about" = "chromium-browser.desktop";
392 "x-scheme-handler/unknown" = "chromium-browser.desktop";
393 };
394
395 # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
396
397
398 boot.supportedFilesystems = [ "kbfs" ];
399
400 # This value determines the NixOS release from which the default
401 # settings for stateful data, like file locations and database versions
402 # on your system were taken. It‘s perfectly fine and recommended to leave
403 # this value at the release version of the first install of this system.
404 # Before changing this value read the documentation for this option
405 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
406 system.stateVersion = "21.11"; # Did you read the comment?
407
408 boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
409 boot.initrd.kernelModules = [ ];
410 boot.kernelModules = [ "kvm-intel" ];
411# boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; # Broken in nixpkgs; seems to be mountable and usable anyway
412
413 fileSystems."/" =
414 { device = "/dev/disk/by-label/nixos";
415 fsType = "ext4";
416 };
417
418 fileSystems."/boot" =
419 { device = "/dev/disk/by-label/boot";
420 fsType = "vfat";
421 };
422
423 swapDevices =
424 [ { device = "/dev/disk/by-label/swap"; }
425 ];
426
427 powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
428 hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
429
430# hardware.nvidia.modesetting.enable = true;
431# services.xserver.videoDrivers = [ "nvidia" ];
432
433# hardware.opentabletdriver.enable = true;
434
435 virtualisation.containerd.enable = true;
436
437 virtualisation.containerd.settings = {
438 version = 2;
439# grpc = {
440# uid = 1000;
441# };
442 };
443
444 networking.hostName = "python";
445
446 networking.wireless.iwd.enable = true;
447 networking.wireless.iwd.settings = {
448 Settings = {
449 AutoConnect = true;
450 AlwaysRandomizeAddress = true;
451 };
452 };
453}