Final commit; switching to new branch
diff --git a/.history/system/configuration_20220309093530.nix b/.history/system/configuration_20220309093530.nix
new file mode 100644
index 0000000..cae4bbf
--- /dev/null
+++ b/.history/system/configuration_20220309093530.nix
@@ -0,0 +1,364 @@
+# Edit this configuration file to define what should be installed on
+# your system.  Help is available in the configuration.nix(5) man page
+# and in the NixOS manual (accessible by running ‘nixos-help’).
+
+{ config, pkgs, lib, ... }:
+
+{
+  imports =
+    [ # Include the results of the hardware scan.
+      ./hardware-configuration.nix
+      ../secrets/networking-configuration.nix
+      ./packaging-configuration.nix
+      ./containerd/containerd.nix
+    ];
+
+  # Prepare nix flakes
+  nix = {
+    package = pkgs.nixFlakes;
+    extraOptions = ''
+      experimental-features = nix-command flakes
+    '';
+  };
+
+  # Use the systemd-boot EFI boot loader.
+  boot.loader.systemd-boot.enable = true;
+  boot.loader.efi.canTouchEfiVariables = true;
+  boot.loader.grub.useOSProber = true;
+
+  # Enable emulated systems
+  boot.binfmt.emulatedSystems = [ "aarch64-linux" "armv6l-linux" ];
+
+  # Enable apparmor
+  security.apparmor.enable = true;
+  security.apparmor.killUnconfinedConfinables = true;
+
+  # Set your time zone.
+  time.timeZone = "Europe/London";
+
+  # Select internationalisation properties.
+  i18n.defaultLocale = "en_US.UTF-8";
+  console = {
+    font = "Lat2-Terminus16";
+    keyMap = "uk";
+  };
+
+  # Enable the X11 windowing system.
+  services.xserver = {
+    enable = true;
+    desktopManager = {
+      xterm.enable = false;
+      # xfce.enable = true;
+    };
+    displayManager.startx.enable = true;
+    # displayManager.sddm.enable = true;
+  };
+
+  services = {
+    syncthing = {
+        enable = true;
+        user = "minion";
+        dataDir = "/home/minion/Documents";    # Default folder for new synced folders
+        configDir = "/home/minion/.config/syncthing";   # Folder for Syncthing's settings and keys
+    };
+  };
+
+  # And wayland
+/*  programs.sway = {
+    enable = true;
+    wrapperFeatures.gtk = true; # so that gtk works properly
+    extraPackages = with pkgs; [
+      swaylock
+      swayidle
+      wl-clipboard
+      mako # notification daemon
+      alacritty # Alacritty is the default terminal in the config
+    ];
+  };*/
+
+  programs.qt5ct.enable = true;
+#  programs.waybar.enable = false; # true;
+
+  # Get screensharing to work
+  xdg = {
+    portal = {
+      enable = true;
+      extraPortals = with pkgs; [
+        xdg-desktop-portal-wlr
+        xdg-desktop-portal-gtk
+      ];
+      gtkUsePortal = true;
+      wlr.enable = true;
+      
+    };
+  };
+
+  systemd.user.services.xdg-desktop-portal = {
+    unitConfig = {
+      After = "graphical-session.target";
+    };
+  };
+
+  # Configure keymap in X11
+  services.xserver.layout = "gb";
+  # services.xserver.xkbOptions = "eurosign:e";
+  services.upower.enable = true;
+
+  # Permit and install steam
+  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
+    "steam"
+    "steam-original"
+    "steam-runtime"
+  ];
+
+  programs.steam.enable = true;
+
+
+  # Enable CUPS to print documents.
+  services.printing.enable = true;
+
+  # Enable sound.
+  sound.enable = true;
+  hardware.pulseaudio.enable = false;
+  services.pipewire = {
+    enable = true;
+    alsa = {
+      enable = true;
+      support32Bit = true;
+    };
+    pulse.enable = true;
+    /*config.pipewire = {
+      "context.modules" = [
+        {
+          name = "libpipewire-module-filter-chain";
+          args = {
+            "node.name"        = "effect_output.virtual-surround-7.1-hesuvi";
+            "node.description" = "Virtual Surround Sink";
+            "media.name"       = "Virtual Surround Sink";
+            nodes = [
+              # duplicate inputs
+              { type = "builtin"; label = "copy"; name = "copyFL";  }
+              { type = "builtin"; label = "copy"; name = "copyFR";  }
+              { type = "builtin"; label = "copy"; name = "copyFC";  }
+              { type = "builtin"; label = "copy"; name = "copyRL";  }
+              { type = "builtin"; label = "copy"; name = "copyRR";  }
+              { type = "builtin"; label = "copy"; name = "copySL";  }
+              { type = "builtin"; label = "copy"; name = "copySR";  }
+              { type = "builtin"; label = "copy"; name = "copyLFE"; }
+
+              # apply hrir - HeSuVi 14-channel WAV (not the *-.wav variants) (note: 44 in HeSuVi are the same, but resampled to 44100)
+              { type = "builtin"; label = "convolver"; name = "convFL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  0; }; }
+              { type = "builtin"; label = "convolver"; name = "convFL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  1; }; }
+              { type = "builtin"; label = "convolver"; name = "convSL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  2; }; }
+              { type = "builtin"; label = "convolver"; name = "convSL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  3; }; }
+              { type = "builtin"; label = "convolver"; name = "convRL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  4; }; }
+              { type = "builtin"; label = "convolver"; name = "convRL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  5; }; }
+              { type = "builtin"; label = "convolver"; name = "convFC_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  6; }; }
+              { type = "builtin"; label = "convolver"; name = "convFR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  7; }; }
+              { type = "builtin"; label = "convolver"; name = "convFR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  8; }; }
+              { type = "builtin"; label = "convolver"; name = "convSR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  9; }; }
+              { type = "builtin"; label = "convolver"; name = "convSR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 10; }; }
+              { type = "builtin"; label = "convolver"; name = "convRR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 11; }; }
+              { type = "builtin"; label = "convolver"; name = "convRR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 12; }; }
+              { type = "builtin"; label = "convolver"; name = "convFC_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
+
+              # treat LFE as FC
+              { type = "builtin"; label = "convolver"; name = "convLFE_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
+              { type = "builtin"; label = "convolver"; name = "convLFE_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel =  6; }; }
+
+              # stereo output
+              { type = "builtin"; label = "mixer"; name = "mixR"; }
+              { type = "builtin"; label = "mixer"; name = "mixL"; }
+            ];
+            links = [
+              # input
+              { output = "copyFL:Out";  input="convFL_L:In";  }
+              { output = "copyFL:Out";  input="convFL_R:In";  }
+              { output = "copySL:Out";  input="convSL_L:In";  }
+              { output = "copySL:Out";  input="convSL_R:In";  }
+              { output = "copyRL:Out";  input="convRL_L:In";  }
+              { output = "copyRL:Out";  input="convRL_R:In";  }
+              { output = "copyFC:Out";  input="convFC_L:In";  }
+              { output = "copyFR:Out";  input="convFR_R:In";  }
+              { output = "copyFR:Out";  input="convFR_L:In";  }
+              { output = "copySR:Out";  input="convSR_R:In";  }
+              { output = "copySR:Out";  input="convSR_L:In";  }
+              { output = "copyRR:Out";  input="convRR_R:In";  }
+              { output = "copyRR:Out";  input="convRR_L:In";  }
+              { output = "copyFC:Out";  input="convFC_R:In";  }
+              { output = "copyLFE:Out"; input="convLFE_L:In"; }
+              { output = "copyLFE:Out"; input="convLFE_R:In"; }
+
+              # output
+              { output = "convFL_L:Out";  input="mixL:In 1"; }
+              { output = "convFL_R:Out";  input="mixR:In 1"; }
+              { output = "convSL_L:Out";  input="mixL:In 2"; }
+              { output = "convSL_R:Out";  input="mixR:In 2"; }
+              { output = "convRL_L:Out";  input="mixL:In 3"; }
+              { output = "convRL_R:Out";  input="mixR:In 3"; }
+              { output = "convFC_L:Out";  input="mixL:In 4"; }
+              { output = "convFC_R:Out";  input="mixR:In 4"; }
+              { output = "convFR_R:Out";  input="mixR:In 5"; }
+              { output = "convFR_L:Out";  input="mixL:In 5"; }
+              { output = "convSR_R:Out";  input="mixR:In 6"; }
+              { output = "convSR_L:Out";  input="mixL:In 6"; }
+              { output = "convRR_R:Out";  input="mixR:In 7"; }
+              { output = "convRR_L:Out";  input="mixL:In 7"; }
+              { output = "convLFE_R:Out"; input="mixR:In 8"; }
+              { output = "convLFE_L:Out"; input="mixL:In 8"; }
+            ];
+            inputs  = [ "copyFL:In" "copyFR:In" "copyFC:In" "copyLFE:In" "copyRL:In" "copyRR:In" "copySL:In" "copySR:In" ];
+            outputs = [ "mixL:Out" "mixR:Out" ];
+          };
+          "capture.props" = {
+              "media.class"    = "Audio/Sink";
+              "audio.channels" = 8;
+              "audio.position" = [ "FL" "FR" "FC" "LFE" "RL" "RR" "SL" "SR" ];
+          };
+          "playback.props" = {
+              "node.passive"   = true;
+              "audio.channels" = 2;
+              "audio.position" = [ "FL" "FR" ];
+          };
+        }
+      ];
+    };*/
+  };
+  environment.etc."pipewire/7.1-surround-sound.conf".source = ./pipewire/7.1-surround-sound.conf;
+
+  hardware.openrazer.enable = true;
+  hardware.openrazer.users = [ "minion" ];
+
+  # Enable touchpad support (enabled default in most desktopManager).
+  services.xserver.libinput.enable = true;
+
+  programs.dconf.enable = true;
+
+  # Define a user account. Don't forget to set a password with ‘passwd’.
+  users.users.minion = {
+    isNormalUser = true;
+    extraGroups = [ "wheel" "kvm" "docker" "containerd" "dialout" ]; # Enable ‘sudo’ for the user.
+    shell = pkgs.zsh;
+  };
+
+  # List packages installed in system profile. To search, run:
+  # $ nix search wget
+  environment.systemPackages = with pkgs; [
+    vim  # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
+    ((emacsPackagesNgGen emacs).emacsWithPackages (epkgs: [
+      epkgs.vterm
+      epkgs.emacsql-sqlite
+    ]))  # Emacs + vterm-module (needed for vterm)
+    wget
+    firefox
+    chromium  # Install chromium if needed
+    texlive.combined.scheme-full
+    keybase-gui
+    bluez
+    macchanger
+    comic-relief
+    qemu_kvm
+    polkit_gnome
+    gtk-engine-murrine
+    gtk_engines
+    gsettings-desktop-schemas
+    lxappearance
+  ] ++ (import ./containerd/systemPackages.nix pkgs).systemPackages;
+
+#  environment.systemPackages = [
+#    import /scripts/jetbrains.rider.nix
+#  ];
+
+  fonts.fonts = with pkgs; [
+    nerdfonts
+    noto-fonts
+    noto-fonts-cjk
+    noto-fonts-emoji
+    liberation_ttf
+    fira-code
+    fira-code-symbols
+    mplus-outline-fonts
+    dina-font
+    proggyfonts
+    roboto
+  ];
+
+  # Some programs need SUID wrappers, can be configured further or are
+  # started in user sessions.
+  programs.mtr.enable = true;
+  programs.kdeconnect.enable = true;
+  programs.gnupg.agent = {
+    enable = true;
+    enableSSHSupport = true;
+  };
+
+  # List services that you want to enable:
+
+  # Enable the OpenSSH daemon.
+  services.openssh.enable = true;
+  services.keybase.enable = true;
+  services.kbfs.enable = true;
+  services.kbfs.enableRedirector = true;
+  security.wrappers.keybase-redirector.owner = "root";
+  security.wrappers.keybase-redirector.group = "users";
+  services.gnome.gnome-keyring.enable = true;
+  services.i2p.enable = true;
+  services.tlp.enable = true;
+  virtualisation.docker.enable = true;
+  virtualisation.docker.enableOnBoot = false;
+
+  hardware.bluetooth.enable = true;
+
+  environment.pathsToLink = [ "/share/zsh" "/libexec" ];
+
+  virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
+  virtualisation.kvmgt.enable = true;
+
+  services.openvpn.servers = {
+    clicks = { config = '' config /home/minion/Nix/secrets/clicks/client.ovpn ''; };
+  };
+
+  environment.etc = {
+    "pam.d/swaylock" = {
+      mode = "0777";
+      text = ''
+        auth include login
+      '';
+    };
+  };
+
+  nixpkgs.overlays = [
+    (self: super: {
+      polkit = super.polkit.overrideAttrs (oldAttrs: {
+        patches = oldAttrs.patches ++ [
+          (super.fetchpatch {
+            url = "https://gitlab.freedesktop.org/polkit/polkit/-/commit/716a273ce0af467968057f3e107156182bd290b0.patch";
+            sha256 = "sha256-hOJJhUmxXm87W1ZU9Y1NJ8GCyKvPjbIVtCHlhRGlN8k=";
+          })];
+      });
+    })
+  ];
+
+  xdg.mime.defaultApplications = {
+    "text/html" = "chromium-browser.desktop";
+    "x-scheme-handler/http" = "chromium-browser.desktop";
+    "x-scheme-handler/https" = "chromium-browser.desktop";
+    "x-scheme-handler/about" = "chromium-browser.desktop";
+    "x-scheme-handler/unknown" = "chromium-browser.desktop";
+  };
+
+  # environment.sessionsVariables.DEFAULT_BROWSER = "${pkgs.chromium}/bin/chromium";
+
+
+  boot.supportedFilesystems = [ "kbfs" ];
+
+  # This value determines the NixOS release from which the default
+  # settings for stateful data, like file locations and database versions
+  # on your system were taken. It‘s perfectly fine and recommended to leave
+  # this value at the release version of the first install of this system.
+  # Before changing this value read the documentation for this option
+  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
+  system.stateVersion = "21.11"; # Did you read the comment?
+
+}
+