blob: 2d0f1e97e74c48713dea2d1ce1a7c46a24eecbb1 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
{
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}";
mkWrapper = bin: cmd:
pkgs.writeShellScript cmd ''
${bin} ${cmd}
'';
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 = mkWrapper (lib.getExe pkgs.yambar-modules) "cpu";
memory_script = mkWrapper (lib.getExe pkgs.yambar-modules) "memory";
disk_script = makeScript {
dependencies = with pkgs; [gawk btrfs-progs coreutils];
name = "disk";
};
};
};
};
};
};
}
|