blob: 9bc3833af722f4ea17064f1beb397a1581188efc [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 ];
111 gtkUsePortal = true;
Skyler Grey30817a72022-07-21 00:36:23 +0100112 wlr.enable = true;
Skyler Grey4e10d632022-05-18 21:55:27 +0100113 };
114 };
115
116 systemd.user.services.xdg-desktop-portal = {
117 unitConfig = {
118 After = "graphical-session.target";
119 };
120 };
121
122 # Configure keymap in X11
123 services.xserver.layout = "gb";
124 # services.xserver.xkbOptions = "eurosign:e";
125 services.upower.enable = true;
126
127 # Permit and install steam
128 nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
129 "steam"
130 "steam-original"
131 "steam-runtime"
132 "mongodb"
133 "nvidia-x11"
134 "nvidia-settings"
135 ];
136
137 programs.steam.enable = true;
138
139
140 # Enable CUPS to print documents.
141 services.printing.enable = true;
142
143 # Enable sound.
144 sound.enable = true;
145 hardware.pulseaudio.enable = false;
146 services.pipewire = {
147 enable = true;
148 alsa = {
149 enable = true;
150 support32Bit = true;
151 };
152 pulse.enable = true;
153 /*config.pipewire = {
154 "context.modules" = [
155 {
156 name = "libpipewire-module-filter-chain";
157 args = {
158 "node.name" = "effect_output.virtual-surround-7.1-hesuvi";
159 "node.description" = "Virtual Surround Sink";
160 "media.name" = "Virtual Surround Sink";
161 nodes = [
162 # duplicate inputs
163 { type = "builtin"; label = "copy"; name = "copyFL"; }
164 { type = "builtin"; label = "copy"; name = "copyFR"; }
165 { type = "builtin"; label = "copy"; name = "copyFC"; }
166 { type = "builtin"; label = "copy"; name = "copyRL"; }
167 { type = "builtin"; label = "copy"; name = "copyRR"; }
168 { type = "builtin"; label = "copy"; name = "copySL"; }
169 { type = "builtin"; label = "copy"; name = "copySR"; }
170 { type = "builtin"; label = "copy"; name = "copyLFE"; }
171
172 # apply hrir - HeSuVi 14-channel WAV (not the *-.wav variants) (note: 44 in HeSuVi are the same, but resampled to 44100)
173 { type = "builtin"; label = "convolver"; name = "convFL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 0; }; }
174 { type = "builtin"; label = "convolver"; name = "convFL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 1; }; }
175 { type = "builtin"; label = "convolver"; name = "convSL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 2; }; }
176 { type = "builtin"; label = "convolver"; name = "convSL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 3; }; }
177 { type = "builtin"; label = "convolver"; name = "convRL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 4; }; }
178 { type = "builtin"; label = "convolver"; name = "convRL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 5; }; }
179 { type = "builtin"; label = "convolver"; name = "convFC_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
180 { type = "builtin"; label = "convolver"; name = "convFR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 7; }; }
181 { type = "builtin"; label = "convolver"; name = "convFR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 8; }; }
182 { type = "builtin"; label = "convolver"; name = "convSR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 9; }; }
183 { type = "builtin"; label = "convolver"; name = "convSR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 10; }; }
184 { type = "builtin"; label = "convolver"; name = "convRR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 11; }; }
185 { type = "builtin"; label = "convolver"; name = "convRR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 12; }; }
186 { type = "builtin"; label = "convolver"; name = "convFC_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
187
188 # treat LFE as FC
189 { type = "builtin"; label = "convolver"; name = "convLFE_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
190 { type = "builtin"; label = "convolver"; name = "convLFE_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
191
192 # stereo output
193 { type = "builtin"; label = "mixer"; name = "mixR"; }
194 { type = "builtin"; label = "mixer"; name = "mixL"; }
195 ];
196 links = [
197 # input
198 { output = "copyFL:Out"; input="convFL_L:In"; }
199 { output = "copyFL:Out"; input="convFL_R:In"; }
200 { output = "copySL:Out"; input="convSL_L:In"; }
201 { output = "copySL:Out"; input="convSL_R:In"; }
202 { output = "copyRL:Out"; input="convRL_L:In"; }
203 { output = "copyRL:Out"; input="convRL_R:In"; }
204 { output = "copyFC:Out"; input="convFC_L:In"; }
205 { output = "copyFR:Out"; input="convFR_R:In"; }
206 { output = "copyFR:Out"; input="convFR_L:In"; }
207 { output = "copySR:Out"; input="convSR_R:In"; }
208 { output = "copySR:Out"; input="convSR_L:In"; }
209 { output = "copyRR:Out"; input="convRR_R:In"; }
210 { output = "copyRR:Out"; input="convRR_L:In"; }
211 { output = "copyFC:Out"; input="convFC_R:In"; }
212 { output = "copyLFE:Out"; input="convLFE_L:In"; }
213 { output = "copyLFE:Out"; input="convLFE_R:In"; }
214
215 # output
216 { output = "convFL_L:Out"; input="mixL:In 1"; }
217 { output = "convFL_R:Out"; input="mixR:In 1"; }
218 { output = "convSL_L:Out"; input="mixL:In 2"; }
219 { output = "convSL_R:Out"; input="mixR:In 2"; }
220 { output = "convRL_L:Out"; input="mixL:In 3"; }
221 { output = "convRL_R:Out"; input="mixR:In 3"; }
222 { output = "convFC_L:Out"; input="mixL:In 4"; }
223 { output = "convFC_R:Out"; input="mixR:In 4"; }
224 { output = "convFR_R:Out"; input="mixR:In 5"; }
225 { output = "convFR_L:Out"; input="mixL:In 5"; }
226 { output = "convSR_R:Out"; input="mixR:In 6"; }
227 { output = "convSR_L:Out"; input="mixL:In 6"; }
228 { output = "convRR_R:Out"; input="mixR:In 7"; }
229 { output = "convRR_L:Out"; input="mixL:In 7"; }
230 { output = "convLFE_R:Out"; input="mixR:In 8"; }
231 { output = "convLFE_L:Out"; input="mixL:In 8"; }
232 ];
233 inputs = [ "copyFL:In" "copyFR:In" "copyFC:In" "copyLFE:In" "copyRL:In" "copyRR:In" "copySL:In" "copySR:In" ];
234 outputs = [ "mixL:Out" "mixR:Out" ];
235 };
236 "capture.props" = {
237 "media.class" = "Audio/Sink";
238 "audio.channels" = 8;
239 "audio.position" = [ "FL" "FR" "FC" "LFE" "RL" "RR" "SL" "SR" ];
240 };
241 "playback.props" = {
242 "node.passive" = true;
243 "audio.channels" = 2;
244 "audio.position" = [ "FL" "FR" ];
245 };
246 }
247 ];
248 };*/
249 };
250 environment.etc."pipewire/7.1-surround-sound.conf".source = ./pipewire/7.1-surround-sound.conf;
251
252 hardware.openrazer.enable = true;
253 hardware.openrazer.users = [ "minion" ];
254
255 hardware.steam-hardware.enable = true;
256
257 # Enable touchpad support (enabled default in most desktopManager).
258 services.xserver.libinput.enable = true;
259
260 programs.dconf.enable = true;
261
262 # Define a user account. Don't forget to set a password with ‘passwd’.
263 users.users.minion = {
264 isNormalUser = true;
Skyler Grey1ec54612022-05-22 07:14:17 +0100265 extraGroups = [ "wheel" "kvm" "docker" "containerd" "dialout" "libvirtd" "video" ]; # Enable ‘sudo’ for the user.
Skyler Grey4e10d632022-05-18 21:55:27 +0100266 shell = pkgs.zsh;
267 };
268
269 programs.zsh.enable = true;
270
Skyler Greye9049062022-06-15 12:51:57 +0100271 environment.variables = {
272 EDITOR = "${pkgs.vim}/bin/vim";
273 };
274 environment.defaultPackages = [
275 pkgs.perl
276 pkgs.rsync
277 pkgs.strace
278 pkgs.vim # I'm installing vim here even though it isn't normally a default package, as I've removed nano
279 ]; # The basic default packages, although without nano
280
Skyler Grey4e10d632022-05-18 21:55:27 +0100281 # List packages installed in system profile. To search, run:
282 # $ nix search wget
283 environment.systemPackages = with pkgs; [
284 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 +0100285 ((emacsPackagesFor emacs).emacsWithPackages (epkgs: [
Skyler Grey4e10d632022-05-18 21:55:27 +0100286 epkgs.vterm
287 epkgs.emacsql-sqlite
288 ])) # Emacs + vterm-module (needed for vterm)
289 wget
290 firefox
291 chromium # Install chromium if needed
292 texlive.combined.scheme-full
293 keybase-gui
294 bluez
295 macchanger
296 comic-relief
297 qemu_kvm
Skyler Grey4e10d632022-05-18 21:55:27 +0100298 gtk-engine-murrine
299 gtk_engines
300 gsettings-desktop-schemas
301 lxappearance
302 libsForQt5.qt5.qtwayland
Skyler Grey14247902022-07-16 23:11:45 +0100303 qt6.qtwayland
Skyler Grey4e10d632022-05-18 21:55:27 +0100304 texworks
305 wlogout
306 wob
307 wlsunset
Skyler Greyc9ba9bf2022-05-18 22:11:33 +0100308 cni-plugins
Skyler Grey312589f2022-07-25 11:23:03 +0100309 ccache
Skyler Greyc9ba9bf2022-05-18 22:11:33 +0100310 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100311
312# environment.systemPackages = [
313# import /scripts/jetbrains.rider.nix
314# ];
315
Skyler Grey5ac334e2022-06-01 00:18:23 +0100316 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 +0100317
Skyler Grey4e10d632022-05-18 21:55:27 +0100318
Skyler Greyc57308f2022-05-20 10:23:54 +0100319 fonts = {
320 fonts = with pkgs; [
321 nerdfonts
322 noto-fonts
323 noto-fonts-cjk
324 noto-fonts-emoji
325 liberation_ttf
326 fira-code
327 fira-code-symbols
Skyler Grey65f16822022-05-30 23:45:19 +0100328 mplus-outline-fonts.githubRelease
Skyler Greyc57308f2022-05-20 10:23:54 +0100329 dina-font
330 proggyfonts
331 roboto
332 roboto-mono
333 roboto-slab
Skyler Grey6280a022022-07-05 07:02:39 +0100334 twitter-color-emoji
Skyler Greyc57308f2022-05-20 10:23:54 +0100335 twemoji-color-font
336 ubuntu_font_family
337 ];
338
339 enableDefaultFonts = true;
Skyler Grey63786912022-05-20 11:31:40 +0100340 fontDir.enable = true;
Skyler Greyc57308f2022-05-20 10:23:54 +0100341
342 fontconfig = {
343 defaultFonts = {
Skyler Grey63786912022-05-20 11:31:40 +0100344 serif = [ "Roboto Slab" ];
345 sansSerif = [ "Roboto" "Ubuntu" ];
346 monospace = [ "Roboto Mono" "Ubuntu Mono" ];
347 emoji = [ "Twitter Color Emoji" ];
Skyler Greyc57308f2022-05-20 10:23:54 +0100348 };
349 };
350 };
Skyler Grey4e10d632022-05-18 21:55:27 +0100351
352 # Some programs need SUID wrappers, can be configured further or are
353 # started in user sessions.
354 programs.mtr.enable = true;
355 programs.kdeconnect.enable = true;
356 programs.gnupg.agent = {
357 enable = true;
358 enableSSHSupport = true;
359 };
360
361 # List services that you want to enable:
362
363 # Enable the OpenSSH daemon.
364 services.openssh.enable = true;
365 services.keybase.enable = true;
366 services.kbfs.enable = true;
Skyler Grey4e10d632022-05-18 21:55:27 +0100367 services.gnome.gnome-keyring.enable = true;
368 services.i2p.enable = true;
369 services.tlp.enable = true;
370
371 virtualisation.docker.enable = true;
372 virtualisation.docker.enableOnBoot = false;
373 virtualisation.libvirtd.enable = true;
374 virtualisation.libvirtd.onBoot = "ignore";
375
376 hardware.bluetooth.enable = true;
377
378 environment.pathsToLink = [ "/share/zsh" "/libexec" ];
379
380 virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
381 virtualisation.kvmgt.enable = true;
382
383 services.openvpn.servers = {
Skyler Grey5ac334e2022-06-01 00:18:23 +0100384 clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; autoStart = false; };
Skyler Grey4e10d632022-05-18 21:55:27 +0100385 };
386
387 environment.etc = {
388 "pam.d/swaylock" = {
389 mode = "0644";
390 text = ''
391 auth include login
392 '';
393 };
394 };
395
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100396 nixpkgs.overlays = [
397 (self: super: {
398 steam = super.steam.override {
399 extraPkgs = pkgs: with pkgs; [
400 cups
Skyler Grey88959be2022-07-16 23:13:19 +0100401 libxml2
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100402 ];
403 };
Skyler Grey33b23e32022-05-19 06:42:03 +0100404# polkit = super.polkit.overrideAttrs (oldAttrs: {
405# patches = oldAttrs.patches ++ [
406# (super.fetchpatch {
407# url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
408# sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
409# })];
410# });
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100411 })
Skyler Grey2bad9692022-06-06 19:03:16 +0100412 ] ++ map (f: import f) overlays ++ [
413 (self: (super: builtins.listToAttrs (
414 map (f: {
415 name = builtins.elemAt (builtins.match "^(.*/)*(.*)\\.nix$" (toString f)) 1;
416 value = super.lib.callPackageWith (self) (import f) {};
417 }) packages
418 )))
419 nurpkgs.overlay
Skyler Greyd88fc1e2022-05-20 21:06:16 +0100420 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100421
422 xdg.mime.defaultApplications = {
423 "text/html" = "chromium-browser.desktop";
424 "x-scheme-handler/http" = "chromium-browser.desktop";
425 "x-scheme-handler/https" = "chromium-browser.desktop";
426 "x-scheme-handler/about" = "chromium-browser.desktop";
427 "x-scheme-handler/unknown" = "chromium-browser.desktop";
428 };
429
430 # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
431
432
433 boot.supportedFilesystems = [ "kbfs" ];
434
435 # This value determines the NixOS release from which the default
436 # settings for stateful data, like file locations and database versions
437 # on your system were taken. It‘s perfectly fine and recommended to leave
438 # this value at the release version of the first install of this system.
439 # Before changing this value read the documentation for this option
440 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
441 system.stateVersion = "21.11"; # Did you read the comment?
442
443 boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
444 boot.initrd.kernelModules = [ ];
445 boot.kernelModules = [ "kvm-intel" ];
446# boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; # Broken in nixpkgs; seems to be mountable and usable anyway
447
448 fileSystems."/" =
449 { device = "/dev/disk/by-label/nixos";
450 fsType = "ext4";
451 };
452
453 fileSystems."/boot" =
454 { device = "/dev/disk/by-label/boot";
455 fsType = "vfat";
456 };
457
458 swapDevices =
459 [ { device = "/dev/disk/by-label/swap"; }
460 ];
461
462 powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
463 hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
464
465# hardware.nvidia.modesetting.enable = true;
466# services.xserver.videoDrivers = [ "nvidia" ];
467
468# hardware.opentabletdriver.enable = true;
469
470 virtualisation.containerd.enable = true;
471
472 virtualisation.containerd.settings = {
473 version = 2;
474# grpc = {
475# uid = 1000;
476# };
477 };
478
479 networking.hostName = "python";
480
481 networking.wireless.iwd.enable = true;
482 networking.wireless.iwd.settings = {
483 Settings = {
484 AutoConnect = true;
485 AlwaysRandomizeAddress = true;
486 };
487 };
Skyler Greye9fbc9e2022-07-29 09:35:14 +0100488 networking.search = [
489 "python.local"
490 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100491}