blob: 1532a9fea9bae84a55354ac303567044fddd540e [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 Turner205aff12021-12-20 11:22:57 +000034 # Enable apparmor
35 security.apparmor.enable = true;
36 security.apparmor.killUnconfinedConfinables = true;
37
38 # Set your time zone.
39 time.timeZone = "Europe/London";
40
41 # Select internationalisation properties.
42 i18n.defaultLocale = "en_US.UTF-8";
43 console = {
44 font = "Lat2-Terminus16";
45 keyMap = "uk";
46 };
47
48 # Enable the X11 windowing system.
49 services.xserver = {
50 enable = true;
51 desktopManager = {
52 xterm.enable = false;
53 # xfce.enable = true;
54 };
Skyler Turner27ee4cb2022-03-06 22:29:09 +000055 displayManager.startx.enable = true;
56 # displayManager.sddm.enable = true;
Skyler Turner205aff12021-12-20 11:22:57 +000057 };
58
Skyler Turner072db1e2022-02-27 01:01:59 +000059 services = {
60 syncthing = {
61 enable = true;
62 user = "minion";
63 dataDir = "/home/minion/Documents"; # Default folder for new synced folders
64 configDir = "/home/minion/.config/syncthing"; # Folder for Syncthing's settings and keys
65 };
66 };
67
Skyler Turner205aff12021-12-20 11:22:57 +000068 # And wayland
Skyler Turner27ee4cb2022-03-06 22:29:09 +000069/* programs.sway = {
Skyler Turner205aff12021-12-20 11:22:57 +000070 enable = true;
71 wrapperFeatures.gtk = true; # so that gtk works properly
72 extraPackages = with pkgs; [
73 swaylock
74 swayidle
75 wl-clipboard
76 mako # notification daemon
77 alacritty # Alacritty is the default terminal in the config
Skyler Turner205aff12021-12-20 11:22:57 +000078 ];
Skyler Turner27ee4cb2022-03-06 22:29:09 +000079 };*/
Skyler Turner205aff12021-12-20 11:22:57 +000080
Skyler Turner98617fd2022-04-05 21:56:26 +010081 programs.qt5ct = {
82 enable = true;
83 };
Skyler Turner27ee4cb2022-03-06 22:29:09 +000084# programs.waybar.enable = false; # true;
Skyler Turnere24f21c2022-02-06 16:02:53 +000085
Skyler Turner205aff12021-12-20 11:22:57 +000086 # Get screensharing to work
87 xdg = {
88 portal = {
89 enable = true;
90 extraPortals = with pkgs; [
91 xdg-desktop-portal-wlr
Skyler Turnere8b7af22022-03-21 00:05:17 +000092# xdg-desktop-portal-gtk
93# xdg-desktop-portal-kde
Skyler Turner205aff12021-12-20 11:22:57 +000094 ];
Skyler Turnere8b7af22022-03-21 00:05:17 +000095# gtkUsePortal = true;
Skyler Turner84ec77c2022-01-14 09:05:57 +000096 wlr.enable = true;
97
Skyler Turner205aff12021-12-20 11:22:57 +000098 };
99 };
100
Skyler Turner69ca44c2022-03-09 06:56:20 +0000101 systemd.user.services.xdg-desktop-portal = {
102 unitConfig = {
103 After = "graphical-session.target";
104 };
105 };
106
Skyler Turner205aff12021-12-20 11:22:57 +0000107 # Configure keymap in X11
108 services.xserver.layout = "gb";
109 # services.xserver.xkbOptions = "eurosign:e";
Skyler Turner55c8ee82022-03-08 19:22:16 +0000110 services.upower.enable = true;
Skyler Turner205aff12021-12-20 11:22:57 +0000111
112 # Permit and install steam
113 nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
114 "steam"
115 "steam-original"
116 "steam-runtime"
117 ];
118
119 programs.steam.enable = true;
120
121
122 # Enable CUPS to print documents.
123 services.printing.enable = true;
124
125 # Enable sound.
126 sound.enable = true;
127 hardware.pulseaudio.enable = false;
128 services.pipewire = {
129 enable = true;
130 alsa = {
131 enable = true;
132 support32Bit = true;
133 };
134 pulse.enable = true;
Skyler Turner4ca71fb2022-02-20 11:12:22 +0000135 /*config.pipewire = {
Skyler Turner074765b2022-02-20 10:46:58 +0000136 "context.modules" = [
Skyler Turner2f6b3ed2022-02-19 14:37:14 +0000137 {
Skyler Turner074765b2022-02-20 10:46:58 +0000138 name = "libpipewire-module-filter-chain";
139 args = {
140 "node.name" = "effect_output.virtual-surround-7.1-hesuvi";
141 "node.description" = "Virtual Surround Sink";
142 "media.name" = "Virtual Surround Sink";
143 nodes = [
144 # duplicate inputs
145 { type = "builtin"; label = "copy"; name = "copyFL"; }
146 { type = "builtin"; label = "copy"; name = "copyFR"; }
147 { type = "builtin"; label = "copy"; name = "copyFC"; }
148 { type = "builtin"; label = "copy"; name = "copyRL"; }
149 { type = "builtin"; label = "copy"; name = "copyRR"; }
150 { type = "builtin"; label = "copy"; name = "copySL"; }
151 { type = "builtin"; label = "copy"; name = "copySR"; }
152 { type = "builtin"; label = "copy"; name = "copyLFE"; }
153
Skyler Turner4ca71fb2022-02-20 11:12:22 +0000154 # 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 +0000155 { type = "builtin"; label = "convolver"; name = "convFL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 0; }; }
156 { type = "builtin"; label = "convolver"; name = "convFL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 1; }; }
157 { type = "builtin"; label = "convolver"; name = "convSL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 2; }; }
158 { type = "builtin"; label = "convolver"; name = "convSL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 3; }; }
159 { type = "builtin"; label = "convolver"; name = "convRL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 4; }; }
160 { type = "builtin"; label = "convolver"; name = "convRL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 5; }; }
161 { type = "builtin"; label = "convolver"; name = "convFC_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
162 { type = "builtin"; label = "convolver"; name = "convFR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 7; }; }
163 { type = "builtin"; label = "convolver"; name = "convFR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 8; }; }
164 { type = "builtin"; label = "convolver"; name = "convSR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 9; }; }
165 { type = "builtin"; label = "convolver"; name = "convSR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 10; }; }
166 { type = "builtin"; label = "convolver"; name = "convRR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 11; }; }
167 { type = "builtin"; label = "convolver"; name = "convRR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 12; }; }
168 { type = "builtin"; label = "convolver"; name = "convFC_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
169
170 # treat LFE as FC
171 { type = "builtin"; label = "convolver"; name = "convLFE_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
172 { type = "builtin"; label = "convolver"; name = "convLFE_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
173
174 # stereo output
175 { type = "builtin"; label = "mixer"; name = "mixR"; }
176 { type = "builtin"; label = "mixer"; name = "mixL"; }
177 ];
178 links = [
179 # input
180 { output = "copyFL:Out"; input="convFL_L:In"; }
181 { output = "copyFL:Out"; input="convFL_R:In"; }
182 { output = "copySL:Out"; input="convSL_L:In"; }
183 { output = "copySL:Out"; input="convSL_R:In"; }
184 { output = "copyRL:Out"; input="convRL_L:In"; }
185 { output = "copyRL:Out"; input="convRL_R:In"; }
186 { output = "copyFC:Out"; input="convFC_L:In"; }
187 { output = "copyFR:Out"; input="convFR_R:In"; }
188 { output = "copyFR:Out"; input="convFR_L:In"; }
189 { output = "copySR:Out"; input="convSR_R:In"; }
190 { output = "copySR:Out"; input="convSR_L:In"; }
191 { output = "copyRR:Out"; input="convRR_R:In"; }
192 { output = "copyRR:Out"; input="convRR_L:In"; }
193 { output = "copyFC:Out"; input="convFC_R:In"; }
194 { output = "copyLFE:Out"; input="convLFE_L:In"; }
195 { output = "copyLFE:Out"; input="convLFE_R:In"; }
196
197 # output
198 { output = "convFL_L:Out"; input="mixL:In 1"; }
199 { output = "convFL_R:Out"; input="mixR:In 1"; }
200 { output = "convSL_L:Out"; input="mixL:In 2"; }
201 { output = "convSL_R:Out"; input="mixR:In 2"; }
202 { output = "convRL_L:Out"; input="mixL:In 3"; }
203 { output = "convRL_R:Out"; input="mixR:In 3"; }
204 { output = "convFC_L:Out"; input="mixL:In 4"; }
205 { output = "convFC_R:Out"; input="mixR:In 4"; }
206 { output = "convFR_R:Out"; input="mixR:In 5"; }
207 { output = "convFR_L:Out"; input="mixL:In 5"; }
208 { output = "convSR_R:Out"; input="mixR:In 6"; }
209 { output = "convSR_L:Out"; input="mixL:In 6"; }
210 { output = "convRR_R:Out"; input="mixR:In 7"; }
211 { output = "convRR_L:Out"; input="mixL:In 7"; }
212 { output = "convLFE_R:Out"; input="mixR:In 8"; }
213 { output = "convLFE_L:Out"; input="mixL:In 8"; }
214 ];
215 inputs = [ "copyFL:In" "copyFR:In" "copyFC:In" "copyLFE:In" "copyRL:In" "copyRR:In" "copySL:In" "copySR:In" ];
216 outputs = [ "mixL:Out" "mixR:Out" ];
217 };
218 "capture.props" = {
219 "media.class" = "Audio/Sink";
220 "audio.channels" = 8;
221 "audio.position" = [ "FL" "FR" "FC" "LFE" "RL" "RR" "SL" "SR" ];
222 };
223 "playback.props" = {
224 "node.passive" = true;
225 "audio.channels" = 2;
226 "audio.position" = [ "FL" "FR" ];
227 };
Skyler Turner2f6b3ed2022-02-19 14:37:14 +0000228 }
229 ];
Skyler Turner4ca71fb2022-02-20 11:12:22 +0000230 };*/
Skyler Turner205aff12021-12-20 11:22:57 +0000231 };
Skyler Turner2f6b3ed2022-02-19 14:37:14 +0000232 environment.etc."pipewire/7.1-surround-sound.conf".source = ./pipewire/7.1-surround-sound.conf;
Skyler Turner205aff12021-12-20 11:22:57 +0000233
Skyler Turner716da2d2022-02-20 20:40:02 +0000234 hardware.openrazer.enable = true;
235 hardware.openrazer.users = [ "minion" ];
236
Skyler Turner0bb4f842022-04-05 20:27:22 +0100237 hardware.steam-hardware.enable = true;
238
Skyler Turner205aff12021-12-20 11:22:57 +0000239 # Enable touchpad support (enabled default in most desktopManager).
240 services.xserver.libinput.enable = true;
241
Skyler Turnerbe543712022-03-08 19:21:06 +0000242 programs.dconf.enable = true;
Skyler Turner7145c2d2022-03-08 19:19:10 +0000243
Skyler Turner205aff12021-12-20 11:22:57 +0000244 # Define a user account. Don't forget to set a password with ‘passwd’.
245 users.users.minion = {
246 isNormalUser = true;
Skyler Turnere9893c92022-03-13 15:37:58 +0000247 extraGroups = [ "wheel" "kvm" "docker" "containerd" "dialout" "libvirtd" ]; # Enable ‘sudo’ for the user.
Skyler Turner7fe8a242022-02-06 00:42:28 +0000248 shell = pkgs.zsh;
Skyler Turner205aff12021-12-20 11:22:57 +0000249 };
250
Skyler Turnerb8f440b2022-04-05 22:18:44 +0100251 programs.zsh.enable = true;
Skyler Turner36ed4592022-04-05 22:15:02 +0100252
Skyler Turner205aff12021-12-20 11:22:57 +0000253 # List packages installed in system profile. To search, run:
254 # $ nix search wget
Skyler Turnera3ab14b2022-01-24 11:37:41 +0000255 environment.systemPackages = with pkgs; [
Skyler Turner205aff12021-12-20 11:22:57 +0000256 vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
257 ((emacsPackagesNgGen emacs).emacsWithPackages (epkgs: [
258 epkgs.vterm
259 epkgs.emacsql-sqlite
260 ])) # Emacs + vterm-module (needed for vterm)
261 wget
262 firefox
263 chromium # Install chromium if needed
264 texlive.combined.scheme-full
Skyler Turner205aff12021-12-20 11:22:57 +0000265 keybase-gui
Skyler Turneree73be42022-01-10 11:02:46 +0000266 bluez
Skyler Turner1a7d0b42022-01-18 10:27:32 +0000267 macchanger
Skyler Turnerb4541be2022-01-21 19:38:55 +0000268 comic-relief
Skyler Turnerb408dcf2022-02-04 23:48:08 +0000269 qemu_kvm
Skyler Turner5954aae2022-02-06 16:03:51 +0000270 polkit_gnome
Skyler Turner785a8a62022-02-06 16:12:59 +0000271 gtk-engine-murrine
272 gtk_engines
273 gsettings-desktop-schemas
274 lxappearance
Skyler Turner98617fd2022-04-05 21:56:26 +0100275 libsForQt5.qt5.qtwayland
Skyler Turnerbfe0f542022-02-06 21:45:00 +0000276 ] ++ (import ./containerd/systemPackages.nix pkgs).systemPackages;
Skyler Turner205aff12021-12-20 11:22:57 +0000277
278# environment.systemPackages = [
279# import /scripts/jetbrains.rider.nix
280# ];
281
Skyler Turner3c940042022-05-10 21:20:12 +0100282 services.mongodb = {
Skyler Turnerd80e68e2022-05-10 22:43:00 +0100283 package = pkgs.mongodb-4_2;
Skyler Turner3c940042022-05-10 21:20:12 +0100284 enable = true;
285 dbpath = "/tmp/mongodb";
286 };
287
Skyler Turner205aff12021-12-20 11:22:57 +0000288 fonts.fonts = with pkgs; [
289 nerdfonts
290 noto-fonts
291 noto-fonts-cjk
292 noto-fonts-emoji
293 liberation_ttf
294 fira-code
295 fira-code-symbols
296 mplus-outline-fonts
297 dina-font
298 proggyfonts
299 roboto
300 ];
301
302 # Some programs need SUID wrappers, can be configured further or are
303 # started in user sessions.
304 programs.mtr.enable = true;
Skyler Turnerf2a29ee2022-02-05 23:39:37 +0000305 programs.kdeconnect.enable = true;
Skyler Turner205aff12021-12-20 11:22:57 +0000306 programs.gnupg.agent = {
307 enable = true;
308 enableSSHSupport = true;
309 };
310
311 # List services that you want to enable:
312
313 # Enable the OpenSSH daemon.
314 services.openssh.enable = true;
315 services.keybase.enable = true;
Skyler Turnera6cfb632022-01-16 23:03:43 +0000316 services.kbfs.enable = true;
317 services.kbfs.enableRedirector = true;
Skyler Turnercde828a2022-02-02 09:41:56 +0000318 security.wrappers.keybase-redirector.owner = "root";
Skyler Turnera620ae92022-02-24 08:26:31 +0000319 security.wrappers.keybase-redirector.group = "users";
Skyler Turner205aff12021-12-20 11:22:57 +0000320 services.gnome.gnome-keyring.enable = true;
321 services.i2p.enable = true;
Skyler Turner87637252022-02-01 12:28:51 +0000322 services.tlp.enable = true;
Skyler Turner67c6fd82022-03-15 17:42:30 +0000323
Skyler Turner32dbfb42021-12-24 15:50:22 +0000324 virtualisation.docker.enable = true;
Skyler Turnerf2a29ee2022-02-05 23:39:37 +0000325 virtualisation.docker.enableOnBoot = false;
Skyler Turnere9893c92022-03-13 15:37:58 +0000326 virtualisation.libvirtd.enable = true;
327 virtualisation.libvirtd.onBoot = "ignore";
Skyler Turner205aff12021-12-20 11:22:57 +0000328
Skyler Turnerfff67b52022-02-08 21:29:33 +0000329 hardware.bluetooth.enable = true;
330
Skyler Turner5954aae2022-02-06 16:03:51 +0000331 environment.pathsToLink = [ "/share/zsh" "/libexec" ];
Skyler Turner1035c8c2022-02-05 23:43:34 +0000332
Skyler Turner98483702022-02-04 23:25:21 +0000333 virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
Skyler Turner2ee83f82022-02-04 23:18:51 +0000334 virtualisation.kvmgt.enable = true;
335
Skyler Turnerff2168b2022-01-16 16:19:50 +0000336 services.openvpn.servers = {
Skyler Turner3a7d7792022-01-16 16:23:50 +0000337 clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; };
Skyler Turnerff2168b2022-01-16 16:19:50 +0000338 };
339
Skyler Turnerdf40c9e2022-03-09 09:35:42 +0000340 environment.etc = {
341 "pam.d/swaylock" = {
Skyler Turnerbaa75622022-03-09 09:39:26 +0000342 mode = "0644";
Skyler Turnerdf40c9e2022-03-09 09:35:42 +0000343 text = ''
344 auth include login
345 '';
346 };
347 };
348
Skyler Turner4f5f11b2022-01-14 23:36:39 +0000349 nixpkgs.overlays = [
350 (self: super: {
351 polkit = super.polkit.overrideAttrs (oldAttrs: {
352 patches = oldAttrs.patches ++ [
353 (super.fetchpatch {
354 url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
355 sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
356 })];
357 });
358 })
359 ];
360
Skyler Turnerb0362522022-02-25 09:36:23 +0000361 xdg.mime.defaultApplications = {
362 "text/html" = "chromium-browser.desktop";
363 "x-scheme-handler/http" = "chromium-browser.desktop";
364 "x-scheme-handler/https" = "chromium-browser.desktop";
365 "x-scheme-handler/about" = "chromium-browser.desktop";
366 "x-scheme-handler/unknown" = "chromium-browser.desktop";
367 };
368
Skyler Turner95f68502022-02-25 09:57:21 +0000369 # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
Skyler Turnerb0362522022-02-25 09:36:23 +0000370
371
Skyler Turner95f68502022-02-25 09:57:21 +0000372 boot.supportedFilesystems = [ "kbfs" ];
373
Skyler Turner205aff12021-12-20 11:22:57 +0000374 # This value determines the NixOS release from which the default
375 # settings for stateful data, like file locations and database versions
376 # on your system were taken. It‘s perfectly fine and recommended to leave
377 # this value at the release version of the first install of this system.
378 # Before changing this value read the documentation for this option
379 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
380 system.stateVersion = "21.11"; # Did you read the comment?
381
382}
383