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