blob: cec4f2053ca822182b05c32ce975f4fc1bdd8e22 [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
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
282 polkit_gnome
283 gtk-engine-murrine
284 gtk_engines
285 gsettings-desktop-schemas
286 lxappearance
287 libsForQt5.qt5.qtwayland
288 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
317 twemoji-color-font
318 ubuntu_font_family
319 ];
320
321 enableDefaultFonts = true;
Skyler Grey63786912022-05-20 11:31:40 +0100322 fontDir.enable = true;
Skyler Greyc57308f2022-05-20 10:23:54 +0100323
324 fontconfig = {
325 defaultFonts = {
Skyler Grey63786912022-05-20 11:31:40 +0100326 serif = [ "Roboto Slab" ];
327 sansSerif = [ "Roboto" "Ubuntu" ];
328 monospace = [ "Roboto Mono" "Ubuntu Mono" ];
329 emoji = [ "Twitter Color Emoji" ];
Skyler Greyc57308f2022-05-20 10:23:54 +0100330 };
331 };
332 };
Skyler Grey4e10d632022-05-18 21:55:27 +0100333
334 # Some programs need SUID wrappers, can be configured further or are
335 # started in user sessions.
336 programs.mtr.enable = true;
337 programs.kdeconnect.enable = true;
338 programs.gnupg.agent = {
339 enable = true;
340 enableSSHSupport = true;
341 };
342
343 # List services that you want to enable:
344
345 # Enable the OpenSSH daemon.
346 services.openssh.enable = true;
347 services.keybase.enable = true;
348 services.kbfs.enable = true;
Skyler Grey4e10d632022-05-18 21:55:27 +0100349 services.gnome.gnome-keyring.enable = true;
350 services.i2p.enable = true;
351 services.tlp.enable = true;
352
353 virtualisation.docker.enable = true;
354 virtualisation.docker.enableOnBoot = false;
355 virtualisation.libvirtd.enable = true;
356 virtualisation.libvirtd.onBoot = "ignore";
357
358 hardware.bluetooth.enable = true;
359
360 environment.pathsToLink = [ "/share/zsh" "/libexec" ];
361
362 virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
363 virtualisation.kvmgt.enable = true;
364
365 services.openvpn.servers = {
Skyler Grey5ac334e2022-06-01 00:18:23 +0100366 clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; autoStart = false; };
Skyler Grey4e10d632022-05-18 21:55:27 +0100367 };
368
369 environment.etc = {
370 "pam.d/swaylock" = {
371 mode = "0644";
372 text = ''
373 auth include login
374 '';
375 };
376 };
377
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100378 nixpkgs.overlays = [
379 (self: super: {
380 steam = super.steam.override {
381 extraPkgs = pkgs: with pkgs; [
382 cups
383 ];
384 };
Skyler Grey33b23e32022-05-19 06:42:03 +0100385# polkit = super.polkit.overrideAttrs (oldAttrs: {
386# patches = oldAttrs.patches ++ [
387# (super.fetchpatch {
388# url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
389# sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
390# })];
391# });
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100392 })
Skyler Grey2bad9692022-06-06 19:03:16 +0100393 ] ++ map (f: import f) overlays ++ [
394 (self: (super: builtins.listToAttrs (
395 map (f: {
396 name = builtins.elemAt (builtins.match "^(.*/)*(.*)\\.nix$" (toString f)) 1;
397 value = super.lib.callPackageWith (self) (import f) {};
398 }) packages
399 )))
400 nurpkgs.overlay
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100401 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100402
403 xdg.mime.defaultApplications = {
404 "text/html" = "chromium-browser.desktop";
405 "x-scheme-handler/http" = "chromium-browser.desktop";
406 "x-scheme-handler/https" = "chromium-browser.desktop";
407 "x-scheme-handler/about" = "chromium-browser.desktop";
408 "x-scheme-handler/unknown" = "chromium-browser.desktop";
409 };
410
411 # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
412
413
414 boot.supportedFilesystems = [ "kbfs" ];
415
416 # This value determines the NixOS release from which the default
417 # settings for stateful data, like file locations and database versions
418 # on your system were taken. It‘s perfectly fine and recommended to leave
419 # this value at the release version of the first install of this system.
420 # Before changing this value read the documentation for this option
421 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
422 system.stateVersion = "21.11"; # Did you read the comment?
423
424 boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
425 boot.initrd.kernelModules = [ ];
426 boot.kernelModules = [ "kvm-intel" ];
427# boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; # Broken in nixpkgs; seems to be mountable and usable anyway
428
429 fileSystems."/" =
430 { device = "/dev/disk/by-label/nixos";
431 fsType = "ext4";
432 };
433
434 fileSystems."/boot" =
435 { device = "/dev/disk/by-label/boot";
436 fsType = "vfat";
437 };
438
439 swapDevices =
440 [ { device = "/dev/disk/by-label/swap"; }
441 ];
442
443 powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
444 hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
445
446# hardware.nvidia.modesetting.enable = true;
447# services.xserver.videoDrivers = [ "nvidia" ];
448
449# hardware.opentabletdriver.enable = true;
450
451 virtualisation.containerd.enable = true;
452
453 virtualisation.containerd.settings = {
454 version = 2;
455# grpc = {
456# uid = 1000;
457# };
458 };
459
460 networking.hostName = "python";
461
462 networking.wireless.iwd.enable = true;
463 networking.wireless.iwd.settings = {
464 Settings = {
465 AutoConnect = true;
466 AlwaysRandomizeAddress = true;
467 };
468 };
469}