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