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