blob: f2382a004b931450da6bdf6a96e52489bd5bf237 [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 Turner072db1e2022-02-27 01:01:59 +000061 services = {
62 syncthing = {
63 enable = true;
64 user = "minion";
65 dataDir = "/home/minion/Documents"; # Default folder for new synced folders
66 configDir = "/home/minion/.config/syncthing"; # Folder for Syncthing's settings and keys
67 };
68 };
69
Skyler Turner205aff12021-12-20 11:22:57 +000070 # And wayland
Skyler Turner27ee4cb2022-03-06 22:29:09 +000071/* programs.sway = {
Skyler Turner205aff12021-12-20 11:22:57 +000072 enable = true;
73 wrapperFeatures.gtk = true; # so that gtk works properly
74 extraPackages = with pkgs; [
75 swaylock
76 swayidle
77 wl-clipboard
78 mako # notification daemon
79 alacritty # Alacritty is the default terminal in the config
Skyler Turner205aff12021-12-20 11:22:57 +000080 ];
Skyler Turner27ee4cb2022-03-06 22:29:09 +000081 };*/
Skyler Turner205aff12021-12-20 11:22:57 +000082
Skyler Turner98617fd2022-04-05 21:56:26 +010083 programs.qt5ct = {
84 enable = true;
85 };
Skyler Turner27ee4cb2022-03-06 22:29:09 +000086# programs.waybar.enable = false; # true;
Skyler Turnere24f21c2022-02-06 16:02:53 +000087
Skyler Turner205aff12021-12-20 11:22:57 +000088 # Get screensharing to work
89 xdg = {
90 portal = {
91 enable = true;
92 extraPortals = with pkgs; [
93 xdg-desktop-portal-wlr
Skyler Turnere8b7af22022-03-21 00:05:17 +000094# xdg-desktop-portal-gtk
95# xdg-desktop-portal-kde
Skyler Turner205aff12021-12-20 11:22:57 +000096 ];
Skyler Turnere8b7af22022-03-21 00:05:17 +000097# gtkUsePortal = true;
Skyler Turner84ec77c2022-01-14 09:05:57 +000098 wlr.enable = true;
99
Skyler Turner205aff12021-12-20 11:22:57 +0000100 };
101 };
102
Skyler Turner69ca44c2022-03-09 06:56:20 +0000103 systemd.user.services.xdg-desktop-portal = {
104 unitConfig = {
105 After = "graphical-session.target";
106 };
107 };
108
Skyler Turner205aff12021-12-20 11:22:57 +0000109 # Configure keymap in X11
110 services.xserver.layout = "gb";
111 # services.xserver.xkbOptions = "eurosign:e";
Skyler Turner55c8ee82022-03-08 19:22:16 +0000112 services.upower.enable = true;
Skyler Turner205aff12021-12-20 11:22:57 +0000113
114 # Permit and install steam
115 nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
116 "steam"
117 "steam-original"
118 "steam-runtime"
Skyler Turner5f220932022-05-10 23:45:01 +0100119 "mongodb"
Skyler Turner205aff12021-12-20 11:22:57 +0000120 ];
121
122 programs.steam.enable = true;
123
124
125 # Enable CUPS to print documents.
126 services.printing.enable = true;
127
128 # Enable sound.
129 sound.enable = true;
130 hardware.pulseaudio.enable = false;
131 services.pipewire = {
132 enable = true;
133 alsa = {
134 enable = true;
135 support32Bit = true;
136 };
137 pulse.enable = true;
Skyler Turner4ca71fb2022-02-20 11:12:22 +0000138 /*config.pipewire = {
Skyler Turner074765b2022-02-20 10:46:58 +0000139 "context.modules" = [
Skyler Turner2f6b3ed2022-02-19 14:37:14 +0000140 {
Skyler Turner074765b2022-02-20 10:46:58 +0000141 name = "libpipewire-module-filter-chain";
142 args = {
143 "node.name" = "effect_output.virtual-surround-7.1-hesuvi";
144 "node.description" = "Virtual Surround Sink";
145 "media.name" = "Virtual Surround Sink";
146 nodes = [
147 # duplicate inputs
148 { type = "builtin"; label = "copy"; name = "copyFL"; }
149 { type = "builtin"; label = "copy"; name = "copyFR"; }
150 { type = "builtin"; label = "copy"; name = "copyFC"; }
151 { type = "builtin"; label = "copy"; name = "copyRL"; }
152 { type = "builtin"; label = "copy"; name = "copyRR"; }
153 { type = "builtin"; label = "copy"; name = "copySL"; }
154 { type = "builtin"; label = "copy"; name = "copySR"; }
155 { type = "builtin"; label = "copy"; name = "copyLFE"; }
156
Skyler Turner4ca71fb2022-02-20 11:12:22 +0000157 # 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 +0000158 { type = "builtin"; label = "convolver"; name = "convFL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 0; }; }
159 { type = "builtin"; label = "convolver"; name = "convFL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 1; }; }
160 { type = "builtin"; label = "convolver"; name = "convSL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 2; }; }
161 { type = "builtin"; label = "convolver"; name = "convSL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 3; }; }
162 { type = "builtin"; label = "convolver"; name = "convRL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 4; }; }
163 { type = "builtin"; label = "convolver"; name = "convRL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 5; }; }
164 { type = "builtin"; label = "convolver"; name = "convFC_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
165 { type = "builtin"; label = "convolver"; name = "convFR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 7; }; }
166 { type = "builtin"; label = "convolver"; name = "convFR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 8; }; }
167 { type = "builtin"; label = "convolver"; name = "convSR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 9; }; }
168 { type = "builtin"; label = "convolver"; name = "convSR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 10; }; }
169 { type = "builtin"; label = "convolver"; name = "convRR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 11; }; }
170 { type = "builtin"; label = "convolver"; name = "convRR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 12; }; }
171 { type = "builtin"; label = "convolver"; name = "convFC_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
172
173 # treat LFE as FC
174 { type = "builtin"; label = "convolver"; name = "convLFE_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
175 { type = "builtin"; label = "convolver"; name = "convLFE_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
176
177 # stereo output
178 { type = "builtin"; label = "mixer"; name = "mixR"; }
179 { type = "builtin"; label = "mixer"; name = "mixL"; }
180 ];
181 links = [
182 # input
183 { output = "copyFL:Out"; input="convFL_L:In"; }
184 { output = "copyFL:Out"; input="convFL_R:In"; }
185 { output = "copySL:Out"; input="convSL_L:In"; }
186 { output = "copySL:Out"; input="convSL_R:In"; }
187 { output = "copyRL:Out"; input="convRL_L:In"; }
188 { output = "copyRL:Out"; input="convRL_R:In"; }
189 { output = "copyFC:Out"; input="convFC_L:In"; }
190 { output = "copyFR:Out"; input="convFR_R:In"; }
191 { output = "copyFR:Out"; input="convFR_L:In"; }
192 { output = "copySR:Out"; input="convSR_R:In"; }
193 { output = "copySR:Out"; input="convSR_L:In"; }
194 { output = "copyRR:Out"; input="convRR_R:In"; }
195 { output = "copyRR:Out"; input="convRR_L:In"; }
196 { output = "copyFC:Out"; input="convFC_R:In"; }
197 { output = "copyLFE:Out"; input="convLFE_L:In"; }
198 { output = "copyLFE:Out"; input="convLFE_R:In"; }
199
200 # output
201 { output = "convFL_L:Out"; input="mixL:In 1"; }
202 { output = "convFL_R:Out"; input="mixR:In 1"; }
203 { output = "convSL_L:Out"; input="mixL:In 2"; }
204 { output = "convSL_R:Out"; input="mixR:In 2"; }
205 { output = "convRL_L:Out"; input="mixL:In 3"; }
206 { output = "convRL_R:Out"; input="mixR:In 3"; }
207 { output = "convFC_L:Out"; input="mixL:In 4"; }
208 { output = "convFC_R:Out"; input="mixR:In 4"; }
209 { output = "convFR_R:Out"; input="mixR:In 5"; }
210 { output = "convFR_L:Out"; input="mixL:In 5"; }
211 { output = "convSR_R:Out"; input="mixR:In 6"; }
212 { output = "convSR_L:Out"; input="mixL:In 6"; }
213 { output = "convRR_R:Out"; input="mixR:In 7"; }
214 { output = "convRR_L:Out"; input="mixL:In 7"; }
215 { output = "convLFE_R:Out"; input="mixR:In 8"; }
216 { output = "convLFE_L:Out"; input="mixL:In 8"; }
217 ];
218 inputs = [ "copyFL:In" "copyFR:In" "copyFC:In" "copyLFE:In" "copyRL:In" "copyRR:In" "copySL:In" "copySR:In" ];
219 outputs = [ "mixL:Out" "mixR:Out" ];
220 };
221 "capture.props" = {
222 "media.class" = "Audio/Sink";
223 "audio.channels" = 8;
224 "audio.position" = [ "FL" "FR" "FC" "LFE" "RL" "RR" "SL" "SR" ];
225 };
226 "playback.props" = {
227 "node.passive" = true;
228 "audio.channels" = 2;
229 "audio.position" = [ "FL" "FR" ];
230 };
Skyler Turner2f6b3ed2022-02-19 14:37:14 +0000231 }
232 ];
Skyler Turner4ca71fb2022-02-20 11:12:22 +0000233 };*/
Skyler Turner205aff12021-12-20 11:22:57 +0000234 };
Skyler Turner2f6b3ed2022-02-19 14:37:14 +0000235 environment.etc."pipewire/7.1-surround-sound.conf".source = ./pipewire/7.1-surround-sound.conf;
Skyler Turner205aff12021-12-20 11:22:57 +0000236
Skyler Turner716da2d2022-02-20 20:40:02 +0000237 hardware.openrazer.enable = true;
238 hardware.openrazer.users = [ "minion" ];
239
Skyler Turner0bb4f842022-04-05 20:27:22 +0100240 hardware.steam-hardware.enable = true;
241
Skyler Turner205aff12021-12-20 11:22:57 +0000242 # Enable touchpad support (enabled default in most desktopManager).
243 services.xserver.libinput.enable = true;
244
Skyler Turnerbe543712022-03-08 19:21:06 +0000245 programs.dconf.enable = true;
Skyler Turner7145c2d2022-03-08 19:19:10 +0000246
Skyler Turner205aff12021-12-20 11:22:57 +0000247 # Define a user account. Don't forget to set a password with ‘passwd’.
248 users.users.minion = {
249 isNormalUser = true;
Skyler Turnere9893c92022-03-13 15:37:58 +0000250 extraGroups = [ "wheel" "kvm" "docker" "containerd" "dialout" "libvirtd" ]; # Enable ‘sudo’ for the user.
Skyler Turner7fe8a242022-02-06 00:42:28 +0000251 shell = pkgs.zsh;
Skyler Turner205aff12021-12-20 11:22:57 +0000252 };
253
Skyler Turnerb8f440b2022-04-05 22:18:44 +0100254 programs.zsh.enable = true;
Skyler Turner36ed4592022-04-05 22:15:02 +0100255
Skyler Turner205aff12021-12-20 11:22:57 +0000256 # List packages installed in system profile. To search, run:
257 # $ nix search wget
Skyler Turnera3ab14b2022-01-24 11:37:41 +0000258 environment.systemPackages = with pkgs; [
Skyler Turner205aff12021-12-20 11:22:57 +0000259 vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
260 ((emacsPackagesNgGen emacs).emacsWithPackages (epkgs: [
261 epkgs.vterm
262 epkgs.emacsql-sqlite
263 ])) # Emacs + vterm-module (needed for vterm)
264 wget
265 firefox
266 chromium # Install chromium if needed
267 texlive.combined.scheme-full
Skyler Turner205aff12021-12-20 11:22:57 +0000268 keybase-gui
Skyler Turneree73be42022-01-10 11:02:46 +0000269 bluez
Skyler Turner1a7d0b42022-01-18 10:27:32 +0000270 macchanger
Skyler Turnerb4541be2022-01-21 19:38:55 +0000271 comic-relief
Skyler Turnerb408dcf2022-02-04 23:48:08 +0000272 qemu_kvm
Skyler Turner5954aae2022-02-06 16:03:51 +0000273 polkit_gnome
Skyler Turner785a8a62022-02-06 16:12:59 +0000274 gtk-engine-murrine
275 gtk_engines
276 gsettings-desktop-schemas
277 lxappearance
Skyler Turner98617fd2022-04-05 21:56:26 +0100278 libsForQt5.qt5.qtwayland
Skyler Turnerc16beec2022-05-12 10:26:30 +0100279 lyx
280 wlogout
281 wob
Skyler Turner68563b12022-05-12 10:30:11 +0100282 wlsunset
Skyler Turnerbfe0f542022-02-06 21:45:00 +0000283 ] ++ (import ./containerd/systemPackages.nix pkgs).systemPackages;
Skyler Turner205aff12021-12-20 11:22:57 +0000284
285# environment.systemPackages = [
286# import /scripts/jetbrains.rider.nix
287# ];
288
Skyler Turner3c940042022-05-10 21:20:12 +0100289 services.mongodb = {
Skyler Turnerd80e68e2022-05-10 22:43:00 +0100290 package = pkgs.mongodb-4_2;
Skyler Turner3c940042022-05-10 21:20:12 +0100291 enable = true;
292 dbpath = "/tmp/mongodb";
293 };
294
Skyler Turner205aff12021-12-20 11:22:57 +0000295 fonts.fonts = with pkgs; [
296 nerdfonts
297 noto-fonts
298 noto-fonts-cjk
299 noto-fonts-emoji
300 liberation_ttf
301 fira-code
302 fira-code-symbols
303 mplus-outline-fonts
304 dina-font
305 proggyfonts
306 roboto
307 ];
308
309 # Some programs need SUID wrappers, can be configured further or are
310 # started in user sessions.
311 programs.mtr.enable = true;
Skyler Turnerf2a29ee2022-02-05 23:39:37 +0000312 programs.kdeconnect.enable = true;
Skyler Turner205aff12021-12-20 11:22:57 +0000313 programs.gnupg.agent = {
314 enable = true;
315 enableSSHSupport = true;
316 };
317
318 # List services that you want to enable:
319
320 # Enable the OpenSSH daemon.
321 services.openssh.enable = true;
322 services.keybase.enable = true;
Skyler Turnera6cfb632022-01-16 23:03:43 +0000323 services.kbfs.enable = true;
324 services.kbfs.enableRedirector = true;
Skyler Turnercde828a2022-02-02 09:41:56 +0000325 security.wrappers.keybase-redirector.owner = "root";
Skyler Turnera620ae92022-02-24 08:26:31 +0000326 security.wrappers.keybase-redirector.group = "users";
Skyler Turner205aff12021-12-20 11:22:57 +0000327 services.gnome.gnome-keyring.enable = true;
328 services.i2p.enable = true;
Skyler Turner87637252022-02-01 12:28:51 +0000329 services.tlp.enable = true;
Skyler Turner67c6fd82022-03-15 17:42:30 +0000330
Skyler Turner32dbfb42021-12-24 15:50:22 +0000331 virtualisation.docker.enable = true;
Skyler Turnerf2a29ee2022-02-05 23:39:37 +0000332 virtualisation.docker.enableOnBoot = false;
Skyler Turnere9893c92022-03-13 15:37:58 +0000333 virtualisation.libvirtd.enable = true;
334 virtualisation.libvirtd.onBoot = "ignore";
Skyler Turner205aff12021-12-20 11:22:57 +0000335
Skyler Turnerfff67b52022-02-08 21:29:33 +0000336 hardware.bluetooth.enable = true;
337
Skyler Turner5954aae2022-02-06 16:03:51 +0000338 environment.pathsToLink = [ "/share/zsh" "/libexec" ];
Skyler Turner1035c8c2022-02-05 23:43:34 +0000339
Skyler Turner98483702022-02-04 23:25:21 +0000340 virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
Skyler Turner2ee83f82022-02-04 23:18:51 +0000341 virtualisation.kvmgt.enable = true;
342
Skyler Turnerff2168b2022-01-16 16:19:50 +0000343 services.openvpn.servers = {
Skyler Turner3a7d7792022-01-16 16:23:50 +0000344 clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; };
Skyler Turnerff2168b2022-01-16 16:19:50 +0000345 };
346
Skyler Turnerdf40c9e2022-03-09 09:35:42 +0000347 environment.etc = {
348 "pam.d/swaylock" = {
Skyler Turnerbaa75622022-03-09 09:39:26 +0000349 mode = "0644";
Skyler Turnerdf40c9e2022-03-09 09:35:42 +0000350 text = ''
351 auth include login
352 '';
353 };
354 };
355
Skyler Turner4f5f11b2022-01-14 23:36:39 +0000356 nixpkgs.overlays = [
357 (self: super: {
358 polkit = super.polkit.overrideAttrs (oldAttrs: {
359 patches = oldAttrs.patches ++ [
360 (super.fetchpatch {
361 url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
362 sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
363 })];
364 });
365 })
366 ];
367
Skyler Turnerb0362522022-02-25 09:36:23 +0000368 xdg.mime.defaultApplications = {
369 "text/html" = "chromium-browser.desktop";
370 "x-scheme-handler/http" = "chromium-browser.desktop";
371 "x-scheme-handler/https" = "chromium-browser.desktop";
372 "x-scheme-handler/about" = "chromium-browser.desktop";
373 "x-scheme-handler/unknown" = "chromium-browser.desktop";
374 };
375
Skyler Turner95f68502022-02-25 09:57:21 +0000376 # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
Skyler Turnerb0362522022-02-25 09:36:23 +0000377
378
Skyler Turner95f68502022-02-25 09:57:21 +0000379 boot.supportedFilesystems = [ "kbfs" ];
380
Skyler Turner205aff12021-12-20 11:22:57 +0000381 # This value determines the NixOS release from which the default
382 # settings for stateful data, like file locations and database versions
383 # on your system were taken. It‘s perfectly fine and recommended to leave
384 # this value at the release version of the first install of this system.
385 # Before changing this value read the documentation for this option
386 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
387 system.stateVersion = "21.11"; # Did you read the comment?
388
389}
390