about summary refs log blame commit diff stats
path: root/hm/soispha/conf/yambar/default.nix
blob: 021dfbdd56de67f2f581719a92f52d16ce924837 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
 
              
         
         
       
                
     
                
         

                 
                             
                                 
                                                                                  
                     
    
                                                                  


                                          
 


                                               

                                                                   
                             
      
                                
                                                                                     
                            
      
 
                                                          
 
                                                                

                                                                                      
                    
      
 
{
  nixosConfig,
  sysLib,
  system,
  pkgs,
  yambar_cpu,
  yambar_memory,
  ...
}: 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-cli;};
      name = "mpd_song_name";
    };

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

    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;};
      name = "disk";
    };
  };
}