nixos-configs/modules/ags/default.nix

164 lines
4.7 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,
2024-04-19 10:38:54 -04:00
gtk-session-lock,
lib,
2023-11-30 17:17:34 -05:00
pkgs,
self,
2023-11-30 17:17:34 -05:00
...
}: let
inherit (lib) boolToString;
inherit (config.vars) mainUser hostName mainMonitor greetdDupe;
flakeDir = config.environment.variables.FLAKE;
2023-11-30 17:17:34 -05:00
isTouchscreen = config.hardware.sensor.iio.enable;
2024-04-19 17:01:09 -04:00
gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default;
2023-11-30 17:17:34 -05:00
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;
2024-06-24 12:30:49 -04:00
inherit (lib) hasPrefix optionals removePrefix;
2024-03-22 23:31:37 -04:00
configJs =
2024-06-09 22:49:30 -04:00
# javascript
2024-03-22 23:31:37 -04:00
''
import { transpileTypeScript } from './js/utils.js';
export default (await transpileTypeScript('${hostName}')).default;
'';
agsConfigDir = "${removePrefix "/home/${mainUser}/" flakeDir}/modules/ags";
2023-11-30 17:17:34 -05:00
in {
assertions = [
{
assertion = hasPrefix "/home/${mainUser}/" flakeDir;
2024-06-24 12:30:49 -04:00
message = ''
Your $FLAKE environment variable needs to point to a directory in
the main users' home to use the AGS module.
'';
}
];
# Experimental Gtk4 ags
programs.astal = {
enable = true;
extraPackages = with pkgs; [
libadwaita
];
};
2024-04-19 10:38:54 -04:00
programs.ags = {
enable = true;
extraPackages = [
2024-04-19 17:01:09 -04:00
gtkSessionLock
2024-04-19 10:38:54 -04:00
];
};
2023-11-30 17:17:34 -05:00
home = {
file =
{
# Astal symlinks. ${./astal}, types and config.js
".config/astal".source = symlink "${flakeDir}/modules/ags/astal";
"${agsConfigDir}/astal/types".source = "${config.programs.astal.finalPackage}/share/io.Aylur.Astal/types";
"${agsConfigDir}/astal/config.js".text = configJs;
# AGS symlinks. ${./config}, types and config.js
".config/ags".source = symlink "${flakeDir}/modules/ags/config";
2024-04-19 10:38:54 -04:00
"${agsConfigDir}/config/types" = {
source = "${config.programs.ags.finalPackage}/share/com.github.Aylur.ags/types";
recursive = true;
};
2024-04-19 17:01:09 -04:00
"${agsConfigDir}/config/types/gtk-session-lock".source = pkgs.callPackage ./gtk-session-lock-types {inherit gtkSessionLock;};
"${agsConfigDir}/config/config.js".text = configJs;
"${agsConfigDir}/config/ts/lockscreen/vars.ts".text =
2024-06-09 22:49:30 -04:00
# javascript
''
2024-06-09 22:49:30 -04:00
//
export default {
mainMonitor: '${mainMonitor}',
dupeLockscreen: ${boolToString greetdDupe},
hasFprintd: ${boolToString (hostName == "wim")},
};
'';
}
// (import ./icons.nix {inherit pkgs agsConfigDir;});
2024-01-14 20:52:30 -05:00
packages =
[self.packages.${pkgs.system}.coloryou]
++ (with pkgs; [
# ags
dart-sass
bun
playerctl
(callPackage ./clipboard {})
2024-01-14 20:52:30 -05:00
## gui
pavucontrol # TODO: replace with ags widget
])
++ (optionals isTouchscreen (with pkgs; [
lisgd
ydotool
]));
};
wayland.windowManager.hyprland = {
settings = {
animations = {
bezier = [
"easeInOutBack, 0.68, -0.6, 0.32, 1.6"
];
animation = [
"fadeLayersIn, 0"
"fadeLayersOut, 1, 3000, default"
"layers, 1, 8, easeInOutBack, slide left"
];
};
layerrule = [
"noanim, ^(?!win-).*"
# Lockscreen blur
2024-04-19 17:01:09 -04:00
"blur, ^(blur-bg.*)"
"ignorealpha 0.19, ^(blur-bg.*)"
];
exec-once = [
"ags"
"sleep 3; ags -r 'App.openWindow(\"win-applauncher\")'"
];
bind = [
2024-05-05 22:43:03 -04:00
"$mainMod SHIFT, E , exec, ags -t win-powermenu"
"$mainMod , D , exec, ags -t win-applauncher"
"$mainMod , V , exec, ags -t win-clipboard"
" , Print, exec, ags -t win-screenshot"
];
binde = [
## Brightness control
2024-05-05 22:43:03 -04:00
", XF86MonBrightnessUp , exec, ags -r 'Brightness.screen += 0.05'"
", XF86MonBrightnessDown, exec, ags -r 'Brightness.screen -= 0.05'"
];
2024-05-05 22:43:03 -04:00
bindn = [" , Escape , exec, ags -r 'closeAll()'"];
bindr = ["CAPS, Caps_Lock, exec, ags -r 'Brightness.fetchCapsState()'"];
};
};
2023-11-30 17:17:34 -05:00
})
];
}