nixos-configs/nixosModules/desktop/manager/ags.nix
matt1432 f3e06554e4
All checks were successful
Discord / discord commits (push) Has been skipped
feat(ags): update to official agsV2
2024-11-13 19:39:01 -05:00

67 lines
1.6 KiB
Nix

self: {
config,
pkgs,
...
}: {
config = let
cfg = config.roles.desktop;
agsCfg = hmCfg.programs.ags;
hmCfg = config.home-manager.users.${cfg.user};
hyprland = hmCfg.wayland.windowManager.hyprland.finalPackage;
agsConfig = let
homeFiles = config.home-manager.users.${cfg.user}.home.file;
nodeModules = homeFiles."${agsCfg.configDir}/node_modules".source;
tsconfig = homeFiles."${agsCfg.configDir}/tsconfig.json".source;
varsTs = homeFiles."${agsCfg.configDir}/widgets/lockscreen/vars.ts".source;
in
pkgs.runCommandLocal "agsConfig" {} ''
cp -ar ${tsconfig} ./tsconfig.json
cp -ar ${../../ags/config}/* ./.
chmod +w -R ./.
cp -ar ${varsTs} ./widgets/lockscreen/vars.ts
cp -ar ${nodeModules} ./node_modules
${agsCfg.package}/bin/ags bundle ./app.ts $out
'';
in {
assertions = [
{
assertion = cfg.ags.enable;
message = ''
The Display Manager requires AGS to be enabled.
'';
}
];
# Add home folder for home-manager to work
users.users.greeter = {
home = "/var/lib/greeter";
createHome = true;
};
home-manager.users.greeter = {
home.packages = [
hyprland
(pkgs.writeShellApplication {
name = "agsGreeter";
runtimeInputs = [
agsCfg.package
hyprland
];
text = ''
export CONF="greeter"
exec ags run ${agsConfig}
'';
})
];
};
};
# For accurate stack trace
_file = ./default.nix;
}