nixos-configs/modules/ags/packages.nix

196 lines
4.7 KiB
Nix
Raw Normal View History

2024-11-13 19:39:01 -05:00
self: {
config,
lib,
osConfig,
pkgs,
...
}: let
2025-03-08 17:46:00 -05:00
inherit (self.inputs) 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 = {
2025-03-08 17:22:48 -05:00
package = pkgs.ags.override {
2024-11-13 19:39:01 -05:00
extraPackages = cfg.astalLibs;
};
2024-12-25 03:11:27 -05:00
astalLibs = attrValues {
inherit
2025-03-08 17:22:48 -05:00
(pkgs.astalLibs)
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-03-05 14:03:09 -05:00
# TODO: add overlays to upstream flake
2025-01-06 14:41:55 -05:00
libKompass = kompass.packages.${pkgs.system}.libkompass;
2025-01-05 20:23:44 -05:00
# libkompass dependencies
inherit
2025-03-08 17:22:48 -05:00
(pkgs.astalLibs)
2025-01-05 20:23:44 -05:00
cava
river
;
2024-12-25 03:11:27 -05:00
inherit
(pkgs)
2025-01-02 01:26:38 -05:00
libadwaita
gtk4-layer-shell
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 = ''
2025-03-08 17:46:00 -05:00
gsettings set org.gnome.desktop.interface cursor-size 30
2024-11-13 19:39:01 -05:00
if [ "$#" == 0 ]; then
2025-03-08 17:46:00 -05:00
exec ags run ~/${gtk4ConfigDir}/app.ts -a lock --gtk4
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 = ''
gsettings set org.gnome.desktop.interface cursor-size 30
2025-03-08 17:46:00 -05:00
if [ "$#" == 0 ]; then
exec ags run ~/${gtk4ConfigDir}/app.ts --gtk4 -a ${hostName}
else
exec ags "$@"
fi
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
;
2025-02-28 21:56:54 -05:00
inherit
(pkgs.selfPackages)
2025-02-28 21:56:54 -05:00
coloryou
;
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
;
2025-01-25 02:28:34 -05:00
lockscreenVars =
# javascript
''
export default {
mainMonitor: '${cfgDesktop.mainMonitor}',
dupeLockscreen: ${boolToString cfgDesktop.displayManager.duplicateScreen},
hasFprintd: ${boolToString (hostName == "wim")},
};
'';
2024-11-13 19:39:01 -05:00
in (
2025-02-27 23:04:41 -05:00
(import ./icons.nix {
inherit pkgs;
agsConfigDir = cfg.configDir;
})
// (import ./icons.nix {
inherit pkgs;
agsConfigDir = gtk4ConfigDir;
})
// (buildGirTypes {
2024-11-13 19:39:01 -05:00
pname = "ags";
configPath = "${cfg.configDir}/@girs";
2025-01-02 01:26:38 -05:00
packages = filter (x:
true
&& x.pname != "libadwaita"
&& x.pname != "libkompass"
&& x.pname != "gtk4-layer-shell"
&& x.pname != "gtk4-session-lock")
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-03-08 17:46:00 -05:00
true)
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
2025-01-25 02:28:34 -05:00
"${gtk4ConfigDir}/widgets/lockscreen/vars.ts".text = lockscreenVars;
2024-11-13 19:39:01 -05:00
}
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;
}