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