summaryrefslogtreecommitdiff
path: root/pkgs/astal/default.nix
blob: d076f077aa666cb7716d7052b9db3ffc69a3eaad (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
{
  astal,
  callPackage,
  dart-sass,
  networkmanager,
  runCommand,
  writeShellApplication,
  # System theme must be passed in
  theme ? null,
  ...
}: let
  vars = import ./theme.nix {inherit theme;};
  mkAstal = file:
    callPackage ./builder.nix {
      src = runCommand "src" {} ''
        mkdir -p $out
        cp -r ${./src}/{*.lua,widget} $out/
        cp $out/${file}.lua $out/init.lua
        cp -r ${./src}/style/* .
        echo '${vars}' > theme.scss
        cat theme.scss style.scss widget/* > main.scss
        ${dart-sass}/bin/sass main.scss $out/main.css
      '';
      name = "astal-${file}";
      extraPackages =
        (with astal; [
          apps
          battery
          hyprland
          mpris
          network
          notifd
          tray
          wireplumber
        ])
        ++ [
          networkmanager
        ];
    };

  mkAstalWrapper = file: let
    pkg = mkAstal file;
  in
    writeShellApplication {
      name = "astal-${file}";
      text = ''
        ${pkg}/bin/astal-${file}
      '';
    };
in {
  shell = mkAstalWrapper "shell";
  launcher = mkAstalWrapper "launcher";
}