blob: 7d3c999bb67fc353bee29153818824399b118957 [file] [log] [blame]
Skyler Grey4e10d632022-05-18 21:55:27 +01001{ pkgs, lib, modulesPath, config, ... }:
2let
Skyler Grey33b23e32022-05-19 06:42:03 +01003 #nixScripts = import ./utils/nixFilesIn.nix lib ./nix/system;
Skyler Grey4e10d632022-05-18 21:55:27 +01004in {
Skyler Grey33b23e32022-05-19 06:42:03 +01005 #imports = nixScripts ++ [ (modulesPath + "/installer/scan/not-detected.nix") ];
Skyler Grey4e10d632022-05-18 21:55:27 +01006
7
8 # Prepare nix flakes
9 nix = {
10 package = pkgs.nixFlakes;
11 extraOptions = ''
12 experimental-features = nix-command flakes
13 '';
14 };
15
16 # Use the systemd-boot EFI boot loader.
17 boot.loader.systemd-boot.enable = true;
18 boot.loader.efi.canTouchEfiVariables = true;
19 boot.loader.grub.useOSProber = true;
20
21 # Enable emulated systems
22 boot.binfmt.emulatedSystems = [ "aarch64-linux" "armv6l-linux" ];
23
24 boot.resumeDevice = "/dev/nvme0n1p5";
25
26 # Enable apparmor
27 security.apparmor.enable = true;
28 security.apparmor.killUnconfinedConfinables = true;
29
30 # Set your time zone.
31 time.timeZone = "Europe/London";
32
33 # Select internationalisation properties.
34 i18n.defaultLocale = "en_US.UTF-8";
35 console = {
36 font = "Lat2-Terminus16";
37 keyMap = "uk";
38 };
39
40 # Enable the X11 windowing system.
41 services.xserver = {
42 enable = true;
43 desktopManager = {
44 xterm.enable = false;
45 # xfce.enable = true;
46 };
47 displayManager.startx.enable = true;
48 # displayManager.sddm.enable = true;
49 };
50
51 services.zeronet.enable = true;
52
53 services = {
54 syncthing = {
55 enable = true;
56 user = "minion";
57 dataDir = "/home/minion/Documents"; # Default folder for new synced folders
58 configDir = "/home/minion/.config/syncthing"; # Folder for Syncthing's settings and keys
59 };
60 };
61
62 # And wayland
63/* programs.sway = {
64 enable = true;
65 wrapperFeatures.gtk = true; # so that gtk works properly
66 extraPackages = with pkgs; [
67 swaylock
68 swayidle
69 wl-clipboard
70 mako # notification daemon
71 alacritty # Alacritty is the default terminal in the config
72 ];
73 };*/
74
75 programs.qt5ct = {
76 enable = true;
77 };
78# programs.waybar.enable = false; # true;
79
80 # Get screensharing to work
81 xdg = {
82 portal = {
83 enable = true;
84 extraPortals = with pkgs; [
85 xdg-desktop-portal-wlr
86# xdg-desktop-portal-gtk
87# xdg-desktop-portal-kde
88 ];
89# gtkUsePortal = true;
90 wlr.enable = true;
91
92 };
93 };
94
95 systemd.user.services.xdg-desktop-portal = {
96 unitConfig = {
97 After = "graphical-session.target";
98 };
99 };
100
101 # Configure keymap in X11
102 services.xserver.layout = "gb";
103 # services.xserver.xkbOptions = "eurosign:e";
104 services.upower.enable = true;
105
106 # Permit and install steam
107 nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
108 "steam"
109 "steam-original"
110 "steam-runtime"
111 "mongodb"
112 "nvidia-x11"
113 "nvidia-settings"
114 ];
115
116 programs.steam.enable = true;
117
118
119 # Enable CUPS to print documents.
120 services.printing.enable = true;
121
122 # Enable sound.
123 sound.enable = true;
124 hardware.pulseaudio.enable = false;
125 services.pipewire = {
126 enable = true;
127 alsa = {
128 enable = true;
129 support32Bit = true;
130 };
131 pulse.enable = true;
132 /*config.pipewire = {
133 "context.modules" = [
134 {
135 name = "libpipewire-module-filter-chain";
136 args = {
137 "node.name" = "effect_output.virtual-surround-7.1-hesuvi";
138 "node.description" = "Virtual Surround Sink";
139 "media.name" = "Virtual Surround Sink";
140 nodes = [
141 # duplicate inputs
142 { type = "builtin"; label = "copy"; name = "copyFL"; }
143 { type = "builtin"; label = "copy"; name = "copyFR"; }
144 { type = "builtin"; label = "copy"; name = "copyFC"; }
145 { type = "builtin"; label = "copy"; name = "copyRL"; }
146 { type = "builtin"; label = "copy"; name = "copyRR"; }
147 { type = "builtin"; label = "copy"; name = "copySL"; }
148 { type = "builtin"; label = "copy"; name = "copySR"; }
149 { type = "builtin"; label = "copy"; name = "copyLFE"; }
150
151 # apply hrir - HeSuVi 14-channel WAV (not the *-.wav variants) (note: 44 in HeSuVi are the same, but resampled to 44100)
152 { type = "builtin"; label = "convolver"; name = "convFL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 0; }; }
153 { type = "builtin"; label = "convolver"; name = "convFL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 1; }; }
154 { type = "builtin"; label = "convolver"; name = "convSL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 2; }; }
155 { type = "builtin"; label = "convolver"; name = "convSL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 3; }; }
156 { type = "builtin"; label = "convolver"; name = "convRL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 4; }; }
157 { type = "builtin"; label = "convolver"; name = "convRL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 5; }; }
158 { type = "builtin"; label = "convolver"; name = "convFC_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
159 { type = "builtin"; label = "convolver"; name = "convFR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 7; }; }
160 { type = "builtin"; label = "convolver"; name = "convFR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 8; }; }
161 { type = "builtin"; label = "convolver"; name = "convSR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 9; }; }
162 { type = "builtin"; label = "convolver"; name = "convSR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 10; }; }
163 { type = "builtin"; label = "convolver"; name = "convRR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 11; }; }
164 { type = "builtin"; label = "convolver"; name = "convRR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 12; }; }
165 { type = "builtin"; label = "convolver"; name = "convFC_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
166
167 # treat LFE as FC
168 { type = "builtin"; label = "convolver"; name = "convLFE_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
169 { type = "builtin"; label = "convolver"; name = "convLFE_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
170
171 # stereo output
172 { type = "builtin"; label = "mixer"; name = "mixR"; }
173 { type = "builtin"; label = "mixer"; name = "mixL"; }
174 ];
175 links = [
176 # input
177 { output = "copyFL:Out"; input="convFL_L:In"; }
178 { output = "copyFL:Out"; input="convFL_R:In"; }
179 { output = "copySL:Out"; input="convSL_L:In"; }
180 { output = "copySL:Out"; input="convSL_R:In"; }
181 { output = "copyRL:Out"; input="convRL_L:In"; }
182 { output = "copyRL:Out"; input="convRL_R:In"; }
183 { output = "copyFC:Out"; input="convFC_L:In"; }
184 { output = "copyFR:Out"; input="convFR_R:In"; }
185 { output = "copyFR:Out"; input="convFR_L:In"; }
186 { output = "copySR:Out"; input="convSR_R:In"; }
187 { output = "copySR:Out"; input="convSR_L:In"; }
188 { output = "copyRR:Out"; input="convRR_R:In"; }
189 { output = "copyRR:Out"; input="convRR_L:In"; }
190 { output = "copyFC:Out"; input="convFC_R:In"; }
191 { output = "copyLFE:Out"; input="convLFE_L:In"; }
192 { output = "copyLFE:Out"; input="convLFE_R:In"; }
193
194 # output
195 { output = "convFL_L:Out"; input="mixL:In 1"; }
196 { output = "convFL_R:Out"; input="mixR:In 1"; }
197 { output = "convSL_L:Out"; input="mixL:In 2"; }
198 { output = "convSL_R:Out"; input="mixR:In 2"; }
199 { output = "convRL_L:Out"; input="mixL:In 3"; }
200 { output = "convRL_R:Out"; input="mixR:In 3"; }
201 { output = "convFC_L:Out"; input="mixL:In 4"; }
202 { output = "convFC_R:Out"; input="mixR:In 4"; }
203 { output = "convFR_R:Out"; input="mixR:In 5"; }
204 { output = "convFR_L:Out"; input="mixL:In 5"; }
205 { output = "convSR_R:Out"; input="mixR:In 6"; }
206 { output = "convSR_L:Out"; input="mixL:In 6"; }
207 { output = "convRR_R:Out"; input="mixR:In 7"; }
208 { output = "convRR_L:Out"; input="mixL:In 7"; }
209 { output = "convLFE_R:Out"; input="mixR:In 8"; }
210 { output = "convLFE_L:Out"; input="mixL:In 8"; }
211 ];
212 inputs = [ "copyFL:In" "copyFR:In" "copyFC:In" "copyLFE:In" "copyRL:In" "copyRR:In" "copySL:In" "copySR:In" ];
213 outputs = [ "mixL:Out" "mixR:Out" ];
214 };
215 "capture.props" = {
216 "media.class" = "Audio/Sink";
217 "audio.channels" = 8;
218 "audio.position" = [ "FL" "FR" "FC" "LFE" "RL" "RR" "SL" "SR" ];
219 };
220 "playback.props" = {
221 "node.passive" = true;
222 "audio.channels" = 2;
223 "audio.position" = [ "FL" "FR" ];
224 };
225 }
226 ];
227 };*/
228 };
229 environment.etc."pipewire/7.1-surround-sound.conf".source = ./pipewire/7.1-surround-sound.conf;
230
231 hardware.openrazer.enable = true;
232 hardware.openrazer.users = [ "minion" ];
233
234 hardware.steam-hardware.enable = true;
235
236 # Enable touchpad support (enabled default in most desktopManager).
237 services.xserver.libinput.enable = true;
238
239 programs.dconf.enable = true;
240
241 # Define a user account. Don't forget to set a password with ‘passwd’.
242 users.users.minion = {
243 isNormalUser = true;
244 extraGroups = [ "wheel" "kvm" "docker" "containerd" "dialout" "libvirtd" ]; # Enable ‘sudo’ for the user.
245 shell = pkgs.zsh;
246 };
247
248 programs.zsh.enable = true;
249
250 # List packages installed in system profile. To search, run:
251 # $ nix search wget
252 environment.systemPackages = with pkgs; [
253 vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
254 ((emacsPackagesNgGen emacs).emacsWithPackages (epkgs: [
255 epkgs.vterm
256 epkgs.emacsql-sqlite
257 ])) # Emacs + vterm-module (needed for vterm)
258 wget
259 firefox
260 chromium # Install chromium if needed
261 texlive.combined.scheme-full
262 keybase-gui
263 bluez
264 macchanger
265 comic-relief
266 qemu_kvm
267 polkit_gnome
268 gtk-engine-murrine
269 gtk_engines
270 gsettings-desktop-schemas
271 lxappearance
272 libsForQt5.qt5.qtwayland
273 texworks
274 wlogout
275 wob
276 wlsunset
Skyler Greyc9ba9bf2022-05-18 22:11:33 +0100277 cni-plugins
278 ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100279
280# environment.systemPackages = [
281# import /scripts/jetbrains.rider.nix
282# ];
283
284 services.mongodb = {
285 package = pkgs.mongodb-4_2;
286 enable = true;
287 dbpath = "/tmp/mongodb";
288 };
289
290 fonts.fonts = with pkgs; [
291 nerdfonts
292 noto-fonts
293 noto-fonts-cjk
294 noto-fonts-emoji
295 liberation_ttf
296 fira-code
297 fira-code-symbols
298 mplus-outline-fonts
299 dina-font
300 proggyfonts
301 roboto
302 ];
303
304 # Some programs need SUID wrappers, can be configured further or are
305 # started in user sessions.
306 programs.mtr.enable = true;
307 programs.kdeconnect.enable = true;
308 programs.gnupg.agent = {
309 enable = true;
310 enableSSHSupport = true;
311 };
312
313 # List services that you want to enable:
314
315 # Enable the OpenSSH daemon.
316 services.openssh.enable = true;
317 services.keybase.enable = true;
318 services.kbfs.enable = true;
319 services.kbfs.enableRedirector = true;
320 security.wrappers.keybase-redirector.owner = "root";
321 security.wrappers.keybase-redirector.group = "users";
322 services.gnome.gnome-keyring.enable = true;
323 services.i2p.enable = true;
324 services.tlp.enable = true;
325
326 virtualisation.docker.enable = true;
327 virtualisation.docker.enableOnBoot = false;
328 virtualisation.libvirtd.enable = true;
329 virtualisation.libvirtd.onBoot = "ignore";
330
331 hardware.bluetooth.enable = true;
332
333 environment.pathsToLink = [ "/share/zsh" "/libexec" ];
334
335 virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
336 virtualisation.kvmgt.enable = true;
337
338 services.openvpn.servers = {
339 clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; };
340 };
341
342 environment.etc = {
343 "pam.d/swaylock" = {
344 mode = "0644";
345 text = ''
346 auth include login
347 '';
348 };
349 };
350
Skyler Grey33b23e32022-05-19 06:42:03 +0100351# nixpkgs.overlays = [
352# (self: super: {
353# polkit = super.polkit.overrideAttrs (oldAttrs: {
354# patches = oldAttrs.patches ++ [
355# (super.fetchpatch {
356# url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
357# sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
358# })];
359# });
360# })
361# ];
Skyler Grey4e10d632022-05-18 21:55:27 +0100362
363 xdg.mime.defaultApplications = {
364 "text/html" = "chromium-browser.desktop";
365 "x-scheme-handler/http" = "chromium-browser.desktop";
366 "x-scheme-handler/https" = "chromium-browser.desktop";
367 "x-scheme-handler/about" = "chromium-browser.desktop";
368 "x-scheme-handler/unknown" = "chromium-browser.desktop";
369 };
370
371 # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
372
373
374 boot.supportedFilesystems = [ "kbfs" ];
375
376 # This value determines the NixOS release from which the default
377 # settings for stateful data, like file locations and database versions
378 # on your system were taken. It‘s perfectly fine and recommended to leave
379 # this value at the release version of the first install of this system.
380 # Before changing this value read the documentation for this option
381 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
382 system.stateVersion = "21.11"; # Did you read the comment?
383
384 boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
385 boot.initrd.kernelModules = [ ];
386 boot.kernelModules = [ "kvm-intel" ];
387# boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; # Broken in nixpkgs; seems to be mountable and usable anyway
388
389 fileSystems."/" =
390 { device = "/dev/disk/by-label/nixos";
391 fsType = "ext4";
392 };
393
394 fileSystems."/boot" =
395 { device = "/dev/disk/by-label/boot";
396 fsType = "vfat";
397 };
398
399 swapDevices =
400 [ { device = "/dev/disk/by-label/swap"; }
401 ];
402
403 powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
404 hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
405
406# hardware.nvidia.modesetting.enable = true;
407# services.xserver.videoDrivers = [ "nvidia" ];
408
409# hardware.opentabletdriver.enable = true;
410
411 virtualisation.containerd.enable = true;
412
413 virtualisation.containerd.settings = {
414 version = 2;
415# grpc = {
416# uid = 1000;
417# };
418 };
419
420 networking.hostName = "python";
421
422 networking.wireless.iwd.enable = true;
423 networking.wireless.iwd.settings = {
424 Settings = {
425 AutoConnect = true;
426 AlwaysRandomizeAddress = true;
427 };
428 };
429}