feat(agsv2): add node_modules and types with nix
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-09-24 16:19:56 -04:00
parent 7a3ea83d40
commit 62dc1214e9
5 changed files with 82 additions and 64 deletions

View file

@ -1,3 +1,3 @@
@girs/
node_modules/
@girs
node_modules
tsconfig.json

View file

@ -1,10 +1,14 @@
import { App } from 'astal';
import style from 'inline:./style.scss';
import Bar from './widget/Bar';
import Bar from './widgets/bar/main';
App.start({
css: style,
main() {
Bar(0);
main: () => {
Bar();
},
});

View file

@ -1,8 +1,15 @@
self: {pkgs, ...}: {
self: {
lib,
pkgs,
...
}: {
config = let
inherit (lib) attrValues removeAttrs;
inherit (self.inputs) agsV2;
agsV2Packages = agsV2.packages.${pkgs.system};
astalLibs = attrValues (removeAttrs agsV2.inputs.astal.packages.${pkgs.system} ["docs"]);
configDir = "/home/matt/.nix/nixosModules/ags/v2";
in {
home = {
@ -16,7 +23,22 @@ self: {pkgs, ...}: {
})
];
file = {
file = let
inherit
(import "${self}/lib" {inherit pkgs self;})
buildNodeModules
buildNodeTypes
;
in (
(buildNodeTypes {
pname = "agsV2";
configPath = "${configDir}/@girs";
packages = astalLibs;
})
// {
"${configDir}/node_modules".source =
buildNodeModules ./. "sha256-WjCfS8iEw5Mjor/sQ2t+i0Q1pqVpSDEDbbgrKwK+3cg=";
"${configDir}/tsconfig.json".source = pkgs.writers.writeJSON "tsconfig.json" {
"$schema" = "https://json.schemastore.org/tsconfig";
"compilerOptions" = {
@ -36,7 +58,8 @@ self: {pkgs, ...}: {
};
};
};
};
}
);
};
};

View file

@ -1,39 +0,0 @@
import { App, Variable, Astal, Gtk } from 'astal';
const time = Variable<string>('').poll(1000, 'date');
/**
* @param monitor the id of the monitor on which we want the widget to appear
* @returns the bar window
*/
export default function Bar(monitor: number) {
return (
<window
className="Bar"
monitor={monitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={
Astal.WindowAnchor.TOP |
Astal.WindowAnchor.LEFT |
Astal.WindowAnchor.RIGHT
}
application={App}
>
<centerbox>
<button
onClicked="echo hello"
halign={Gtk.Align.CENTER}
>
Welcome to AGS!
</button>
<box />
<button
onClick={() => print('hello')}
halign={Gtk.Align.CENTER}
>
<label label={time()} />
</button>
</centerbox>
</window>
);
}

View file

@ -0,0 +1,30 @@
import { App, Astal, Gtk, idle, Variable } from 'astal';
const isVisible = Variable<boolean>(false);
export default () => {
return (
<window
className="Bar"
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={
Astal.WindowAnchor.TOP |
Astal.WindowAnchor.LEFT |
Astal.WindowAnchor.RIGHT
}
application={App}
setup={() => idle(() => {
isVisible.set(true);
})}
>
<revealer
revealChild={isVisible()}
transitionType={Gtk.RevealerTransitionType.SLIDE_DOWN}
transitionDuration={500}
>
<label label="hi" />
</revealer>
</window>
);
};