diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-29 18:51:52 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-29 19:37:38 +0100 |
commit | 2138b4624eae088a81852f50b3a8f50fc0431a10 (patch) | |
tree | 701f7fdd68775c4c1589db463ef4ed37458c354c /modules/by-name/ya/yambar/module.nix | |
parent | chore(pkgs/by-name/ya/{cpu,memory}): Merge (diff) | |
download | nixos-config-2138b4624eae088a81852f50b3a8f50fc0431a10.tar.gz nixos-config-2138b4624eae088a81852f50b3a8f50fc0431a10.zip |
refactor(modules/legacy/conf/yambar): Move to `by-name` and modernize
Diffstat (limited to 'modules/by-name/ya/yambar/module.nix')
-rw-r--r-- | modules/by-name/ya/yambar/module.nix | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/modules/by-name/ya/yambar/module.nix b/modules/by-name/ya/yambar/module.nix new file mode 100644 index 00000000..2f6ea22f --- /dev/null +++ b/modules/by-name/ya/yambar/module.nix @@ -0,0 +1,65 @@ +{ + 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"; + }; + }; + }; + }; + }; + }; +} |