nixos-configs/nixosModules/ags/default.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

62 lines
1.4 KiB
Nix

self: {
config,
lib,
...
}: let
inherit (lib) hasPrefix mkIf removePrefix;
# Configs
cfgDesktop = config.roles.desktop;
flakeDir = config.environment.variables.FLAKE;
agsConfigDir = "${removePrefix "/home/${cfgDesktop.user}/" flakeDir}/nixosModules/ags/config";
hmOpts = {lib, ...}: {
options.programs.ags = {
package = lib.mkOption {
type = with lib.types; nullOr package;
default = null;
};
astalLibs = lib.mkOption {
type = with lib.types; nullOr (listOf package);
default = null;
};
lockPkg = lib.mkOption {
type = with lib.types; nullOr package;
default = null;
};
configDir = lib.mkOption {
type = lib.types.str;
default = agsConfigDir;
};
};
};
in {
config = mkIf cfgDesktop.ags.enable {
assertions = [
{
assertion = hasPrefix "/home/${cfgDesktop.user}/" flakeDir;
message = ''
Your $FLAKE environment variable needs to point to a directory in
the main users' home to use the AGS module.
'';
}
];
# Machine config
security.pam.services.astal-auth = {};
services.upower.enable = true;
home-manager.users.${cfgDesktop.user}.imports = [
hmOpts
(import ./packages.nix self)
./hyprland.nix
];
};
# For accurate stack trace
_file = ./default.nix;
}