blob: b3979ffee5900c95d31d02bb93988c55163c9d7c [file] [log] [blame]
Skyler Grey2bad9692022-06-06 19:03:16 +01001{ pkgs, 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 = {
13 package = pkgs.nixFlakes;
14 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 Grey2ddb2462022-06-14 23:52:40 +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
255 # List packages installed in system profile. To search, run:
256 # $ nix search wget
257 environment.systemPackages = with pkgs; [
258 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 +0100259 ((emacsPackagesFor emacs).emacsWithPackages (epkgs: [
Skyler Grey4e10d632022-05-18 21:55:27 +0100260 epkgs.vterm
261 epkgs.emacsql-sqlite
262 ])) # Emacs + vterm-module (needed for vterm)
263 wget
264 firefox
265 chromium # Install chromium if needed
266 texlive.combined.scheme-full
267 keybase-gui
268 bluez
269 macchanger
270 comic-relief
271 qemu_kvm
272 polkit_gnome
273 gtk-engine-murrine
274 gtk_engines
275 gsettings-desktop-schemas
276 lxappearance
277 libsForQt5.qt5.qtwayland
278 texworks
279 wlogout
280 wob
281 wlsunset
Skyler Greyc9ba9bf2022-05-18 22:11:33 +0100282 cni-plugins
283 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100284
285# environment.systemPackages = [
286# import /scripts/jetbrains.rider.nix
287# ];
288
Skyler Grey5ac334e2022-06-01 00:18:23 +0100289 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 +0100290
Skyler Grey4e10d632022-05-18 21:55:27 +0100291
Skyler Greyc57308f2022-05-20 10:23:54 +0100292 fonts = {
293 fonts = with pkgs; [
294 nerdfonts
295 noto-fonts
296 noto-fonts-cjk
297 noto-fonts-emoji
298 liberation_ttf
299 fira-code
300 fira-code-symbols
Skyler Grey65f16822022-05-30 23:45:19 +0100301 mplus-outline-fonts.githubRelease
Skyler Greyc57308f2022-05-20 10:23:54 +0100302 dina-font
303 proggyfonts
304 roboto
305 roboto-mono
306 roboto-slab
307 twemoji-color-font
308 ubuntu_font_family
309 ];
310
311 enableDefaultFonts = true;
Skyler Grey63786912022-05-20 11:31:40 +0100312 fontDir.enable = true;
Skyler Greyc57308f2022-05-20 10:23:54 +0100313
314 fontconfig = {
315 defaultFonts = {
Skyler Grey63786912022-05-20 11:31:40 +0100316 serif = [ "Roboto Slab" ];
317 sansSerif = [ "Roboto" "Ubuntu" ];
318 monospace = [ "Roboto Mono" "Ubuntu Mono" ];
319 emoji = [ "Twitter Color Emoji" ];
Skyler Greyc57308f2022-05-20 10:23:54 +0100320 };
321 };
322 };
Skyler Grey4e10d632022-05-18 21:55:27 +0100323
324 # Some programs need SUID wrappers, can be configured further or are
325 # started in user sessions.
326 programs.mtr.enable = true;
327 programs.kdeconnect.enable = true;
328 programs.gnupg.agent = {
329 enable = true;
330 enableSSHSupport = true;
331 };
332
333 # List services that you want to enable:
334
335 # Enable the OpenSSH daemon.
336 services.openssh.enable = true;
337 services.keybase.enable = true;
338 services.kbfs.enable = true;
Skyler Grey4e10d632022-05-18 21:55:27 +0100339 services.gnome.gnome-keyring.enable = true;
340 services.i2p.enable = true;
341 services.tlp.enable = true;
342
343 virtualisation.docker.enable = true;
344 virtualisation.docker.enableOnBoot = false;
345 virtualisation.libvirtd.enable = true;
346 virtualisation.libvirtd.onBoot = "ignore";
347
348 hardware.bluetooth.enable = true;
349
350 environment.pathsToLink = [ "/share/zsh" "/libexec" ];
351
352 virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
353 virtualisation.kvmgt.enable = true;
354
355 services.openvpn.servers = {
Skyler Grey5ac334e2022-06-01 00:18:23 +0100356 clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; autoStart = false; };
Skyler Grey4e10d632022-05-18 21:55:27 +0100357 };
358
359 environment.etc = {
360 "pam.d/swaylock" = {
361 mode = "0644";
362 text = ''
363 auth include login
364 '';
365 };
366 };
367
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100368 nixpkgs.overlays = [
369 (self: super: {
370 steam = super.steam.override {
371 extraPkgs = pkgs: with pkgs; [
372 cups
373 ];
374 };
Skyler Grey33b23e32022-05-19 06:42:03 +0100375# polkit = super.polkit.overrideAttrs (oldAttrs: {
376# patches = oldAttrs.patches ++ [
377# (super.fetchpatch {
378# url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
379# sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
380# })];
381# });
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100382 })
Skyler Grey2bad9692022-06-06 19:03:16 +0100383 ] ++ map (f: import f) overlays ++ [
384 (self: (super: builtins.listToAttrs (
385 map (f: {
386 name = builtins.elemAt (builtins.match "^(.*/)*(.*)\\.nix$" (toString f)) 1;
387 value = super.lib.callPackageWith (self) (import f) {};
388 }) packages
389 )))
390 nurpkgs.overlay
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100391 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100392
393 xdg.mime.defaultApplications = {
394 "text/html" = "chromium-browser.desktop";
395 "x-scheme-handler/http" = "chromium-browser.desktop";
396 "x-scheme-handler/https" = "chromium-browser.desktop";
397 "x-scheme-handler/about" = "chromium-browser.desktop";
398 "x-scheme-handler/unknown" = "chromium-browser.desktop";
399 };
400
401 # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
402
403
404 boot.supportedFilesystems = [ "kbfs" ];
405
406 # This value determines the NixOS release from which the default
407 # settings for stateful data, like file locations and database versions
408 # on your system were taken. It‘s perfectly fine and recommended to leave
409 # this value at the release version of the first install of this system.
410 # Before changing this value read the documentation for this option
411 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
412 system.stateVersion = "21.11"; # Did you read the comment?
413
414 boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
415 boot.initrd.kernelModules = [ ];
416 boot.kernelModules = [ "kvm-intel" ];
417# boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; # Broken in nixpkgs; seems to be mountable and usable anyway
418
419 fileSystems."/" =
420 { device = "/dev/disk/by-label/nixos";
421 fsType = "ext4";
422 };
423
424 fileSystems."/boot" =
425 { device = "/dev/disk/by-label/boot";
426 fsType = "vfat";
427 };
428
429 swapDevices =
430 [ { device = "/dev/disk/by-label/swap"; }
431 ];
432
433 powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
434 hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
435
436# hardware.nvidia.modesetting.enable = true;
437# services.xserver.videoDrivers = [ "nvidia" ];
438
439# hardware.opentabletdriver.enable = true;
440
441 virtualisation.containerd.enable = true;
442
443 virtualisation.containerd.settings = {
444 version = 2;
445# grpc = {
446# uid = 1000;
447# };
448 };
449
450 networking.hostName = "python";
451
452 networking.wireless.iwd.enable = true;
453 networking.wireless.iwd.settings = {
454 Settings = {
455 AutoConnect = true;
456 AlwaysRandomizeAddress = true;
457 };
458 };
459}