nixos-configs/modules/ags/packages.nix

175 lines
4.3 KiB
Nix
Raw Normal View History

2024-11-13 19:39:01 -05:00
self: {
config,
lib,
osConfig,
pkgs,
...
}: let
2025-01-05 20:23:44 -05:00
inherit (self.inputs) ags astal gtk-session-lock kompass;
2024-11-13 19:39:01 -05:00
inherit (lib) attrValues boolToString filter getExe mkIf optionalAttrs optionals;
2024-11-13 19:39:01 -05:00
inherit (osConfig.networking) hostName;
cfg = config.programs.ags;
cfgDesktop = osConfig.roles.desktop;
2024-12-31 23:54:29 -05:00
gtk4ConfigDir = "${cfg.configDir}/../gtk4";
2024-12-14 19:36:54 -05:00
mainPkg = pkgs.writeShellApplication {
name = "ags";
runtimeInputs = [cfg.package];
text = ''
if [ "$#" == 0 ]; then
2025-01-06 14:41:55 -05:00
exec ags run ~/${cfg.configDir} -a ${hostName}
2024-12-14 19:36:54 -05:00
else
2025-01-06 14:41:55 -05:00
exec ags "$@"
2024-12-14 19:36:54 -05:00
fi
'';
};
2024-11-13 19:39:01 -05:00
in {
config = mkIf cfgDesktop.ags.enable {
2024-11-13 19:39:01 -05:00
# Make these accessible outside these files
programs.ags = {
package = ags.packages.${pkgs.system}.ags.override {
extraPackages = cfg.astalLibs;
};
2024-12-25 03:11:27 -05:00
astalLibs = attrValues {
inherit
2025-01-02 01:26:38 -05:00
(astal.packages.${pkgs.system})
2024-12-25 03:11:27 -05:00
io
astal3
2024-12-27 01:27:33 -05:00
astal4
2024-12-25 03:11:27 -05:00
apps
auth
battery
bluetooth
greet
hyprland
mpris
network
notifd
2024-12-27 01:27:33 -05:00
powerprofiles
2024-12-25 03:11:27 -05:00
tray
wireplumber
;
2025-01-06 14:41:55 -05:00
gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default;
libKompass = kompass.packages.${pkgs.system}.libkompass;
2025-01-05 20:23:44 -05:00
# libkompass dependencies
inherit
(astal.packages.${pkgs.system})
cava
river
;
2024-12-25 03:11:27 -05:00
inherit
(pkgs)
2025-01-02 01:26:38 -05:00
libadwaita
2024-12-25 03:11:27 -05:00
gtk4 # Needed to build types
;
};
2024-11-13 19:39:01 -05:00
lockPkg = pkgs.writeShellApplication {
name = "lock";
runtimeInputs = [cfg.package];
text = ''
if [ "$#" == 0 ]; then
2025-01-06 14:41:55 -05:00
exec ags run ~/${cfg.configDir} -a lock
2024-11-13 19:39:01 -05:00
else
2025-01-06 14:41:55 -05:00
exec ags "$@" -i lock
2024-11-13 19:39:01 -05:00
fi
'';
};
};
home = {
packages =
[
2024-12-14 19:36:54 -05:00
mainPkg
2024-12-31 23:54:29 -05:00
(pkgs.writeShellApplication {
name = "ags4";
runtimeInputs = [cfg.package];
text = ''
exec ags run ~/${gtk4ConfigDir}/app.ts --gtk4
'';
})
2024-11-13 19:39:01 -05:00
(pkgs.writeShellApplication {
name = "agsConf";
runtimeInputs = [cfg.package];
text = ''
exec ags run ~/${cfg.configDir} -a "$1"
2024-11-13 19:39:01 -05:00
'';
})
]
2024-12-07 22:16:34 -05:00
++ (attrValues {
2024-11-13 19:39:01 -05:00
inherit
(pkgs)
2024-12-19 17:46:57 -05:00
networkmanagerapplet
2024-11-13 19:39:01 -05:00
playerctl
wayfreeze
2024-11-13 19:39:01 -05:00
;
})
2024-12-07 22:16:34 -05:00
++ (optionals cfgDesktop.isTouchscreen (attrValues {
2024-11-13 19:39:01 -05:00
inherit
(pkgs)
ydotool
;
}));
file = let
inherit
(self.lib.${pkgs.system})
2024-11-13 19:39:01 -05:00
buildNodeModules
buildGirTypes
;
in (
(buildGirTypes {
pname = "ags";
configPath = "${cfg.configDir}/@girs";
2025-01-02 01:26:38 -05:00
packages = filter (x:
2025-01-05 20:23:44 -05:00
x.pname != "libadwaita" && x.pname != "libkompass")
2025-01-02 01:26:38 -05:00
cfg.astalLibs;
2024-11-13 19:39:01 -05:00
})
2024-12-31 23:54:29 -05:00
// (buildGirTypes {
pname = "ags";
configPath = "${gtk4ConfigDir}/@girs";
2025-01-02 01:26:38 -05:00
packages = filter (x:
2025-01-04 01:22:08 -05:00
x.pname != "gtk-session-lock")
2025-01-02 01:26:38 -05:00
cfg.astalLibs;
2024-12-31 23:54:29 -05:00
})
2024-11-13 19:39:01 -05:00
// {
2025-01-02 01:26:38 -05:00
"${cfg.configDir}/node_modules" = {
force = true;
source = buildNodeModules ./config (import ./config).npmDepsHash;
};
2024-11-13 19:39:01 -05:00
2025-01-02 01:26:38 -05:00
"${gtk4ConfigDir}/node_modules" = {
force = true;
source = buildNodeModules ./config (import ./config).npmDepsHash;
};
2024-12-31 23:54:29 -05:00
2024-11-13 19:39:01 -05:00
"${cfg.configDir}/widgets/lockscreen/vars.ts".text =
# javascript
''
export default {
mainMonitor: '${cfgDesktop.mainMonitor}',
dupeLockscreen: ${boolToString cfgDesktop.displayManager.duplicateScreen},
hasFprintd: ${boolToString (hostName == "wim")},
};
'';
}
2024-12-14 19:36:54 -05:00
// optionalAttrs cfgDesktop.isTouchscreen {
".config/fcitx5/conf/virtualkeyboardadapter.conf".text = ''
ActivateCmd="${getExe mainPkg} request 'show-osk'"
DeactivateCmd="${getExe mainPkg} request 'hide-osk'"
'';
}
2024-11-13 19:39:01 -05:00
);
};
};
# For accurate stack trace
_file = ./default.nix;
}