{ 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"; }; }; }; }; }; }; }