imsh-clients

Clients for imsh screenshot/screencast sharing service
git clone https://git.echoz.io/imsh-clients.git
Log | Files | Refs

home-manager.nix (1809B)


      1 {
      2   lib,
      3   config,
      4   pkgs,
      5   ...
      6 }:
      7 let
      8   cfg = config.programs.imsh-clients;
      9 in
     10 {
     11   options.programs.imsh-clients = {
     12     enable = lib.mkEnableOption "imsh-clients";
     13 
     14     imsh-shot = {
     15       enable = lib.mkEnableOption "imsh-shot";
     16       package = lib.mkPackageOption pkgs "imsh-shot" { };
     17     };
     18 
     19     imsh-cast = {
     20       enable = lib.mkEnableOption "imsh-cast";
     21       package = lib.mkPackageOption pkgs "imsh-cast" { };
     22     };
     23 
     24     imsh-cast-monitor = {
     25       enable = lib.mkEnableOption "imsh-cast-monitor";
     26       package = lib.mkPackageOption pkgs "imsh-cast-monitor" { };
     27 
     28       waybar = {
     29         enable = lib.mkEnableOption "custom waybar module added to mainBar";
     30 
     31         module = lib.mkOption {
     32           type = lib.types.raw;
     33         };
     34       };
     35     };
     36   };
     37 
     38   config = {
     39     nixpkgs.overlays = [ (import ../overlay.nix) ];
     40 
     41     programs.imsh-clients = {
     42       imsh-shot.enable = lib.mkDefault cfg.enable;
     43       imsh-cast.enable = lib.mkDefault cfg.enable;
     44 
     45       imsh-cast-monitor.waybar.module = {
     46         format = "{text}";
     47         exec = lib.getExe cfg.imsh-cast-monitor.package;
     48         return-type = "json";
     49         hide-empty-text = true;
     50       };
     51     };
     52 
     53     home.packages =
     54       (with cfg.imsh-shot; lib.optional enable package)
     55       ++ (with cfg.imsh-cast; lib.optional enable package)
     56       ++ (with cfg.imsh-cast-monitor; lib.optional enable package);
     57 
     58     programs.waybar = lib.mkIf cfg.imsh-cast-monitor.waybar.enable {
     59       settings.mainBar = {
     60         modules-center = lib.mkBefore [ "custom/imsh-cast-monitor" ];
     61         "custom/imsh-cast-monitor" = cfg.imsh-cast-monitor.waybar.module;
     62       };
     63       style = ''
     64         .imsh-cast-monitor.recording {
     65           color: #f00;
     66         }
     67 
     68         .imsh-cast-monitor.error {
     69           color: #ff0;
     70         }
     71       '';
     72     };
     73   };
     74 }