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