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