about summary refs log tree commit diff stats
path: root/modules/by-name/ya/yambar/module.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/by-name/ya/yambar/module.nix')
-rw-r--r--modules/by-name/ya/yambar/module.nix65
1 files changed, 65 insertions, 0 deletions
diff --git a/modules/by-name/ya/yambar/module.nix b/modules/by-name/ya/yambar/module.nix
new file mode 100644
index 00000000..2f6ea22f
--- /dev/null
+++ b/modules/by-name/ya/yambar/module.nix
@@ -0,0 +1,65 @@
+{
+  config,
+  sysLib,
+  pkgs,
+  lib,
+  ...
+}: let
+  cfg = config.soispha.programs.yambar;
+
+  makeScript = {
+    name,
+    dependencies,
+    ...
+  }:
+    sysLib.writeShellScript {
+      inherit name;
+      src = ./scripts/${name}.sh;
+      dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash;});
+    }
+    + "/bin/${name}";
+in {
+  options.soispha.programs.yambar = {
+    enable = lib.mkEnableOption "yambar";
+
+    laptop = lib.mkEnableOption "laptop specific settings";
+    backlight = lib.mkOption {
+      type = lib.types.str;
+      example = "intel_backlight";
+      description = "Which backlight to query for the screen brightness";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.soispha = {
+      programs.yambar = {
+        enable = true;
+        settings = import ./settings {
+          inherit lib;
+          inherit (cfg) laptop;
+          laptopBacklightName = cfg.backlight;
+          scripts = {
+            mpd_song_name_script = makeScript {
+              dependencies = [pkgs.mpc];
+              name = "mpd_song_name";
+            };
+
+            volume_script = makeScript {
+              dependencies = with pkgs; [pulseaudio gawk coreutils];
+              name = "sound-volume";
+            };
+
+            cpu_script = "${lib.getExe pkgs.yambar-modules} cpu";
+
+            memory_script = "${lib.getExe pkgs.yambar-modules} memory";
+
+            disk_script = makeScript {
+              dependencies = with pkgs; [gawk btrfs-progs coreutils];
+              name = "disk";
+            };
+          };
+        };
+      };
+    };
+  };
+}