From e468436cce23a414d0375e636bf012e278bac8b3 Mon Sep 17 00:00:00 2001 From: Swarsel Date: Thu, 25 Jul 2024 15:13:35 +0200 Subject: [PATCH] feat: add temperature hwmon as module --- SwarselSystems.org | 91 ++++++++--- index.html | 277 ++++++++++++++++---------------- modules/home/hardware.nix | 9 ++ modules/home/laptop.nix | 16 ++ modules/home/waybar.nix | 20 +++ profiles/common/home/waybar.nix | 12 +- profiles/fourside/default.nix | 5 + profiles/fourside/home.nix | 27 ---- 8 files changed, 268 insertions(+), 189 deletions(-) diff --git a/SwarselSystems.org b/SwarselSystems.org index b07c523..c427675 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -2098,6 +2098,11 @@ My new main machine. home-manager.users.swarsel.swarselsystems = { isLaptop = true; isNixos = true; + temperatureHwmon = { + isAbsolutePath = true; + path = "/sys/devices/platform/thinkpad_hwmon/hwmon/"; + input-filename = "temp1_input"; + }; monitors = { main = { name = "California Institute of Technology 0x1407 Unknown"; @@ -2257,15 +2262,6 @@ This is basically just adjusted to the core count, path to the =hwmon= (this was { config, pkgs, lib, ... }: with lib; { - # waybar config - TEMPLATE - update for cores and temp - programs.waybar.settings.mainBar = { - # temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon4/temp1_input"; - temperature.hwmon-path.abs = "/sys/devices/platform/thinkpad_hwmon/hwmon/"; - temperature.input-filename = "temp1_input"; - }; - - <> - wayland.windowManager.sway = { config = rec { # update for actual inputs here, @@ -4470,6 +4466,22 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a middle_emulation = "enabled"; }; }; + config.swarselsystems.waybarModules = lib.mkIf config.swarselsystems.isLaptop [ + "custom/outer-left-arrow-dark" + "mpris" + "custom/left-arrow-light" + "network" + "custom/left-arrow-dark" + "pulseaudio" + "custom/left-arrow-light" + "battery" + "custom/left-arrow-dark" + "group/hardware" + "custom/left-arrow-light" + "clock#2" + "custom/left-arrow-dark" + "clock#1" + ]; } #+end_src @@ -4483,23 +4495,52 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a type = lib.types.int; default = 8; }; + options.swarselsystems.temperatureHwmon.isAbsolutePath = lib.mkEnableOption "absolute temperature path"; + options.swarselsystems.temperatureHwmon.path = lib.mkOption { + type = lib.types.str; + default = ""; + }; + options.swarselsystems.temperatureHwmon.input-filename = lib.mkOption { + type = lib.types.str; + default = ""; + }; } #+end_src ***** Waybar #+begin_src nix :tangle modules/home/waybar.nix - { lib, config, ... }: + { lib, config, ... }: -let - generateIcons = n: lib.concatStringsSep " " (builtins.map (x: "{icon" + toString x + "}") (lib.range 0 (n - 1))); -in - { - options.swarselsystems.cpuString = lib.mkOption { - type = lib.types.str; - default = generateIcons config.swarselsystems.cpuCount; - description = "The generated icons string for use by Waybar."; - internal = true; + let + generateIcons = n: lib.concatStringsSep " " (builtins.map (x: "{icon" + toString x + "}") (lib.range 0 (n - 1))); + in + { + options.swarselsystems.cpuString = lib.mkOption { + type = lib.types.str; + default = generateIcons config.swarselsystems.cpuCount; + description = "The generated icons string for use by Waybar."; + internal = true; + }; + options.swarselsystems.waybarModules = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ + "custom/outer-left-arrow-dark" + "mpris" + "custom/left-arrow-light" + "network" + "custom/left-arrow-dark" + "pulseaudio" + "custom/left-arrow-light" + "custom/pseudobat" + "battery" + "custom/left-arrow-dark" + "group/hardware" + "custom/left-arrow-light" + "clock#2" + "custom/left-arrow-dark" + "clock#1" + ]; }; } #+end_src @@ -6829,7 +6870,7 @@ The rest of this configuration is found here: #+begin_src nix :tangle profiles/common/home/waybar.nix - { config, ... }: + { config, lib, ... }: { programs.waybar = { @@ -6845,6 +6886,13 @@ The rest of this configuration is found here: format = "{}"; }; + modules-right = config.swarselsystems.waybarModules; + + "custom/pseudobat" = lib.mkIf (!config.swarselsystems.isLaptop) { + format = ""; + on-click-right = "wlogout -p layer-shell"; + }; + "custom/configwarn" = { exec = "bash ~/.dotfiles/scripts/checkconfigstatus.sh"; interval = 60; @@ -6882,6 +6930,9 @@ The rest of this configuration is found here: }; temperature = { + hwmon-path = lib.mkIf (!config.swarselsystems.temperatureHwmon.isAbsolutePath) config.swarselsystems.temperatureHwmon.path ; + hwmon-path-abs = lib.mkIf config.swarselsystems.temperatureHwmon.isAbsolutePath config.swarselsystems.temperatureHwmon.path ; + input-filename = lib.mkIf config.swarselsystems.temperatureHwmon.isAbsolutePath config.swarselsystems.temperatureHwmon.input-filename; critical-threshold = 80; format-critical = " {temperatureC}°C"; format = " {temperatureC}°C"; diff --git a/index.html b/index.html index 831942d..b8ef69b 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + SwarselSystems: NixOS + Emacs Configuration @@ -223,7 +223,7 @@ -
  • 3.2. Overlays, packages, and modules +
  • 3.2. Overlays, packages, and modules
  • 3.3. Common NixOS @@ -253,7 +253,7 @@
  • 3.3.1. Imports, enable home-manager module
  • 3.3.2. General
  • 3.3.3. sops
  • -
  • 3.3.4. Theme (stylix)
  • +
  • 3.3.4. Theme (stylix)
  • 3.3.5. System Packages
  • 3.3.6. Programs (including zsh setup)
  • 3.3.7. Services
  • @@ -263,7 +263,7 @@
  • 3.4. Common Home-Manager
  • 3.5. flake.nix template @@ -339,7 +340,7 @@
    • 4.4.1. Org Mode
    • 4.4.2. Nix Mode
    • -
    • 4.4.3. nixpkgs-fmt
    • +
    • 4.4.3. nixpkgs-fmt
    • 4.4.4. Markdown Mode
    • 4.4.5. Olivetti
    • 4.4.6. darkroom
    • @@ -399,7 +400,7 @@

      -This file has 42479 words spanning 11466 lines and was last revised on 2024-07-24 20:15:51 +0200. +This file has 42658 words spanning 11524 lines and was last revised on 2024-07-25 15:13:17 +0200.

      @@ -449,7 +450,7 @@ This section defines my Emacs configuration. For a while, I considered to use ry

      -My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-07-24 20:15:51 +0200) +My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-07-25 15:13:17 +0200)

    @@ -715,18 +716,6 @@ I also enable the extra socket here for ssh agent forwarding. But I have not ful
    -services.gpg-agent = {
    -  enable = true;
    -  enableSshSupport = true;
    -  enableExtraSocket = true;
    -  pinentryPackage = pkgs.pinentry.gtk2;
    -  defaultCacheTtl = 600;
    -  maxCacheTtl = 7200;
    -  extraConfig = ''
    -    allow-loopback-pinentry
    -    allow-emacs-pinentry
    -  '';
    -};
     
     
    @@ -1071,8 +1060,8 @@ mixedModules = [ -
    -

    2.3.3. General (outputs)

    +
    +

    2.3.3. General (outputs)

    @@ -1474,18 +1463,6 @@ No matter what you do, check the initial /etc/nixos/configuration.nix for notabl
     {
     
     
    -  services.gpg-agent = {
    -    enable = true;
    -    enableSshSupport = true;
    -    enableExtraSocket = true;
    -    pinentryPackage = pkgs.pinentry.gtk2;
    -    defaultCacheTtl = 600;
    -    maxCacheTtl = 7200;
    -    extraConfig = ''
    -      allow-loopback-pinentry
    -      allow-emacs-pinentry
    -    '';
    -  };
     
       home = {
         username = "TEMPLATE";
    @@ -2463,7 +2440,7 @@ in
     
  • -
  • Home-manager only
    +
  • Home-manager only
    1. Home manager
      @@ -2749,18 +2726,6 @@ New setup for the SP3, this time using NixOS - another machine will take over th { - services.gpg-agent = { - enable = true; - enableSshSupport = true; - enableExtraSocket = true; - pinentryPackage = pkgs.pinentry.gtk2; - defaultCacheTtl = 600; - maxCacheTtl = 7200; - extraConfig = '' - allow-loopback-pinentry - allow-emacs-pinentry - ''; - }; home = { @@ -2902,6 +2867,11 @@ My new main machine. home-manager.users.swarsel.swarselsystems = { isLaptop = true; isNixos = true; + temperatureHwmon = { + isAbsolutePath = true; + path = "/sys/devices/platform/thinkpad_hwmon/hwmon/"; + input-filename = "temp1_input"; + }; monitors = { main = { name = "California Institute of Technology 0x1407 Unknown"; @@ -2958,7 +2928,6 @@ Mostly just sets some opened ports for several games, enables virtualbox (which # kernelPackages = pkgs.linuxPackages_latest; }; - sops.age.sshKeyPaths = [ "${config.users.users.swarsel.home}/.ssh/sops" ]; networking = { hostName = "fourside"; # Define your hostname. @@ -3064,49 +3033,6 @@ This is basically just adjusted to the core count, path to the hwmon{ config, pkgs, lib, ... }: with lib; { - - services.gpg-agent = { - enable = true; - enableSshSupport = true; - enableExtraSocket = true; - pinentryPackage = pkgs.pinentry.gtk2; - defaultCacheTtl = 600; - maxCacheTtl = 7200; - extraConfig = '' - allow-loopback-pinentry - allow-emacs-pinentry - ''; - }; - - sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ]; - - # waybar config - TEMPLATE - update for cores and temp - programs.waybar.settings.mainBar = { - # temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon4/temp1_input"; - temperature.hwmon-path.abs = "/sys/devices/platform/thinkpad_hwmon/hwmon/"; - temperature.input-filename = "temp1_input"; - }; - - - programs.waybar.settings.mainBar.modules-right = [ - "custom/outer-left-arrow-dark" - "mpris" - "custom/left-arrow-light" - "network" - "custom/left-arrow-dark" - "pulseaudio" - "custom/left-arrow-light" - "custom/pseudobat" - "battery" - "custom/left-arrow-dark" - "group/hardware" - "custom/left-arrow-light" - "clock#2" - "custom/left-arrow-dark" - "clock#1" - ]; - - wayland.windowManager.sway = { config = rec { # update for actual inputs here, @@ -3320,18 +3246,6 @@ TODO: Adjust hwmon path, I/O modules and XF86 keys once laptop arri { - services.gpg-agent = { - enable = true; - enableSshSupport = true; - enableExtraSocket = true; - pinentryPackage = pkgs.pinentry.gtk2; - defaultCacheTtl = 600; - maxCacheTtl = 7200; - extraConfig = '' - allow-loopback-pinentry - allow-emacs-pinentry - ''; - }; home = { username = "swarsel"; @@ -5536,8 +5450,8 @@ in
    -
    -

    3.2. Overlays, packages, and modules

    +
    +

    3.2. Overlays, packages, and modules

    In this section I define packages that I manually want to nixpkgs. This can be useful for packages that are currently awaiting a PR or public packages that I do not want to maintain. @@ -5556,8 +5470,8 @@ These are for packages that are on nixpkgs, but do not fit my usecase, meaning I This is simply a mirror of the most recent stable branch of nixpkgs. Useful for packages that are broken on nixpkgs, but do not need to be on bleeding edge anyways.

  • -
    -

    3.2.1. Packages

    +
    +

    3.2.1. Packages

    @@ -5567,8 +5481,8 @@ _ : rec { }
     
    -
    -

    3.2.2. Overlays

    +
    +

    3.2.2. Overlays

    @@ -5601,15 +5515,15 @@ _ : rec { }
     
    -
    -

    3.2.3. Modules

    +
    +

    3.2.3. Modules

    In this section I define custom modules under the swarsel attribute. These are mostly used to define settings specific to a host. I keep these settings confined to either home-manager or nixos to maintain compatibility with non-NixOS machines.

      -
    1. NixOS
      +
    2. NixOS

      Modules that need to be loaded on the NixOS level. Note that these will not be available on systems that are not running NixOS @@ -5623,7 +5537,7 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a

    -
  • home-manager
    +
  • home-manager
    {
    @@ -5639,7 +5553,7 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
     
      -
    1. Laptop
      +
    2. Laptop
      { lib, config, ... }:
      @@ -5653,12 +5567,28 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
               middle_emulation = "enabled";
            };
         };
      +  config.swarselsystems.waybarModules = lib.mkIf config.swarselsystems.isLaptop [
      +  "custom/outer-left-arrow-dark"
      +  "mpris"
      +  "custom/left-arrow-light"
      +  "network"
      +  "custom/left-arrow-dark"
      +  "pulseaudio"
      +  "custom/left-arrow-light"
      +  "battery"
      +  "custom/left-arrow-dark"
      +  "group/hardware"
      +  "custom/left-arrow-light"
      +  "clock#2"
      +  "custom/left-arrow-dark"
      +  "clock#1"
      +  ];
       }
       
    3. -
    4. Hardware
      +
    5. Hardware
      { lib, ... }:
      @@ -5668,12 +5598,21 @@ Modules that need to be loaded on the NixOS level. Note that these will not be a
             type = lib.types.int;
             default = 8;
           };
      +  options.swarselsystems.temperatureHwmon.isAbsolutePath = lib.mkEnableOption "absolute temperature path";
      +  options.swarselsystems.temperatureHwmon.path = lib.mkOption {
      +      type = lib.types.str;
      +      default = "";
      +    };
      +  options.swarselsystems.temperatureHwmon.input-filename = lib.mkOption {
      +      type = lib.types.str;
      +      default = "";
      +    };
         }
       
    6. -
    7. Waybar
      +
    8. Waybar
        { lib, config, ... }:
      @@ -5688,12 +5627,32 @@ in
               description = "The generated icons string for use by Waybar.";
               internal = true;
             };
      -    }
      +    options.swarselsystems.waybarModules = lib.mkOption {
      +      type = lib.types.listOf lib.types.str;
      +      default = [
      +  "custom/outer-left-arrow-dark"
      +  "mpris"
      +  "custom/left-arrow-light"
      +  "network"
      +  "custom/left-arrow-dark"
      +  "pulseaudio"
      +  "custom/left-arrow-light"
      +  "custom/pseudobat"
      +  "battery"
      +  "custom/left-arrow-dark"
      +  "group/hardware"
      +  "custom/left-arrow-light"
      +  "clock#2"
      +  "custom/left-arrow-dark"
      +  "clock#1"
      +      ];
      +    };
      +  }
       
    9. -
    10. Monitors
      +
    11. Monitors
      { lib, config, ... }:
      @@ -5710,7 +5669,7 @@ in
       
    12. -
    13. Input
      +
    14. Input
      { lib, config, ... }:
      @@ -5746,7 +5705,7 @@ in
       
    15. -
    16. Nixos
      +
    17. Nixos
      { lib, config, ... }:
      @@ -5768,7 +5727,7 @@ in
       
    18. -
    19. System startup
      +
    20. System startup
      { lib, config, ... }:
      @@ -6311,6 +6270,7 @@ I use sops-nix to handle secrets that I want to have available on my machines at
       {
         sops = {
       
      +    age.sshKeyPaths = [ "${config.users.users.swarsel.home}/.ssh/sops" ];
           defaultSopsFile = "${config.users.users.swarsel.home}/.dotfiles/secrets/general/secrets.yaml";
           validateSopsFiles = false;
       
      @@ -6343,8 +6303,8 @@ I use sops-nix to handle secrets that I want to have available on my machines at
       
  • -
    -

    3.3.4. Theme (stylix)

    +
    +

    3.3.4. Theme (stylix)

    By default, stylix wants to style GRUB as well. However, I think that looks horrible. @@ -6526,7 +6486,7 @@ Some programs profit from being installed through dedicated NixOS settings on sy

      -
    1. zsh
      +
    2. zsh

      Do not touch this. @@ -6544,7 +6504,7 @@ Do not touch this.

    -
  • syncthing
    +
  • syncthing
    @@ -6622,7 +6582,7 @@ Enables the blueman service including the nice system tray icon.
     
  • -
  • Network devices
    +
  • Network devices

    In this section we enable compatibility with several network devices I have at home, mainly printers and scanners. @@ -6674,7 +6634,7 @@ services.printing = {

  • -
  • Avahi (device discovery)
    +
  • Avahi (device discovery)

    Avahi is the service used for the network discovery. @@ -6828,8 +6788,8 @@ This section houses the greetd related settings. I do not really want to use a d

    3.4. Common Home-Manager

    -
    -

    3.4.1. Imports

    +
    +

    3.4.1. Imports

    This section sets up all the imports that are used in the home-manager section. @@ -6864,6 +6824,7 @@ This section sets up all the imports that are used in the home-manager section. ./kdeconnect.nix ./mako.nix ./sway.nix + ./gpg-agent.nix ]; nix = { @@ -7268,6 +7229,7 @@ Since we are using the home-manager implementation here, we need to specify the

      { config, ... }:
       {
         sops = {
    +      age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ];
           defaultSopsFile = "${config.home.homeDirectory}/.dotfiles/secrets/general/secrets.yaml";
           validateSopsFiles = false;
           secrets = {
    @@ -7637,8 +7599,8 @@ This section is for programs that require no further configuration. zsh Integrat
     
  • -
    -

    3.4.10. nix-index

    +
    +

    3.4.10. nix-index

    nix-index provides a way to find out which packages are provided by which derivations. By default it also comes with a replacement for command-not-found.sh, however, the implementation is based on a channel based setup. I like consistency, so I replace the command with one that provides a flakes-based output. @@ -8257,7 +8219,7 @@ The rest of this configuration is found here:

    -{ config, ... }:
    +{ config, lib,  ... }:
     {
     programs.waybar = {
     
    @@ -8273,6 +8235,13 @@ programs.waybar = {
             format = "<span style=\"italic\" font-weight=\"bold\">{}</span>";
           };
     
    +      modules-right = config.swarselsystems.waybarModules;
    +
    +      "custom/pseudobat" = lib.mkIf (!config.swarselsystems.isLaptop) {
    +        format = "";
    +        on-click-right = "wlogout -p layer-shell";
    +      };
    +
           "custom/configwarn" = {
             exec = "bash ~/.dotfiles/scripts/checkconfigstatus.sh";
             interval = 60;
    @@ -8310,6 +8279,9 @@ programs.waybar = {
           };
     
           temperature = {
    +        hwmon-path = lib.mkIf (!config.swarselsystems.temperatureHwmon.isAbsolutePath) config.swarselsystems.temperatureHwmon.path ;
    +        hwmon-path-abs = lib.mkIf config.swarselsystems.temperatureHwmon.isAbsolutePath config.swarselsystems.temperatureHwmon.path ;
    +        input-filename = lib.mkIf config.swarselsystems.temperatureHwmon.isAbsolutePath config.swarselsystems.temperatureHwmon.input-filename;
             critical-threshold = 80;
             format-critical = " {temperatureC}°C";
             format = " {temperatureC}°C";
    @@ -8969,6 +8941,29 @@ Currently, I am too lazy to explain every option here, but most of it is very se
     
    +
    +

    3.4.25. gpg-agent

    +
    +
    +
    { pkgs, ... }:
    +{
    +services.gpg-agent = {
    +  enable = true;
    +  enableSshSupport = true;
    +  enableExtraSocket = true;
    +  pinentryPackage = pkgs.pinentry.gtk2;
    +  defaultCacheTtl = 600;
    +  maxCacheTtl = 7200;
    +  extraConfig = ''
    +    allow-loopback-pinentry
    +    allow-emacs-pinentry
    +  '';
    +};
    +}
    +
    +
    +
    +

    3.5. flake.nix template

    @@ -9982,7 +9977,7 @@ The standard Emacs behaviour for the Python process shell is a bit annoying. Thi
    -
  • Nix common prefix bracketer
    +
  • Nix common prefix bracketer

    This function searches for common delimiters in region and removes them, summarizing all captured lines by it. @@ -10015,7 +10010,7 @@ This function searches for common delimiters in region and removes them, summari

  • -
  • Nix formatters
    +
  • Nix formatters

    This formats the org code block at point in accordance to the nixpkgs-fmt formatter @@ -11588,8 +11583,8 @@ This adds a rudimentary nix-mode to Emacs. I have not really tried this out, as

    -
    -

    4.4.3. nixpkgs-fmt

    +
    +

    4.4.3. nixpkgs-fmt

    Adds functions for formatting nix code. @@ -13604,7 +13599,7 @@ My laptop, sadly soon to be replaced by a new one, since most basic functions ar

    Author: Leon Schwarzäugl

    -

    Created: 2024-07-24 Mi 20:15

    +

    Created: 2024-07-25 Do 15:13

    Validate

    diff --git a/modules/home/hardware.nix b/modules/home/hardware.nix index d5380f7..137195c 100644 --- a/modules/home/hardware.nix +++ b/modules/home/hardware.nix @@ -5,4 +5,13 @@ type = lib.types.int; default = 8; }; + options.swarselsystems.temperatureHwmon.isAbsolutePath = lib.mkEnableOption "absolute temperature path"; + options.swarselsystems.temperatureHwmon.path = lib.mkOption { + type = lib.types.str; + default = ""; + }; + options.swarselsystems.temperatureHwmon.input-filename = lib.mkOption { + type = lib.types.str; + default = ""; + }; } diff --git a/modules/home/laptop.nix b/modules/home/laptop.nix index 4ee50d4..06c114d 100644 --- a/modules/home/laptop.nix +++ b/modules/home/laptop.nix @@ -9,4 +9,20 @@ middle_emulation = "enabled"; }; }; + config.swarselsystems.waybarModules = lib.mkIf config.swarselsystems.isLaptop [ + "custom/outer-left-arrow-dark" + "mpris" + "custom/left-arrow-light" + "network" + "custom/left-arrow-dark" + "pulseaudio" + "custom/left-arrow-light" + "battery" + "custom/left-arrow-dark" + "group/hardware" + "custom/left-arrow-light" + "clock#2" + "custom/left-arrow-dark" + "clock#1" + ]; } diff --git a/modules/home/waybar.nix b/modules/home/waybar.nix index d835edb..73a807e 100644 --- a/modules/home/waybar.nix +++ b/modules/home/waybar.nix @@ -10,4 +10,24 @@ in description = "The generated icons string for use by Waybar."; internal = true; }; + options.swarselsystems.waybarModules = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ + "custom/outer-left-arrow-dark" + "mpris" + "custom/left-arrow-light" + "network" + "custom/left-arrow-dark" + "pulseaudio" + "custom/left-arrow-light" + "custom/pseudobat" + "battery" + "custom/left-arrow-dark" + "group/hardware" + "custom/left-arrow-light" + "clock#2" + "custom/left-arrow-dark" + "clock#1" + ]; + }; } diff --git a/profiles/common/home/waybar.nix b/profiles/common/home/waybar.nix index 9342b4d..ccf9a1f 100644 --- a/profiles/common/home/waybar.nix +++ b/profiles/common/home/waybar.nix @@ -1,4 +1,4 @@ -{ config, ... }: +{ config, lib, ... }: { programs.waybar = { @@ -14,6 +14,13 @@ format = "{}"; }; + modules-right = config.swarselsystems.waybarModules; + + "custom/pseudobat" = lib.mkIf (!config.swarselsystems.isLaptop) { + format = ""; + on-click-right = "wlogout -p layer-shell"; + }; + "custom/configwarn" = { exec = "bash ~/.dotfiles/scripts/checkconfigstatus.sh"; interval = 60; @@ -51,6 +58,9 @@ }; temperature = { + hwmon-path = lib.mkIf (!config.swarselsystems.temperatureHwmon.isAbsolutePath) config.swarselsystems.temperatureHwmon.path; + hwmon-path-abs = lib.mkIf config.swarselsystems.temperatureHwmon.isAbsolutePath config.swarselsystems.temperatureHwmon.path; + input-filename = lib.mkIf config.swarselsystems.temperatureHwmon.isAbsolutePath config.swarselsystems.temperatureHwmon.input-filename; critical-threshold = 80; format-critical = " {temperatureC}°C"; format = " {temperatureC}°C"; diff --git a/profiles/fourside/default.nix b/profiles/fourside/default.nix index cac0b49..39a6f84 100644 --- a/profiles/fourside/default.nix +++ b/profiles/fourside/default.nix @@ -27,6 +27,11 @@ home-manager.users.swarsel.swarselsystems = { isLaptop = true; isNixos = true; + temperatureHwmon = { + isAbsolutePath = true; + path = "/sys/devices/platform/thinkpad_hwmon/hwmon/"; + input-filename = "temp1_input"; + }; monitors = { main = { name = "California Institute of Technology 0x1407 Unknown"; diff --git a/profiles/fourside/home.nix b/profiles/fourside/home.nix index a9fea07..744ad00 100644 --- a/profiles/fourside/home.nix +++ b/profiles/fourside/home.nix @@ -1,33 +1,6 @@ { config, pkgs, lib, ... }: with lib; { - # waybar config - TEMPLATE - update for cores and temp - programs.waybar.settings.mainBar = { - # temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon4/temp1_input"; - temperature.hwmon-path.abs = "/sys/devices/platform/thinkpad_hwmon/hwmon/"; - temperature.input-filename = "temp1_input"; - }; - - - programs.waybar.settings.mainBar.modules-right = [ - "custom/outer-left-arrow-dark" - "mpris" - "custom/left-arrow-light" - "network" - "custom/left-arrow-dark" - "pulseaudio" - "custom/left-arrow-light" - "custom/pseudobat" - "battery" - "custom/left-arrow-dark" - "group/hardware" - "custom/left-arrow-light" - "clock#2" - "custom/left-arrow-dark" - "clock#1" - ]; - - wayland.windowManager.sway = { config = rec { # update for actual inputs here,