about summary refs log tree commit diff stats
path: root/hm/soispha/conf/yambar/default.nix
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-26 23:42:21 +0200
committerSoispha <soispha@vhack.eu>2023-08-26 23:42:21 +0200
commit3f600ab07dbad3b6dd7655587ddea158b19aea71 (patch)
tree7164ccd965e1d14ade970aeb8eb188b1442a6c91 /hm/soispha/conf/yambar/default.nix
parentStyle(treewide): Format all lua-files makes lua ➛ nix easier (diff)
downloadnixos-config-3f600ab07dbad3b6dd7655587ddea158b19aea71.zip
Refactor(treewide): Abbreviate path names
Diffstat (limited to 'hm/soispha/conf/yambar/default.nix')
-rw-r--r--hm/soispha/conf/yambar/default.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/hm/soispha/conf/yambar/default.nix b/hm/soispha/conf/yambar/default.nix
new file mode 100644
index 00000000..0bcf8419
--- /dev/null
+++ b/hm/soispha/conf/yambar/default.nix
@@ -0,0 +1,53 @@
+{
+  nixosConfig,
+  sysLib,
+  system,
+  pkgs,
+  grades,
+  yambar_cpu,
+  yambar_memory,
+  ...
+}: let
+  makeScript = {
+    file,
+    dependencies,
+    ...
+  }:
+    sysLib.writeShellScriptWithLibrary {
+      name = "${builtins.baseNameOf file}";
+      src = file;
+      dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash;});
+    }
+    + "/bin/${builtins.baseNameOf file}";
+in {
+  xdg.configFile."yambar/config.yml".source = pkgs.substituteAll {
+    src =
+      if nixosConfig.soispha.laptop.enable
+      then ./config/laptop.yml
+      else ./config/config.yml;
+
+    backlight =
+      if nixosConfig.soispha.laptop.enable
+      then nixosConfig.soispha.laptop.backlight
+      else "";
+    volume_script = makeScript {
+      dependencies = builtins.attrValues {inherit (pkgs) pulseaudio gawk coreutils;};
+      file = ./scripts/sound-volume;
+    };
+    grade_average_script = makeScript {
+      dependencies =
+        [
+          grades.outputs.packages.${system}.default
+        ]
+        ++ (builtins.attrValues {inherit (pkgs) coreutils gawk;});
+      file = ./scripts/grades-average;
+    };
+    cpu_script = yambar_cpu.app.${system}.default.program;
+    memory_script = yambar_memory.app.${system}.default.program;
+
+    disk_script = makeScript {
+      dependencies = builtins.attrValues {inherit (pkgs) gawk btrfs-progs coreutils;};
+      file = ./scripts/disk;
+    };
+  };
+}