blob: 277fb6ac6f8566c0ae8dc5487fa2aef1912db67a [file] [log] [blame]
Skyler Turner205aff12021-12-20 11:22:57 +00001# Edit this configuration file to define what should be installed on
2# your system. Help is available in the configuration.nix(5) man page
3# and in the NixOS manual (accessible by running ‘nixos-help’).
4
5{ config, pkgs, lib, ... }:
Skyler Turner4d3d9622022-05-10 21:54:56 +01006let
7 unstable-pkgs = import <nixos-unstable> { config = { allowUnfree = true; }; };
8in
Skyler Turner0872be92022-01-24 11:31:38 +00009{
Skyler Turner205aff12021-12-20 11:22:57 +000010 imports =
11 [ # Include the results of the hardware scan.
12 ./hardware-configuration.nix
Skyler Turner444ffc22021-12-20 11:28:06 +000013 ../secrets/networking-configuration.nix
Skyler Turner205aff12021-12-20 11:22:57 +000014 ./packaging-configuration.nix
Skyler Turner657b0492022-02-06 21:42:02 +000015 ./containerd/containerd.nix
Skyler Turner205aff12021-12-20 11:22:57 +000016 ];
17
Skyler Turner32dbfb42021-12-24 15:50:22 +000018 # Prepare nix flakes
19 nix = {
20 package = pkgs.nixFlakes;
21 extraOptions = ''
22 experimental-features = nix-command flakes
23 '';
24 };
25
Skyler Turner205aff12021-12-20 11:22:57 +000026 # Use the systemd-boot EFI boot loader.
27 boot.loader.systemd-boot.enable = true;
28 boot.loader.efi.canTouchEfiVariables = true;
29 boot.loader.grub.useOSProber = true;
30
Skyler Turner7b0051e2021-12-29 15:46:56 +000031 # Enable emulated systems
Skyler Turner107ae412021-12-29 18:34:59 +000032 boot.binfmt.emulatedSystems = [ "aarch64-linux" "armv6l-linux" ];
Skyler Turner7b0051e2021-12-29 15:46:56 +000033
Skyler Turner5464fc72022-05-12 10:32:08 +010034 boot.resumeDevice = "/dev/nvme0n1p5";
35
Skyler Turner205aff12021-12-20 11:22:57 +000036 # Enable apparmor
37 security.apparmor.enable = true;
38 security.apparmor.killUnconfinedConfinables = true;
39
40 # Set your time zone.
41 time.timeZone = "Europe/London";
42
43 # Select internationalisation properties.
44 i18n.defaultLocale = "en_US.UTF-8";
45 console = {
46 font = "Lat2-Terminus16";
47 keyMap = "uk";
48 };
49
50 # Enable the X11 windowing system.
51 services.xserver = {
52 enable = true;
53 desktopManager = {
54 xterm.enable = false;
55 # xfce.enable = true;
56 };
Skyler Turner27ee4cb2022-03-06 22:29:09 +000057 displayManager.startx.enable = true;
58 # displayManager.sddm.enable = true;
Skyler Turner205aff12021-12-20 11:22:57 +000059 };
60
Skyler Turner670050e2022-05-15 10:59:08 +010061 services.zeronet.enable = true;
62
Skyler Turner072db1e2022-02-27 01:01:59 +000063 services = {
64 syncthing = {
65 enable = true;
66 user = "minion";
67 dataDir = "/home/minion/Documents"; # Default folder for new synced folders
68 configDir = "/home/minion/.config/syncthing"; # Folder for Syncthing's settings and keys
69 };
70 };
71
Skyler Turner205aff12021-12-20 11:22:57 +000072 # And wayland
Skyler Turner27ee4cb2022-03-06 22:29:09 +000073/* programs.sway = {
Skyler Turner205aff12021-12-20 11:22:57 +000074 enable = true;
75 wrapperFeatures.gtk = true; # so that gtk works properly
76 extraPackages = with pkgs; [
77 swaylock
78 swayidle
79 wl-clipboard
80 mako # notification daemon
81 alacritty # Alacritty is the default terminal in the config
Skyler Turner205aff12021-12-20 11:22:57 +000082 ];
Skyler Turner27ee4cb2022-03-06 22:29:09 +000083 };*/
Skyler Turner205aff12021-12-20 11:22:57 +000084
Skyler Turner98617fd2022-04-05 21:56:26 +010085 programs.qt5ct = {
86 enable = true;
87 };
Skyler Turner27ee4cb2022-03-06 22:29:09 +000088# programs.waybar.enable = false; # true;
Skyler Turnere24f21c2022-02-06 16:02:53 +000089
Skyler Turner205aff12021-12-20 11:22:57 +000090 # Get screensharing to work
91 xdg = {
92 portal = {
93 enable = true;
94 extraPortals = with pkgs; [
95 xdg-desktop-portal-wlr
Skyler Turnere8b7af22022-03-21 00:05:17 +000096# xdg-desktop-portal-gtk
97# xdg-desktop-portal-kde
Skyler Turner205aff12021-12-20 11:22:57 +000098 ];
Skyler Turnere8b7af22022-03-21 00:05:17 +000099# gtkUsePortal = true;
Skyler Turner84ec77c2022-01-14 09:05:57 +0000100 wlr.enable = true;
101
Skyler Turner205aff12021-12-20 11:22:57 +0000102 };
103 };
104
Skyler Turner69ca44c2022-03-09 06:56:20 +0000105 systemd.user.services.xdg-desktop-portal = {
106 unitConfig = {
107 After = "graphical-session.target";
108 };
109 };
110
Skyler Turner205aff12021-12-20 11:22:57 +0000111 # Configure keymap in X11
112 services.xserver.layout = "gb";
113 # services.xserver.xkbOptions = "eurosign:e";
Skyler Turner55c8ee82022-03-08 19:22:16 +0000114 services.upower.enable = true;
Skyler Turner205aff12021-12-20 11:22:57 +0000115
116 # Permit and install steam
117 nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
118 "steam"
119 "steam-original"
120 "steam-runtime"
Skyler Turner5f220932022-05-10 23:45:01 +0100121 "mongodb"
Skyler Turner670050e2022-05-15 10:59:08 +0100122 "nvidia-x11"
123 "nvidia-settings"
Skyler Turner205aff12021-12-20 11:22:57 +0000124 ];
125
126 programs.steam.enable = true;
127
128
129 # Enable CUPS to print documents.
130 services.printing.enable = true;
131
132 # Enable sound.
133 sound.enable = true;
134 hardware.pulseaudio.enable = false;
135 services.pipewire = {
136 enable = true;
137 alsa = {
138 enable = true;
139 support32Bit = true;
140 };
141 pulse.enable = true;
Skyler Turner4ca71fb2022-02-20 11:12:22 +0000142 /*config.pipewire = {
Skyler Turner074765b2022-02-20 10:46:58 +0000143 "context.modules" = [
Skyler Turner2f6b3ed2022-02-19 14:37:14 +0000144 {
Skyler Turner074765b2022-02-20 10:46:58 +0000145 name = "libpipewire-module-filter-chain";
146 args = {
147 "node.name" = "effect_output.virtual-surround-7.1-hesuvi";
148 "node.description" = "Virtual Surround Sink";
149 "media.name" = "Virtual Surround Sink";
150 nodes = [
151 # duplicate inputs
152 { type = "builtin"; label = "copy"; name = "copyFL"; }
153 { type = "builtin"; label = "copy"; name = "copyFR"; }
154 { type = "builtin"; label = "copy"; name = "copyFC"; }
155 { type = "builtin"; label = "copy"; name = "copyRL"; }
156 { type = "builtin"; label = "copy"; name = "copyRR"; }
157 { type = "builtin"; label = "copy"; name = "copySL"; }
158 { type = "builtin"; label = "copy"; name = "copySR"; }
159 { type = "builtin"; label = "copy"; name = "copyLFE"; }
160
Skyler Turner4ca71fb2022-02-20 11:12:22 +0000161 # apply hrir - HeSuVi 14-channel WAV (not the *-.wav variants) (note: 44 in HeSuVi are the same, but resampled to 44100)
Skyler Turner074765b2022-02-20 10:46:58 +0000162 { type = "builtin"; label = "convolver"; name = "convFL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 0; }; }
163 { type = "builtin"; label = "convolver"; name = "convFL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 1; }; }
164 { type = "builtin"; label = "convolver"; name = "convSL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 2; }; }
165 { type = "builtin"; label = "convolver"; name = "convSL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 3; }; }
166 { type = "builtin"; label = "convolver"; name = "convRL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 4; }; }
167 { type = "builtin"; label = "convolver"; name = "convRL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 5; }; }
168 { type = "builtin"; label = "convolver"; name = "convFC_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
169 { type = "builtin"; label = "convolver"; name = "convFR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 7; }; }
170 { type = "builtin"; label = "convolver"; name = "convFR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 8; }; }
171 { type = "builtin"; label = "convolver"; name = "convSR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 9; }; }
172 { type = "builtin"; label = "convolver"; name = "convSR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 10; }; }
173 { type = "builtin"; label = "convolver"; name = "convRR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 11; }; }
174 { type = "builtin"; label = "convolver"; name = "convRR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 12; }; }
175 { type = "builtin"; label = "convolver"; name = "convFC_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
176
177 # treat LFE as FC
178 { type = "builtin"; label = "convolver"; name = "convLFE_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
179 { type = "builtin"; label = "convolver"; name = "convLFE_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
180
181 # stereo output
182 { type = "builtin"; label = "mixer"; name = "mixR"; }
183 { type = "builtin"; label = "mixer"; name = "mixL"; }
184 ];
185 links = [
186 # input
187 { output = "copyFL:Out"; input="convFL_L:In"; }
188 { output = "copyFL:Out"; input="convFL_R:In"; }
189 { output = "copySL:Out"; input="convSL_L:In"; }
190 { output = "copySL:Out"; input="convSL_R:In"; }
191 { output = "copyRL:Out"; input="convRL_L:In"; }
192 { output = "copyRL:Out"; input="convRL_R:In"; }
193 { output = "copyFC:Out"; input="convFC_L:In"; }
194 { output = "copyFR:Out"; input="convFR_R:In"; }
195 { output = "copyFR:Out"; input="convFR_L:In"; }
196 { output = "copySR:Out"; input="convSR_R:In"; }
197 { output = "copySR:Out"; input="convSR_L:In"; }
198 { output = "copyRR:Out"; input="convRR_R:In"; }
199 { output = "copyRR:Out"; input="convRR_L:In"; }
200 { output = "copyFC:Out"; input="convFC_R:In"; }
201 { output = "copyLFE:Out"; input="convLFE_L:In"; }
202 { output = "copyLFE:Out"; input="convLFE_R:In"; }
203
204 # output
205 { output = "convFL_L:Out"; input="mixL:In 1"; }
206 { output = "convFL_R:Out"; input="mixR:In 1"; }
207 { output = "convSL_L:Out"; input="mixL:In 2"; }
208 { output = "convSL_R:Out"; input="mixR:In 2"; }
209 { output = "convRL_L:Out"; input="mixL:In 3"; }
210 { output = "convRL_R:Out"; input="mixR:In 3"; }
211 { output = "convFC_L:Out"; input="mixL:In 4"; }
212 { output = "convFC_R:Out"; input="mixR:In 4"; }
213 { output = "convFR_R:Out"; input="mixR:In 5"; }
214 { output = "convFR_L:Out"; input="mixL:In 5"; }
215 { output = "convSR_R:Out"; input="mixR:In 6"; }
216 { output = "convSR_L:Out"; input="mixL:In 6"; }
217 { output = "convRR_R:Out"; input="mixR:In 7"; }
218 { output = "convRR_L:Out"; input="mixL:In 7"; }
219 { output = "convLFE_R:Out"; input="mixR:In 8"; }
220 { output = "convLFE_L:Out"; input="mixL:In 8"; }
221 ];
222 inputs = [ "copyFL:In" "copyFR:In" "copyFC:In" "copyLFE:In" "copyRL:In" "copyRR:In" "copySL:In" "copySR:In" ];
223 outputs = [ "mixL:Out" "mixR:Out" ];
224 };
225 "capture.props" = {
226 "media.class" = "Audio/Sink";
227 "audio.channels" = 8;
228 "audio.position" = [ "FL" "FR" "FC" "LFE" "RL" "RR" "SL" "SR" ];
229 };
230 "playback.props" = {
231 "node.passive" = true;
232 "audio.channels" = 2;
233 "audio.position" = [ "FL" "FR" ];
234 };
Skyler Turner2f6b3ed2022-02-19 14:37:14 +0000235 }
236 ];
Skyler Turner4ca71fb2022-02-20 11:12:22 +0000237 };*/
Skyler Turner205aff12021-12-20 11:22:57 +0000238 };
Skyler Turner2f6b3ed2022-02-19 14:37:14 +0000239 environment.etc."pipewire/7.1-surround-sound.conf".source = ./pipewire/7.1-surround-sound.conf;
Skyler Turner205aff12021-12-20 11:22:57 +0000240
Skyler Turner716da2d2022-02-20 20:40:02 +0000241 hardware.openrazer.enable = true;
242 hardware.openrazer.users = [ "minion" ];
243
Skyler Turner0bb4f842022-04-05 20:27:22 +0100244 hardware.steam-hardware.enable = true;
245
Skyler Turner205aff12021-12-20 11:22:57 +0000246 # Enable touchpad support (enabled default in most desktopManager).
247 services.xserver.libinput.enable = true;
248
Skyler Turnerbe543712022-03-08 19:21:06 +0000249 programs.dconf.enable = true;
Skyler Turner7145c2d2022-03-08 19:19:10 +0000250
Skyler Turner205aff12021-12-20 11:22:57 +0000251 # Define a user account. Don't forget to set a password with ‘passwd’.
252 users.users.minion = {
253 isNormalUser = true;
Skyler Turnere9893c92022-03-13 15:37:58 +0000254 extraGroups = [ "wheel" "kvm" "docker" "containerd" "dialout" "libvirtd" ]; # Enable ‘sudo’ for the user.
Skyler Turner7fe8a242022-02-06 00:42:28 +0000255 shell = pkgs.zsh;
Skyler Turner205aff12021-12-20 11:22:57 +0000256 };
257
Skyler Turnerb8f440b2022-04-05 22:18:44 +0100258 programs.zsh.enable = true;
Skyler Turner36ed4592022-04-05 22:15:02 +0100259
Skyler Turner205aff12021-12-20 11:22:57 +0000260 # List packages installed in system profile. To search, run:
261 # $ nix search wget
Skyler Turnera3ab14b2022-01-24 11:37:41 +0000262 environment.systemPackages = with pkgs; [
Skyler Turner205aff12021-12-20 11:22:57 +0000263 vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
264 ((emacsPackagesNgGen emacs).emacsWithPackages (epkgs: [
265 epkgs.vterm
266 epkgs.emacsql-sqlite
267 ])) # Emacs + vterm-module (needed for vterm)
268 wget
269 firefox
270 chromium # Install chromium if needed
271 texlive.combined.scheme-full
Skyler Turner205aff12021-12-20 11:22:57 +0000272 keybase-gui
Skyler Turneree73be42022-01-10 11:02:46 +0000273 bluez
Skyler Turner1a7d0b42022-01-18 10:27:32 +0000274 macchanger
Skyler Turnerb4541be2022-01-21 19:38:55 +0000275 comic-relief
Skyler Turnerb408dcf2022-02-04 23:48:08 +0000276 qemu_kvm
Skyler Turner5954aae2022-02-06 16:03:51 +0000277 polkit_gnome
Skyler Turner785a8a62022-02-06 16:12:59 +0000278 gtk-engine-murrine
279 gtk_engines
280 gsettings-desktop-schemas
281 lxappearance
Skyler Turner98617fd2022-04-05 21:56:26 +0100282 libsForQt5.qt5.qtwayland
Skyler Turnerfcef30e2022-05-12 19:07:33 +0100283 texworks
Skyler Turnerc16beec2022-05-12 10:26:30 +0100284 wlogout
285 wob
Skyler Turner68563b12022-05-12 10:30:11 +0100286 wlsunset
Skyler Turnerbfe0f542022-02-06 21:45:00 +0000287 ] ++ (import ./containerd/systemPackages.nix pkgs).systemPackages;
Skyler Turner205aff12021-12-20 11:22:57 +0000288
289# environment.systemPackages = [
290# import /scripts/jetbrains.rider.nix
291# ];
292
Skyler Turner3c940042022-05-10 21:20:12 +0100293 services.mongodb = {
Skyler Turnerd80e68e2022-05-10 22:43:00 +0100294 package = pkgs.mongodb-4_2;
Skyler Turner3c940042022-05-10 21:20:12 +0100295 enable = true;
296 dbpath = "/tmp/mongodb";
297 };
298
Skyler Turner205aff12021-12-20 11:22:57 +0000299 fonts.fonts = with pkgs; [
300 nerdfonts
301 noto-fonts
302 noto-fonts-cjk
303 noto-fonts-emoji
304 liberation_ttf
305 fira-code
306 fira-code-symbols
307 mplus-outline-fonts
308 dina-font
309 proggyfonts
310 roboto
311 ];
312
313 # Some programs need SUID wrappers, can be configured further or are
314 # started in user sessions.
315 programs.mtr.enable = true;
Skyler Turnerf2a29ee2022-02-05 23:39:37 +0000316 programs.kdeconnect.enable = true;
Skyler Turner205aff12021-12-20 11:22:57 +0000317 programs.gnupg.agent = {
318 enable = true;
319 enableSSHSupport = true;
320 };
321
322 # List services that you want to enable:
323
324 # Enable the OpenSSH daemon.
325 services.openssh.enable = true;
326 services.keybase.enable = true;
Skyler Turnera6cfb632022-01-16 23:03:43 +0000327 services.kbfs.enable = true;
328 services.kbfs.enableRedirector = true;
Skyler Turnercde828a2022-02-02 09:41:56 +0000329 security.wrappers.keybase-redirector.owner = "root";
Skyler Turnera620ae92022-02-24 08:26:31 +0000330 security.wrappers.keybase-redirector.group = "users";
Skyler Turner205aff12021-12-20 11:22:57 +0000331 services.gnome.gnome-keyring.enable = true;
332 services.i2p.enable = true;
Skyler Turner87637252022-02-01 12:28:51 +0000333 services.tlp.enable = true;
Skyler Turner67c6fd82022-03-15 17:42:30 +0000334
Skyler Turner32dbfb42021-12-24 15:50:22 +0000335 virtualisation.docker.enable = true;
Skyler Turnerf2a29ee2022-02-05 23:39:37 +0000336 virtualisation.docker.enableOnBoot = false;
Skyler Turnere9893c92022-03-13 15:37:58 +0000337 virtualisation.libvirtd.enable = true;
338 virtualisation.libvirtd.onBoot = "ignore";
Skyler Turner205aff12021-12-20 11:22:57 +0000339
Skyler Turnerfff67b52022-02-08 21:29:33 +0000340 hardware.bluetooth.enable = true;
341
Skyler Turner5954aae2022-02-06 16:03:51 +0000342 environment.pathsToLink = [ "/share/zsh" "/libexec" ];
Skyler Turner1035c8c2022-02-05 23:43:34 +0000343
Skyler Turner98483702022-02-04 23:25:21 +0000344 virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
Skyler Turner2ee83f82022-02-04 23:18:51 +0000345 virtualisation.kvmgt.enable = true;
346
Skyler Turnerff2168b2022-01-16 16:19:50 +0000347 services.openvpn.servers = {
Skyler Turner3a7d7792022-01-16 16:23:50 +0000348 clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; };
Skyler Turnerff2168b2022-01-16 16:19:50 +0000349 };
350
Skyler Turnerdf40c9e2022-03-09 09:35:42 +0000351 environment.etc = {
352 "pam.d/swaylock" = {
Skyler Turnerbaa75622022-03-09 09:39:26 +0000353 mode = "0644";
Skyler Turnerdf40c9e2022-03-09 09:35:42 +0000354 text = ''
355 auth include login
356 '';
357 };
358 };
359
Skyler Turner4f5f11b2022-01-14 23:36:39 +0000360 nixpkgs.overlays = [
361 (self: super: {
362 polkit = super.polkit.overrideAttrs (oldAttrs: {
363 patches = oldAttrs.patches ++ [
364 (super.fetchpatch {
365 url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
366 sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
367 })];
368 });
369 })
370 ];
371
Skyler Turnerb0362522022-02-25 09:36:23 +0000372 xdg.mime.defaultApplications = {
373 "text/html" = "chromium-browser.desktop";
374 "x-scheme-handler/http" = "chromium-browser.desktop";
375 "x-scheme-handler/https" = "chromium-browser.desktop";
376 "x-scheme-handler/about" = "chromium-browser.desktop";
377 "x-scheme-handler/unknown" = "chromium-browser.desktop";
378 };
379
Skyler Turner95f68502022-02-25 09:57:21 +0000380 # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
Skyler Turnerb0362522022-02-25 09:36:23 +0000381
382
Skyler Turner95f68502022-02-25 09:57:21 +0000383 boot.supportedFilesystems = [ "kbfs" ];
384
Skyler Turner205aff12021-12-20 11:22:57 +0000385 # This value determines the NixOS release from which the default
386 # settings for stateful data, like file locations and database versions
387 # on your system were taken. It‘s perfectly fine and recommended to leave
388 # this value at the release version of the first install of this system.
389 # Before changing this value read the documentation for this option
390 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
391 system.stateVersion = "21.11"; # Did you read the comment?
392
393}
394