nixos/modules/home/ags/default.nix

84 lines
1.5 KiB
Nix

{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.modules.ags;
hyprlandCfg = config.modules.hyprland;
colors = config.lib.stylix.colors.withHashtag;
base16Names = [
"base00"
"base01"
"base02"
"base03"
"base04"
"base05"
"base06"
"base07"
"base08"
"base09"
"base0A"
"base0B"
"base0C"
"base0D"
"base0E"
"base0F"
];
palette = pkgs.writeText "palette.scss" (
concatStringsSep "\n" (
map (name: "$" + name + ": " + colors.${name} + ";") base16Names
++ [
''$font-family: "${config.stylix.fonts.sansSerif.name}";''
"$font-size: ${toString config.stylix.fonts.sizes.desktop}px;"
]
)
);
notifConfig = pkgs.writeText "notif-config.ts" ''
export const MAX_TIMEOUT = ${toString cfg.timeout};
'';
astalDeps =
with pkgs.astal;
[
astal3
io
hyprland
network
battery
wireplumber
notifd
]
++ [ pkgs.networkmanager ];
ags-bar = pkgs.ags.bundle {
pname = "ags-bar";
version = "0.1.0";
src = ./app;
entry = "app.ts";
dependencies = astalDeps;
postUnpack = ''
cp ${palette} "$sourceRoot/palette.scss"
cp ${notifConfig} "$sourceRoot/notif-config.ts"
'';
};
in
{
config = mkIf cfg.enable {
home.packages = [
ags-bar
pkgs.ags
pkgs.dart-sass
];
wayland.windowManager.hyprland = mkIf hyprlandCfg.enable {
settings.exec-once = [ "ags-bar" ];
};
};
}