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