From c147db7c59bddd0d6ca07451c71b45e334e621d9 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Mon, 20 Sep 2021 11:40:49 +0200 Subject: [PATCH] host: Enable earlyoom --- hosts/miku.nix | 6 ++---- modules/host.nix | 6 ++++++ packages/default.nix | 18 +++++++++++++++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/hosts/miku.nix b/hosts/miku.nix index 20efc2a..e318007 100644 --- a/hosts/miku.nix +++ b/hosts/miku.nix @@ -44,6 +44,7 @@ in mkHost config { piper anime-dl trackma unstable.thunderbird + multimc-wrapped ]; extraOptions = old: { programs = { @@ -51,10 +52,6 @@ in mkHost config { adb.enable = true; }; - # TODO: Move to virtualisation/gaming.nix - # Allow scream to connect to this host - networking.firewall.allowedUDPPorts = [ 4010 ]; - boot = { extraModprobeConfig = '' options kvm_amd nested=1 @@ -91,6 +88,7 @@ in mkHost config { connman.extraConfig = '' WriteResolvConf=false ''; + udev.packages = with pkgs; [ key-mapper ]; }; security = { diff --git a/modules/host.nix b/modules/host.nix index e3437c8..1b58365 100644 --- a/modules/host.nix +++ b/modules/host.nix @@ -175,6 +175,12 @@ let # For debugging. # TODO: Lock to known IPs and keys sshd.enable = true; + + # Prevent unexpected OOM situations with heavy swapping + earlyoom = { + enable = true; + enableNotifications = true; + }; }; # Don't wait for a network connection diff --git a/packages/default.nix b/packages/default.nix index f33d355..6859276 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -8,6 +8,8 @@ let # Wayland # NOTE: electron under Wayland has no window titlebars #extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland"; + #extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer"; + #extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer"; }; wrapInSandbox = pkgs.callPackage ./sandbox.nix {}; in { @@ -39,7 +41,7 @@ in { name = "discord"; package = discord-system-electron; binaryName = "discord"; - mountInHome = [ ".config/discord" ]; + mountInHome = [ ".config/discord" ".config/BetterDiscord" ]; additionalBlacklist = [ "/mnt" ]; chdirTo = "/home/$USER"; @@ -55,11 +57,25 @@ in { }; }; + sddm-sugar-dark = pkgs.callPackage ./sddm-sugar-dark {}; + iptsd = pkgs.callPackage ./tools/daemons/iptsd {}; surface-control = pkgs.callPackage ./tools/system/surface-control {}; trackma = pkgs.callPackage ./tools/video/trackma {}; + multimc-wrapped = wrapInSandbox { + name = "multimc"; + package = pkgs.multimc; + binaryName = "multimc"; + mountInHome = [ ".local/share/multimc" ]; + additionalBlacklist = [ "/mnt" ]; + chdirTo = "/home/$USER"; + extraEnv = { + DRI_PRIME = "1"; + }; + }; + steam-wrapped = wrapInSandbox { name = "steam"; package = pkgs.steam;