fix(greetd): redirect bun output to correct file
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-02-06 12:59:55 -05:00
parent ed260d8743
commit ce451079d8
2 changed files with 24 additions and 15 deletions

View file

@ -5,7 +5,7 @@ const { execAsync, monitorFile } = Utils;
const watchAndCompileSass = (host) => {
const reloadCss = () => {
const scss = `${App.configDir}/scss/${host}.scss`;
const css = '/tmp/ags/style.css';
const css = `/tmp/ags-${host}/style.css`;
execAsync(`sassc ${scss} ${css}`).then(() => {
App.resetCss();
@ -23,20 +23,26 @@ const watchAndCompileSass = (host) => {
/** @param {string} host */
export const transpileTypeScript = async(host) => {
const outPath = `/tmp/ags-${host}/index.js`;
await execAsync([
'bun', 'build', `${App.configDir}/${host}.ts`,
'--outdir', '/tmp/ags',
'--external', 'resource:///*',
'--external', 'gi://*',
'--external', 'cairo',
'--external', '*/fzf.es.js',
'bash', '-c',
// Create the dir if it doesn't exist
`mkdir -p /tmp/ags-${host}; ` +
`bun build ${App.configDir}/${host}.ts ` +
'--external resource:///* ' +
'--external gi://* ' +
'--external cairo ' +
'--external */fzf.es.js ' +
// Since bun wants to right in cwd, we just redirect stdin instead
`> ${outPath}`,
]).catch(print);
if (host !== 'greeter') {
watchAndCompileSass(host);
}
// The file is going to be there after transpilation
// @ts-ignore
return await import(`file:///tmp/ags/${host}.js`);
return await import(`file://${outPath}`);
};

View file

@ -1,7 +1,8 @@
{
ags,
config,
lib,
pkgs,
config,
...
}: let
inherit (lib) optionals readFile;
@ -12,7 +13,6 @@
isTouchscreen = config.hardware.sensor.iio.enable;
hyprland = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
ags = config.home-manager.users.${mainUser}.programs.ags.package;
# Show Regreet on all monitors
dupeMonitors = pkgs.writeShellApplication {
@ -57,13 +57,14 @@
"env = WLR_NO_HARDWARE_CURSORS,1\n"
])
++ [
"exec-once = ${setupMonitors} && sleep 0.1 &&"
"exec-once = ${setupMonitors} && sleep 0.5 &&"
# FIXME: doesn't start
" swww init --no-cache &&"
" swww img -t none ${pkgs.dracula-theme}/wallpapers/waves.png\n"
"${readFile ./hyprland.conf}\n"
"exec-once = ags -b greeter; hyprctl dispatch exit"
"exec-once = ags -b greeter &> /tmp/ags.log; hyprctl dispatch exit"
]));
in {
# Add home folder for home-manager to work
@ -74,14 +75,16 @@ in {
home-manager.users.greeter = {
imports = [
ags.homeManagerModules.default
../../common/vars
../../home/theme.nix
];
programs.ags.enable = true;
home = {
packages = [
hyprland
ags
dupeMonitors
pkgs.bun
pkgs.sassc