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

73 lines
1.7 KiB
Nix
Raw Normal View History

2024-11-11 20:33:44 -05:00
self: {
config,
lib,
pkgs,
...
}: {
2024-11-11 20:33:44 -05:00
config = let
# Libs
inherit (lib) removePrefix;
2024-11-11 20:33:44 -05:00
cfg = config.roles.desktop;
hmCfg = config.home-manager.users.${cfg.user};
2024-11-11 20:33:44 -05:00
ags = hmCfg.programs.ags-v2.package;
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;
agsDir = "${removePrefix "/home/${cfg.user}/" config.environment.variables.FLAKE}/nixosModules/ags-v2/config";
2024-11-11 20:33:44 -05:00
nodeModules = homeFiles."${agsDir}/node_modules".source;
tsconfig = homeFiles."${agsDir}/tsconfig.json".source;
varsTs = homeFiles."${agsDir}/widgets/lockscreen/vars.ts".source;
2024-11-11 20:33:44 -05:00
in
pkgs.runCommandLocal "agsConfig" {} ''
cp -ar ${tsconfig} ./tsconfig.json
cp -ar ${../../ags-v2/config}/* ./.
chmod +w -R ./.
cp -ar ${varsTs} ./widgets/lockscreen/vars.ts
cp -ar ${nodeModules} ./node_modules
${ags}/bin/ags bundle ./app.ts $out
2024-11-11 20:33:44 -05:00
'';
in {
assertions = [
{
assertion = cfg.ags-v2.enable;
message = ''
The Display Manager requires AGSv2 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 = [
ags
2024-11-11 20:33:44 -05:00
hyprland
];
text = ''
export CONF="greeter"
exec ags run ${agsConfig}
'';
})
];
};
};
# For accurate stack trace
_file = ./default.nix;
}