diff --git a/SwarselSystems.org b/SwarselSystems.org index 5f8b289..daa4232 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -1988,8 +1988,8 @@ My work machine. Built for more security, this is the gold standard of my config # ''; boot = { - # kernelPackages = lib.mkDefault pkgs.kernel.linuxPackages; - kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + kernelPackages = lib.mkDefault pkgs.kernel.linuxPackages; + # kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; binfmt.emulatedSystems = [ "aarch64-linux" ]; initrd = { availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "cryptd" "usbhid" "sd_mod" "r8152" ]; @@ -2005,7 +2005,8 @@ My work machine. Built for more security, this is the gold standard of my config kernelModules = [ "kvm-amd" ]; kernelParams = [ - "mem_sleep_default=deep" + # deep sleep is discontinued by amd + # "mem_sleep_default=deep" # supposedly, this helps save power on laptops # in reality (at least on this model), this just generate excessive heat on the CPUs # "amd_pstate=passive" @@ -10518,29 +10519,36 @@ This holds configuration that is specific to framework laptops. #+begin_src nix-ts :tangle modules/nixos/optional/hibernation.nix { lib, config, ... }: - { - options.swarselmodules.optional.hibernation = lib.mkEnableOption "optional amd gpu settings"; - options.swarselsystems = { - hibernation = { - offset = lib.mkOption { - type = lib.types.int; - default = 0; - }; - resumeDevice = lib.mkOption { - type = lib.types.str; - default = "/dev/disk/by-label/nixos"; + { + options.swarselmodules.optional.hibernation = lib.mkEnableOption "optional amd gpu settings"; + options.swarselsystems = { + hibernation = { + offset = lib.mkOption { + type = lib.types.int; + default = 0; + }; + resumeDevice = lib.mkOption { + type = lib.types.str; + default = "/dev/disk/by-label/nixos"; + }; }; }; - }; - config = lib.mkIf config.swarselmodules.optional.hibernation { - boot = { - kernelParams = [ - "resume_offset=${builtins.toString config.swarselsystems.hibernation.offset}" - ]; - inherit (config.swarselsystems.hibernation) resumeDevice; + config = lib.mkIf config.swarselmodules.optional.hibernation { + boot = { + kernelParams = [ + "resume_offset=${builtins.toString config.swarselsystems.hibernation.offset}" + # "mem_sleep_default=deep" + ]; + inherit (config.swarselsystems.hibernation) resumeDevice; + }; + systemd.services."systemd-suspend-then-hibernate".aliases = [ "systemd-suspend.service" ]; + powerManagement.enable = true; + systemd.sleep.extraConfig = '' + HibernateDelaySec=120m + SuspendState=freeze + ''; }; - }; - } + } #+end_src **** BTRFS @@ -10778,6 +10786,7 @@ Options that I need specifically at work. There are more options at [[#h:f0b2ea9 }; }; + # ACTION=="remove", ENV{PRODUCT}=="3/1050/407/110", RUN+="${pkgs.kanshi}/bin/kanshictl switch laptoponly" udev.extraRules = '' # lock screen when yubikey removed ACTION=="remove", ENV{PRODUCT}=="3/1050/407/110", RUN+="${pkgs.systemd}/bin/systemctl suspend" @@ -11711,44 +11720,90 @@ This section is for programs that require no further configuration. zsh Integrat #+begin_src nix-ts :tangle modules/home/common/programs.nix { lib, config, pkgs, ... }: - { - options.swarselmodules.programs = lib.mkEnableOption "programs settings"; - config = lib.mkIf config.swarselmodules.programs { - programs = { - bat = { - enable = true; - extraPackages = with pkgs.bat-extras; [ batdiff batman batgrep batwatch ]; + { + options.swarselmodules.programs = lib.mkEnableOption "programs settings"; + config = lib.mkIf config.swarselmodules.programs { + programs = { + bat = { + enable = true; + extraPackages = with pkgs.bat-extras; [ batdiff batman batgrep batwatch ]; + }; + bottom.enable = true; + carapace.enable = true; + fzf = { + enable = true; + enableBashIntegration = false; + enableZshIntegration = false; + }; + imv.enable = true; + jq.enable = true; + less.enable = true; + lesspipe.enable = true; + mpv.enable = true; + pandoc.enable = true; + rclone.enable = true; + ripgrep.enable = true; + sioyek.enable = true; + swayr.enable = true; + timidity.enable = true; + wlogout ={ + enable = true; + layout = [ + { + label = "lock"; + action = "loginctl lock-session"; + text = "Lock"; + keybind = "l"; + circular = true; + } + { + label = "hibernate"; + action = "systemctl hibernate"; + text = "Hibernate"; + keybind = "h"; + circular = true; + } + { + label = "logout"; + action = "loginctl terminate-user $USER"; + text = "Logout"; + keybind = "u"; + circular = true; + } + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "p"; + circular = true; + } + { + label = "suspend"; + action = "systemctl suspend"; + text = "Suspend"; + keybind = "s"; + circular = true; + } + { + label = "reboot"; + action = "systemctl reboot"; + text = "Reboot"; + keybind = "r"; + circular = true; + } + ]; + }; + yt-dlp.enable = true; + zoxide = { + enable = true; + enableZshIntegration = true; + options = [ + "--cmd cd" + ]; + }; + }; }; - bottom.enable = true; - carapace.enable = true; - fzf = { - enable = true; - enableBashIntegration = false; - enableZshIntegration = false; - }; - imv.enable = true; - jq.enable = true; - less.enable = true; - lesspipe.enable = true; - mpv.enable = true; - pandoc.enable = true; - rclone.enable = true; - ripgrep.enable = true; - sioyek.enable = true; - swayr.enable = true; - timidity.enable = true; - wlogout.enable = true; - yt-dlp.enable = true; - zoxide = { - enable = true; - enableZshIntegration = true; - options = [ - "--cmd cd" - ]; - }; - }; - }; - } + } #+end_src **** nix-index @@ -14299,7 +14354,10 @@ Currently, I am too lazy to explain every option here, but most of it is very se in { name = "lidopen"; - exec = [ "${pkgs.swaybg}/bin/swaybg --output '${monitor}' --image ${self}/files/wallpaper/standwp.png --mode ${config.stylix.imageScalingMode}" ]; + exec = [ + "${pkgs.swaybg}/bin/swaybg --output '${config.swarselsystems.sharescreen}' --image ${config.swarselsystems.wallpaper} --mode ${config.stylix.imageScalingMode}" + "${pkgs.swaybg}/bin/swaybg --output '${monitor}' --image ${self}/files/wallpaper/standwp.png --mode ${config.stylix.imageScalingMode}" + ]; outputs = [ { criteria = config.swarselsystems.sharescreen; @@ -14849,15 +14907,27 @@ This service changes the screen hue at night. I am not sure if that really does let moduleName = "batsignal"; in - { - options.swarselmodules.${moduleName} = lib.mkEnableOption "enable ${moduleName} and settings"; - config = lib.mkIf config.swarselmodules.${moduleName} { - services.${moduleName} = { - enable = true; + { + options.swarselmodules.${moduleName} = lib.mkEnableOption "enable ${moduleName} and settings"; + config = lib.mkIf config.swarselmodules.${moduleName} { + services.${moduleName} = { + enable = true; + extraArgs = [ + "-W" + " Consider charging the battery" + "-C" + " Battery is low; plug in charger now" + "-D" + " Device will lose power in a few seconds" + "-c" + "10" + "-d" + "5" + ]; + }; }; - }; - } + } #+end_src **** autotiling @@ -14893,7 +14963,7 @@ This service changes the screen hue at night. I am not sure if that really does let brightnessctl = "${lib.getExe pkgs.brightnessctl}"; swaylock = "${lib.getExe pkgs.swaylock-effects}"; - suspend = "${pkgs.systemd}/bin/systemctl"; + suspend = "${pkgs.systemd}/bin/systemctl suspend"; in { enable = true; @@ -14908,6 +14978,7 @@ This service changes the screen hue at night. I am not sure if that really does ]; events = [ # { event = "before-sleep"; command = "${lib.getExe pkgs.swaylock-effects} -f --screenshots --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.2"; } + # { event = "after-resume"; command = "${swaylock} -f "; } { event = "before-sleep"; command = "${swaylock} -f "; } { event = "lock"; command = "${swaylock} -f "; } ]; @@ -15416,6 +15487,7 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]] profile = { name = "lidopen"; exec = [ + "${pkgs.swaybg}/bin/swaybg --output '${config.swarselsystems.sharescreen}' --image ${config.swarselsystems.wallpaper} --mode ${config.stylix.imageScalingMode}" "${pkgs.swaybg}/bin/swaybg --output 'HP Inc. HP 732pk CNC4080YL5' --image ${self}/files/wallpaper/botanicswp.png --mode ${config.stylix.imageScalingMode}" "${pkgs.swaybg}/bin/swaybg --output 'Hewlett Packard HP Z24i CN44250RDT' --image ${self}/files/wallpaper/op6wp.png --mode ${config.stylix.imageScalingMode}" ]; @@ -15450,6 +15522,7 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]] { name = "lidopen"; exec = [ + "${pkgs.swaybg}/bin/swaybg --output '${config.swarselsystems.sharescreen}' --image ${config.swarselsystems.wallpaper} --mode ${config.stylix.imageScalingMode}" "${pkgs.swaybg}/bin/swaybg --output '${monitor}' --image ${self}/files/wallpaper/navidrome.png --mode ${config.stylix.imageScalingMode}" "${pkgs.kanshare}/bin/kanshare ${config.swarselsystems.sharescreen} '${monitor}'" ]; diff --git a/hosts/nixos/pyramid/hardware-configuration.nix b/hosts/nixos/pyramid/hardware-configuration.nix index 8ee6c63..8e4d75a 100644 --- a/hosts/nixos/pyramid/hardware-configuration.nix +++ b/hosts/nixos/pyramid/hardware-configuration.nix @@ -22,8 +22,8 @@ # ''; boot = { - # kernelPackages = lib.mkDefault pkgs.kernel.linuxPackages; - kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + kernelPackages = lib.mkDefault pkgs.kernel.linuxPackages; + # kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; binfmt.emulatedSystems = [ "aarch64-linux" ]; initrd = { availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "cryptd" "usbhid" "sd_mod" "r8152" ]; @@ -39,7 +39,8 @@ kernelModules = [ "kvm-amd" ]; kernelParams = [ - "mem_sleep_default=deep" + # deep sleep is discontinued by amd + # "mem_sleep_default=deep" # supposedly, this helps save power on laptops # in reality (at least on this model), this just generate excessive heat on the CPUs # "amd_pstate=passive" diff --git a/modules/home/common/batsignal.nix b/modules/home/common/batsignal.nix index 30d4495..49bf81f 100644 --- a/modules/home/common/batsignal.nix +++ b/modules/home/common/batsignal.nix @@ -7,6 +7,18 @@ in config = lib.mkIf config.swarselmodules.${moduleName} { services.${moduleName} = { enable = true; + extraArgs = [ + "-W" + " Consider charging the battery" + "-C" + " Battery is low; plug in charger now" + "-D" + " Device will lose power in a few seconds" + "-c" + "10" + "-d" + "5" + ]; }; }; diff --git a/modules/home/common/kanshi.nix b/modules/home/common/kanshi.nix index 43b80b0..d2a0488 100644 --- a/modules/home/common/kanshi.nix +++ b/modules/home/common/kanshi.nix @@ -53,7 +53,10 @@ in { name = "lidopen"; - exec = [ "${pkgs.swaybg}/bin/swaybg --output '${monitor}' --image ${self}/files/wallpaper/standwp.png --mode ${config.stylix.imageScalingMode}" ]; + exec = [ + "${pkgs.swaybg}/bin/swaybg --output '${config.swarselsystems.sharescreen}' --image ${config.swarselsystems.wallpaper} --mode ${config.stylix.imageScalingMode}" + "${pkgs.swaybg}/bin/swaybg --output '${monitor}' --image ${self}/files/wallpaper/standwp.png --mode ${config.stylix.imageScalingMode}" + ]; outputs = [ { criteria = config.swarselsystems.sharescreen; diff --git a/modules/home/common/programs.nix b/modules/home/common/programs.nix index f577a87..21f0cdf 100644 --- a/modules/home/common/programs.nix +++ b/modules/home/common/programs.nix @@ -25,7 +25,53 @@ sioyek.enable = true; swayr.enable = true; timidity.enable = true; - wlogout.enable = true; + wlogout = { + enable = true; + layout = [ + { + label = "lock"; + action = "loginctl lock-session"; + text = "Lock"; + keybind = "l"; + circular = true; + } + { + label = "hibernate"; + action = "systemctl hibernate"; + text = "Hibernate"; + keybind = "h"; + circular = true; + } + { + label = "logout"; + action = "loginctl terminate-user $USER"; + text = "Logout"; + keybind = "u"; + circular = true; + } + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "p"; + circular = true; + } + { + label = "suspend"; + action = "systemctl suspend"; + text = "Suspend"; + keybind = "s"; + circular = true; + } + { + label = "reboot"; + action = "systemctl reboot"; + text = "Reboot"; + keybind = "r"; + circular = true; + } + ]; + }; yt-dlp.enable = true; zoxide = { enable = true; diff --git a/modules/home/common/swayidle.nix b/modules/home/common/swayidle.nix index a6db8e5..1bbcbcc 100644 --- a/modules/home/common/swayidle.nix +++ b/modules/home/common/swayidle.nix @@ -9,7 +9,7 @@ in let brightnessctl = "${lib.getExe pkgs.brightnessctl}"; swaylock = "${lib.getExe pkgs.swaylock-effects}"; - suspend = "${pkgs.systemd}/bin/systemctl"; + suspend = "${pkgs.systemd}/bin/systemctl suspend"; in { enable = true; @@ -24,6 +24,7 @@ in ]; events = [ # { event = "before-sleep"; command = "${lib.getExe pkgs.swaylock-effects} -f --screenshots --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.2"; } + # { event = "after-resume"; command = "${swaylock} -f "; } { event = "before-sleep"; command = "${swaylock} -f "; } { event = "lock"; command = "${swaylock} -f "; } ]; diff --git a/modules/home/optional/work.nix b/modules/home/optional/work.nix index 11f4a98..0724c54 100644 --- a/modules/home/optional/work.nix +++ b/modules/home/optional/work.nix @@ -299,6 +299,7 @@ in profile = { name = "lidopen"; exec = [ + "${pkgs.swaybg}/bin/swaybg --output '${config.swarselsystems.sharescreen}' --image ${config.swarselsystems.wallpaper} --mode ${config.stylix.imageScalingMode}" "${pkgs.swaybg}/bin/swaybg --output 'HP Inc. HP 732pk CNC4080YL5' --image ${self}/files/wallpaper/botanicswp.png --mode ${config.stylix.imageScalingMode}" "${pkgs.swaybg}/bin/swaybg --output 'Hewlett Packard HP Z24i CN44250RDT' --image ${self}/files/wallpaper/op6wp.png --mode ${config.stylix.imageScalingMode}" ]; @@ -333,6 +334,7 @@ in { name = "lidopen"; exec = [ + "${pkgs.swaybg}/bin/swaybg --output '${config.swarselsystems.sharescreen}' --image ${config.swarselsystems.wallpaper} --mode ${config.stylix.imageScalingMode}" "${pkgs.swaybg}/bin/swaybg --output '${monitor}' --image ${self}/files/wallpaper/navidrome.png --mode ${config.stylix.imageScalingMode}" "${pkgs.kanshare}/bin/kanshare ${config.swarselsystems.sharescreen} '${monitor}'" ]; diff --git a/modules/nixos/optional/hibernation.nix b/modules/nixos/optional/hibernation.nix index 856b672..d6f0758 100644 --- a/modules/nixos/optional/hibernation.nix +++ b/modules/nixos/optional/hibernation.nix @@ -17,8 +17,15 @@ boot = { kernelParams = [ "resume_offset=${builtins.toString config.swarselsystems.hibernation.offset}" + # "mem_sleep_default=deep" ]; inherit (config.swarselsystems.hibernation) resumeDevice; }; + systemd.services."systemd-suspend-then-hibernate".aliases = [ "systemd-suspend.service" ]; + powerManagement.enable = true; + systemd.sleep.extraConfig = '' + HibernateDelaySec=120m + SuspendState=freeze + ''; }; } diff --git a/modules/nixos/optional/work.nix b/modules/nixos/optional/work.nix index 747a9f3..9d77d44 100644 --- a/modules/nixos/optional/work.nix +++ b/modules/nixos/optional/work.nix @@ -208,6 +208,7 @@ in }; }; + # ACTION=="remove", ENV{PRODUCT}=="3/1050/407/110", RUN+="${pkgs.kanshi}/bin/kanshictl switch laptoponly" udev.extraRules = '' # lock screen when yubikey removed ACTION=="remove", ENV{PRODUCT}=="3/1050/407/110", RUN+="${pkgs.systemd}/bin/systemctl suspend"