nixos-configs/nixosModules/desktop/manager/ags.nix

68 lines
1.6 KiB
Nix
Raw Normal View History

2024-11-11 20:33:44 -05:00
self: {
config,
pkgs,
...
}: {
2024-11-11 20:33:44 -05:00
config = let
cfg = config.roles.desktop;
2024-11-13 19:39:01 -05:00
agsCfg = hmCfg.programs.ags;
hmCfg = config.home-manager.users.${cfg.user};
2024-11-11 20:33:44 -05:00
hyprland = hmCfg.wayland.windowManager.hyprland.finalPackage;
2024-11-11 20:33:44 -05:00
agsConfig = let
homeFiles = config.home-manager.users.${cfg.user}.home.file;
2024-11-11 20:33:44 -05:00
2024-11-13 19:39:01 -05:00
nodeModules = homeFiles."${agsCfg.configDir}/node_modules".source;
tsconfig = homeFiles."${agsCfg.configDir}/tsconfig.json".source;
varsTs = homeFiles."${agsCfg.configDir}/widgets/lockscreen/vars.ts".source;
2024-11-11 20:33:44 -05:00
in
pkgs.runCommandLocal "agsConfig" {} ''
cp -ar ${tsconfig} ./tsconfig.json
2024-11-13 19:39:01 -05:00
cp -ar ${../../ags/config}/* ./.
2024-11-11 20:33:44 -05:00
chmod +w -R ./.
cp -ar ${varsTs} ./widgets/lockscreen/vars.ts
cp -ar ${nodeModules} ./node_modules
2024-11-13 19:39:01 -05:00
${agsCfg.package}/bin/ags bundle ./app.ts $out
2024-11-11 20:33:44 -05:00
'';
in {
assertions = [
{
2024-11-13 19:39:01 -05:00
assertion = cfg.ags.enable;
message = ''
2024-11-13 19:39:01 -05:00
The Display Manager requires AGS to be enabled.
'';
}
];
2024-11-11 20:33:44 -05:00
# 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 = [
2024-11-13 19:39:01 -05:00
agsCfg.package
2024-11-11 20:33:44 -05:00
hyprland
];
text = ''
export CONF="greeter"
exec ags run ${agsConfig}
'';
})
];
};
};
# For accurate stack trace
_file = ./default.nix;
}