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