nixos-configs/modules/ags/default.nix

114 lines
3.1 KiB
Nix
Raw Normal View History

2023-11-30 17:17:34 -05:00
{
ags,
astal,
2023-11-30 17:17:34 -05:00
config,
pkgs,
...
}: let
inherit (config.vars) mainUser hostName;
flakeDir = config.environment.variables.FLAKE;
2023-11-30 17:17:34 -05:00
isTouchscreen = config.hardware.sensor.iio.enable;
in {
# Enable pam for ags and astal
security.pam.services.ags = {};
security.pam.services.astal = {};
2023-11-30 17:17:34 -05:00
services.upower.enable = true;
home-manager.users.${mainUser}.imports = [
2023-11-30 17:17:34 -05:00
ags.homeManagerModules.default
astal.homeManagerModules.default
2023-11-30 17:17:34 -05:00
({
config,
lib,
...
}: let
symlink = config.lib.file.mkOutOfStoreSymlink;
inherit (lib) optionals;
2024-03-19 15:49:22 -04:00
astalTypes = config.home.file.".local/share/io.Aylur.Astal/types";
astalConfigDir = ".nix/modules/ags/astal"; # FIXME: figure out way to use $FLAKE
2024-03-19 15:49:22 -04:00
# https://github.com/Aylur/ags/blob/e1f2d311ceb496a69ef6daa6aebb46ce511b2f22/nix/hm-module.nix#L69
agsTypes = config.home.file.".local//share/com.github.Aylur.ags/types";
agsConfigDir = ".nix/modules/ags/config"; # FIXME: figure out way to use $FLAKE
2024-03-22 23:31:37 -04:00
configJs =
/*
javascript
*/
''
import { transpileTypeScript } from './js/utils.js';
export default (await transpileTypeScript('${hostName}')).default;
'';
2023-11-30 17:17:34 -05:00
in {
# Experimental Gtk4 ags
programs.astal = {
enable = true;
extraPackages = with pkgs; [
libadwaita
];
};
2024-01-27 14:44:50 -05:00
programs.ags.enable = true;
2023-11-30 17:17:34 -05:00
home = {
file =
{
".config/astal".source = symlink "${flakeDir}/modules/ags/astal";
2024-03-22 23:31:37 -04:00
"${astalConfigDir}/types".source = astalTypes.source;
"${astalConfigDir}/config.js".text = configJs;
".config/ags".source = symlink "${flakeDir}/modules/ags/config";
"${agsConfigDir}/types".source = agsTypes.source;
2024-03-22 23:31:37 -04:00
"${agsConfigDir}/config.js".text = configJs;
}
// (import ./icons.nix {inherit pkgs agsConfigDir;});
2024-01-14 20:52:30 -05:00
packages =
[config.customPkgs.coloryou]
++ (with pkgs; [
# ags
dart-sass
bun
playerctl
2024-01-14 20:52:30 -05:00
## gui
pavucontrol # TODO: replace with ags widget
])
++ (optionals isTouchscreen (with pkgs; [
lisgd
squeekboard
ydotool
]));
};
wayland.windowManager.hyprland = {
settings = {
exec-once =
[
"ags"
"sleep 3; ags -r 'App.openWindow(\"applauncher\")'"
]
++ optionals isTouchscreen ["squeekboard"];
bind = [
"$mainMod SHIFT, E , exec, ags -t powermenu"
"$mainMod , D , exec, ags -t applauncher"
];
binde = [
## Brightness control
", XF86MonBrightnessUp, exec, ags -r 'Brightness.screen += 0.05'"
", XF86MonBrightnessDown, exec, ags -r 'Brightness.screen -= 0.05'"
];
bindn = [",Escape, exec, ags run-js 'closeAll()'"];
bindr = ["CAPS, Caps_Lock, exec, ags -r 'Brightness.fetchCapsState()'"];
};
};
2023-11-30 17:17:34 -05:00
})
];
}