diff --git a/hosts/dumpyourvms/.config/sway/config.d/autostart.conf b/hosts/dumpyourvms/.config/sway/config.d/autostart.conf index 8ed35abb..626f2809 100644 --- a/hosts/dumpyourvms/.config/sway/config.d/autostart.conf +++ b/hosts/dumpyourvms/.config/sway/config.d/autostart.conf @@ -3,4 +3,4 @@ # Example: # exec swayidle -#exec qMasterPassword +exec qMasterPassword diff --git a/hosts/dumpyourvms/dumpyourvms.nix b/hosts/dumpyourvms/dumpyourvms.nix index c463a8cb..a30c80aa 100644 --- a/hosts/dumpyourvms/dumpyourvms.nix +++ b/hosts/dumpyourvms/dumpyourvms.nix @@ -19,8 +19,13 @@ in pub-solar.virtualisation.enable = true; # fix backlight for keyboard and brightness, adjust function key binding - boot.kernelParams = [ "acpi_backlight=video" "hid_apple.fnmode=2" "intel_pstate=active" ]; + boot.kernelParams = [ "acpi_backlight=video" "hid_apple.fnmode=2" "intel_pstate=passive" "resume_offset=47366144" ]; boot.loader.efi.canTouchEfiVariables = true; + boot.resumeDevice = "/dev/mapper/cryptroot"; + + systemd.sleep.extraConfig = '' + HibernateMode=shutdown + ''; hardware = { cpu.intel.updateMicrocode = true; @@ -33,18 +38,47 @@ in services.unbound = import ./unbound.nix; - # Radeon driver seems to work better than amdgpu with Radeon R9 M370X - services.xserver.videoDrivers = [ "radeon" ]; + # Disable dedicated GPU, use integrated Intel GPU to save battery + # Set default brightness to 50% + # https://ubuntuforums.org/showthread.php?t=2409856 + services.cron.systemCronJobs = [ + "@reboot root ${pkgs.util-linux}/bin/rfkill block bluetooth" + "@reboot root ${pkgs.coreutils}/bin/echo OFF > /sys/kernel/debug/vgaswitcheroo/switch" + "@reboot root ${pkgs.coreutils}/bin/echo 510 > /sys/class/backlight/gmux_backlight/brightness" + ]; + + # Increase console font size for HiDPI display + console = { + earlySetup = true; + font = lib.mkForce "ter-i32b"; + packages = [ pkgs.terminus_font ]; + }; # Thunderbolt tools services.hardware.bolt.enable = true; + powerManagement = { + # Use new schedutil govenor + # https://github.com/NixOS/nixpkgs/pull/42330 + # https://www.kernel.org/doc/html/v5.10/admin-guide/pm/cpufreq.html#schedutil + cpuFreqGovernor = lib.mkDefault "schedutil"; + + # brcmfmac being loaded during hibernation would inhibit a successful resume + # https://bugzilla.kernel.org/show_bug.cgi?id=101681#c116. + # Also brcmfmac could randomly crash on resume from sleep. + powerUpCommands = lib.mkBefore "${pkgs.kmod}/bin/modprobe brcmfmac"; + powerDownCommands = lib.mkBefore "${pkgs.kmod}/bin/rmmod brcmfmac"; + }; + + # change lid switch behaviour + #services.logind.lidSwitch = "hibernate"; + # TLP for power management services.tlp = { enable = true; settings = { CPU_SCALING_GOVERNOR_ON_AC = "performance"; - CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + CPU_SCALING_GOVERNOR_ON_BAT = "schedutil"; CPU_BOOST_ON_AC = 1; CPU_BOOST_ON_BAT = 0; }; @@ -53,8 +87,9 @@ in services.udev.extraRules = # Disable XHC1 wakeup signal to avoid resume getting triggered some time # after suspend. Reboot required for this to take effect. - ''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"''; - + lib.optionalString + (lib.versionAtLeast config.boot.kernelPackages.kernel.version "3.13") + ''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"''; services.printing.enable = true; services.printing.drivers = [ pkgs.brlaser ]; @@ -76,9 +111,12 @@ in # WLAN frequency compliance (e.g. check for radar with DFS) + # + # Radeon driver seems to work better than amdgpu with Radeon R9 M370X hardware.firmware = with pkgs; [ wireless-regdb ]; boot.extraModprobeConfig = '' options cfg80211 ieee80211_regdom="DE" + blacklist amdgpu ''; # This value determines the NixOS release from which the default diff --git a/hosts/dumpyourvms/hardware-configuration.nix b/hosts/dumpyourvms/hardware-configuration.nix index 74a32dbc..35334783 100644 --- a/hosts/dumpyourvms/hardware-configuration.nix +++ b/hosts/dumpyourvms/hardware-configuration.nix @@ -29,10 +29,13 @@ fsType = "vfat"; }; - swapDevices = - [{ device = "/dev/disk/by-uuid/02fa042f-7310-4be6-a615-524d5d7dc909"; }]; + swapDevices = [ + { + device = "/swapfile"; + size = 18432; + } + ]; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; # high-resolution display hardware.video.hidpi.enable = lib.mkDefault true; } diff --git a/hosts/dumpyourvms/networking.nix b/hosts/dumpyourvms/networking.nix index 332b45cb..28a6601f 100644 --- a/hosts/dumpyourvms/networking.nix +++ b/hosts/dumpyourvms/networking.nix @@ -13,6 +13,8 @@ "10.0.1.202" = [ "cn02.lev-1" ]; "10.0.1.203" = [ "cn03.lev-1" ]; "10.0.1.204" = [ "cn04.lev-1" ]; + "10.0.1.205" = [ "cn05.lev-1" ]; + "10.0.1.206" = [ "cn00.lev-1" ]; }; wireguard.enable = true; diff --git a/hosts/dumpyourvms/unbound.nix b/hosts/dumpyourvms/unbound.nix index 6006efe0..43e16aba 100644 --- a/hosts/dumpyourvms/unbound.nix +++ b/hosts/dumpyourvms/unbound.nix @@ -19,7 +19,7 @@ # fritz.box stub zone stub-zone = { name = "fritz.box"; - stub-addr = "192.168.178.1"; + stub-addr = "192.168.13.1"; }; # DNS over DLS forwarding