fix(ags): use package flag on ts-for-gir
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
628ccd1758
commit
8f0ec20dcf
14 changed files with 58 additions and 101 deletions
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
BIN
flake.nix
BIN
flake.nix
Binary file not shown.
|
@ -221,6 +221,10 @@ let
|
|||
owner = "libratbag";
|
||||
repo = "piper";
|
||||
}
|
||||
{
|
||||
owner = "gjsify";
|
||||
repo = "ts-for-gir";
|
||||
}
|
||||
|
||||
# MPV scripts
|
||||
{
|
||||
|
|
BIN
modules/ags/config/package-lock.json
generated
BIN
modules/ags/config/package-lock.json
generated
Binary file not shown.
|
@ -8,11 +8,11 @@
|
|||
"@eslint/js": "9.7.0",
|
||||
"@stylistic/eslint-plugin": "2.3.0",
|
||||
"@types/eslint__js": "8.42.3",
|
||||
"@types/node": "20.14.10",
|
||||
"@types/node": "20.14.11",
|
||||
"eslint": "9.7.0",
|
||||
"eslint-plugin-jsdoc": "48.7.0",
|
||||
"typescript": "5.5.3",
|
||||
"typescript-eslint": "7.16.0"
|
||||
"typescript-eslint": "7.16.1"
|
||||
},
|
||||
"overrides": {
|
||||
"eslint": "$eslint"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Tray from 'gi://AstalTray?version=0.1';
|
||||
const SystemTray = Tray.Tray.get_default();
|
||||
import AstalTray from 'gi://AstalTray?version=0.1';
|
||||
const SystemTray = AstalTray.Tray.get_default();
|
||||
|
||||
|
||||
const { timeout } = Utils;
|
||||
|
@ -10,10 +10,6 @@ import Separator from '../../misc/separator.ts';
|
|||
const REVEAL_DURATION = 500;
|
||||
const SPACING = 12;
|
||||
|
||||
/* Types */
|
||||
// FIXME: get types from 'gi://AstalTray'
|
||||
import type AstalTray from 'types/astal-tray/astaltray-0.1.d.ts';
|
||||
|
||||
|
||||
const SysTrayItem = (item: AstalTray.TrayItem) => {
|
||||
if (item.id === 'spotify-client') {
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
ts-for-gir-src,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) boolToString;
|
||||
inherit (lib) boolToString toLower;
|
||||
|
||||
# Configs
|
||||
inherit (config.vars) mainUser hostName;
|
||||
|
@ -44,6 +45,7 @@ in {
|
|||
export default (await transpileTypeScript('${hostName}')).default;
|
||||
'';
|
||||
|
||||
agsPkg = config.programs.ags.finalPackage;
|
||||
agsConfigDir = "${removePrefix "/home/${mainUser}/" flakeDir}/modules/ags";
|
||||
in {
|
||||
assertions = [
|
||||
|
@ -65,20 +67,27 @@ in {
|
|||
};
|
||||
|
||||
home = {
|
||||
file =
|
||||
file = let
|
||||
mkType = package: girName: {
|
||||
"${agsConfigDir}/config/types/@girs/${toLower girName}".source =
|
||||
pkgs.callPackage
|
||||
./mk-types {
|
||||
inherit ts-for-gir-src package girName;
|
||||
};
|
||||
};
|
||||
in (
|
||||
{
|
||||
# Out of store symlinks
|
||||
".config/ags".source = mkOutOfStoreSymlink "${flakeDir}/modules/ags/config";
|
||||
|
||||
# Generated types
|
||||
"${agsConfigDir}/config/types" = {
|
||||
source = "${config.programs.ags.finalPackage}/share/com.github.Aylur.ags/types";
|
||||
source = "${agsPkg}/share/com.github.Aylur.ags/types";
|
||||
recursive = true; # To add other types inside the folder
|
||||
};
|
||||
"${agsConfigDir}/config/types/gtk-session-lock".source =
|
||||
pkgs.callPackage ./third-party-types/lock.nix {inherit gtkSessionLock;};
|
||||
"${agsConfigDir}/config/types/astal-tray".source =
|
||||
pkgs.callPackage ./third-party-types/tray.nix {inherit astalTray;};
|
||||
}
|
||||
// (mkType gtkSessionLock "GtkSessionLock-0.1")
|
||||
// (mkType astalTray "AstalTray-0.1")
|
||||
// {
|
||||
# Out of store symlinks
|
||||
".config/ags".source = mkOutOfStoreSymlink "${flakeDir}/modules/ags/config";
|
||||
|
||||
# Generated JavaScript files
|
||||
"${agsConfigDir}/config/config.js".text = configJs;
|
||||
|
@ -92,7 +101,8 @@ in {
|
|||
};
|
||||
'';
|
||||
}
|
||||
// (import ./icons.nix {inherit pkgs agsConfigDir;});
|
||||
// (import ./icons.nix {inherit pkgs agsConfigDir;})
|
||||
);
|
||||
|
||||
packages =
|
||||
[
|
||||
|
|
29
modules/ags/mk-types/default.nix
Normal file
29
modules/ags/mk-types/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
package,
|
||||
girName,
|
||||
buildNpmPackage,
|
||||
ts-for-gir-src,
|
||||
...
|
||||
}:
|
||||
buildNpmPackage {
|
||||
pname = "${package.pname}-types";
|
||||
inherit (package) version;
|
||||
|
||||
npmDepsHash = "sha256-8De8tRUKzRhD1jyx0anYNPMhxZyIr2nI45HdK6nb8jI=";
|
||||
|
||||
src = ./.;
|
||||
dontNpmBuild = true;
|
||||
|
||||
buildPhase = ''
|
||||
npx @ts-for-gir/cli generate ${girName} \
|
||||
-g ${package.dev}/share/gir-1.0 \
|
||||
-g ${ts-for-gir-src}/girs \
|
||||
--ignoreVersionConflicts \
|
||||
--package \
|
||||
-e gjs -o ./types
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -r ./types $out
|
||||
'';
|
||||
}
|
Binary file not shown.
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
atk,
|
||||
buildNpmPackage,
|
||||
gdk-pixbuf,
|
||||
gobject-introspection,
|
||||
gtk3,
|
||||
gtkSessionLock,
|
||||
harfbuzz,
|
||||
pango,
|
||||
...
|
||||
}:
|
||||
buildNpmPackage {
|
||||
pname = "gtk-session-lock-types";
|
||||
inherit (gtkSessionLock) version;
|
||||
|
||||
npmDepsHash = import ./npmDepsHash.nix;
|
||||
|
||||
src = ./.;
|
||||
dontNpmBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
npx @ts-for-gir/cli generate ${builtins.concatStringsSep " " [
|
||||
"-g ${gtkSessionLock.dev}/share/gir-1.0"
|
||||
"-g ${gobject-introspection.dev}/share/gir-1.0"
|
||||
"-g ${gtk3.dev}/share/gir-1.0"
|
||||
"-g ${pango.dev}/share/gir-1.0"
|
||||
"-g ${gdk-pixbuf.dev}/share/gir-1.0"
|
||||
"-g ${harfbuzz.dev}/share/gir-1.0"
|
||||
"-g ${atk.dev}/share/gir-1.0"
|
||||
]} -e gjs -o ./types
|
||||
|
||||
mkdir -p $out
|
||||
cp ./types/gtksessionlock* $out/
|
||||
|
||||
substituteInPlace $out/gtksessionlock* --replace-warn \
|
||||
"from '." "from '@girs"
|
||||
'';
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
"sha256-moEiTMb0HC/LOhOaGM6NBi54fisRW5vigsXvFSqURyg="
|
|
@ -1,43 +0,0 @@
|
|||
{
|
||||
astalTray,
|
||||
atk,
|
||||
buildNpmPackage,
|
||||
gdk-pixbuf,
|
||||
glib,
|
||||
gobject-introspection,
|
||||
gtk3,
|
||||
harfbuzz,
|
||||
libdbusmenu-gtk3,
|
||||
pango,
|
||||
...
|
||||
}:
|
||||
buildNpmPackage {
|
||||
pname = "astal-tray-types";
|
||||
inherit (astalTray) version;
|
||||
|
||||
npmDepsHash = import ./npmDepsHash.nix;
|
||||
|
||||
src = ./.;
|
||||
dontNpmBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
npx @ts-for-gir/cli generate ${builtins.concatStringsSep " " [
|
||||
"-g ${astalTray.dev}/share/gir-1.0"
|
||||
"-g ${atk.dev}/share/gir-1.0"
|
||||
"-g ${gdk-pixbuf.dev}/share/gir-1.0"
|
||||
"-g ${glib.dev}/share/gir-1.0"
|
||||
"-g ${gobject-introspection.dev}/share/gir-1.0"
|
||||
"-g ${gtk3.dev}/share/gir-1.0"
|
||||
"-g ${harfbuzz.dev}/share/gir-1.0"
|
||||
"-g ${libdbusmenu-gtk3}/share/gir-1.0"
|
||||
"-g ${pango.dev}/share/gir-1.0"
|
||||
"--ignoreVersionConflicts"
|
||||
]} -e gjs -o ./types
|
||||
|
||||
mkdir -p $out
|
||||
cp ./types/astaltray* $out/
|
||||
|
||||
substituteInPlace $out/astaltray* --replace-warn \
|
||||
"from '." "from '@girs"
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue