aboutsummaryrefslogtreecommitdiffstats
path: root/modules/desktop/eww/yuck.nix
blob: db49e99105b33df66c77a9777829e1dcd550a971 (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{
  config,
  lib,
  pkgs,
  ...
}:
{
  config = lib.mkIf config.desktop.enable {
    programs.eww.yuckConfig =
      let
        pythonEnv = pkgs.python3.withPackages (ps: [ ps.pygobject3 ]);
        system-stats = pkgs.stdenv.mkDerivation {
          pname = "eww-system-stats";
          version = "0.1.0";
          src = ./system-stats.py;
          dontUnpack = true;
          meta.mainProgram = "eww-system-stats";

          nativeBuildInputs = [
            pkgs.iw
            pkgs.pamixer
            pkgs.wrapGAppsHook3
            pkgs.gobject-introspection
          ];
          buildInputs = [ pkgs.gtk3 ];

          installPhase = ''
            mkdir -p $out/bin
            install -m755 $src $out/bin/eww-system-stats
            patchShebangs $out/bin/eww-system-stats
          '';

          # wrapGAppsHook3 wraps every executable in $out/bin automatically,
          # setting GI_TYPELIB_PATH etc. from buildInputs' closure.
          preFixup = ''
            gappsWrapperArgs+=(--prefix PATH : "${pythonEnv}/bin")
          '';
        };

        workspaces = pkgs.stdenv.mkDerivation {
          pname = "eww-workspaces";
          version = "0.1.0";
          src = ./workspaces.py;
          dontUnpack = true;
          meta.mainProgram = "eww-workspaces";

          nativeBuildInputs = [
            pkgs.wrapGAppsHook3
            pkgs.gobject-introspection
          ];
          buildInputs = [ pkgs.gtk3 ];

          installPhase = ''
            mkdir -p $out/bin
            install -m755 $src $out/bin/eww-workspaces
            patchShebangs $out/bin/eww-workspaces
          '';

          # wrapGAppsHook3 wraps every executable in $out/bin automatically,
          # setting GI_TYPELIB_PATH etc. from buildInputs' closure.
          preFixup = ''
            gappsWrapperArgs+=(--prefix PATH : "${pythonEnv}/bin")
          '';
        };

        activate-windows = pkgs.stdenv.mkDerivation {
          pname = "eww-activate-windows";
          version = "0.1.0";
          src = ./activate-windows.py;
          dontUnpack = true;
          meta.mainProgram = "eww-activate-windows";

          nativeBuildInputs = [
            pkgs.wrapGAppsHook3
            pkgs.gobject-introspection
          ];
          buildInputs = [ pkgs.gtk3 ];

          installPhase = ''
            mkdir -p $out/bin
            install -m755 $src $out/bin/eww-activate-windows
            patchShebangs $out/bin/eww-activate-windows
          '';

          # wrapGAppsHook3 wraps every executable in $out/bin automatically,
          # setting GI_TYPELIB_PATH etc. from buildInputs' closure.
          preFixup = ''
            gappsWrapperArgs+=(--prefix PATH : "${pythonEnv}/bin")
          '';
        };
      in
      builtins.replaceStrings
        [
          "@@workspaces-script@@"
          "@@windows-script@@"
          "@@systemstats-script@@"
          "@@icon-unknown@@"
          "@@icon-offline@@"
          "@@icon-wifi@@"
          "@@icon-ethernet@@"
          "@@icon-cpu@@"
          "@@icon-ram@@"
          "@@icon-audio@@"
          "@@icon-calendar@@"
        ]
        [
          (lib.getExe workspaces)
          (lib.getExe activate-windows)
          (lib.getExe system-stats)
          (toString ../../../assets/icons/unknown.svg)
          (toString ../../../assets/icons/bar/offline.svg)
          (toString ../../../assets/icons/bar/wifi.svg)
          (toString ../../../assets/icons/bar/ethernet.svg)
          (toString ../../../assets/icons/bar/cpu.svg)
          (toString ../../../assets/icons/bar/ram.svg)
          (toString ../../../assets/icons/bar/audio.svg)
          (toString ../../../assets/icons/bar/calendar.svg)
        ]
        (builtins.readFile ./bar.yuck);
  };
}