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

View file

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