about summary refs log tree commit diff stats
path: root/modules/home.legacy/conf/yambar/default.nix
blob: 72dcaa8e95c2922f766127a0fa04808973242075 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
  nixosConfig,
  sysLib,
  pkgs,
  lib,
  ...
}: let
  makeScript = {
    name,
    dependencies,
    ...
  }:
    sysLib.writeShellScript {
      inherit name;
      src = ./scripts/${name}.sh;
      dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash;});
    }
    + "/bin/${name}";
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 "";

    mpd_song_name_script = makeScript {
      dependencies = builtins.attrValues {inherit (pkgs) mpc;};
      name = "mpd_song_name";
    };

    volume_script = makeScript {
      dependencies = builtins.attrValues {inherit (pkgs) pulseaudio gawk coreutils;};
      name = "sound-volume";
    };

    cpu_script = lib.getExe pkgs.yambar-cpu;

    memory_script = lib.getExe pkgs.yambar-memory;

    disk_script = makeScript {
      dependencies = builtins.attrValues {inherit (pkgs) gawk btrfs-progs coreutils;};
      name = "disk";
    };
  };
}