feat(node): make function to make girs types and move it to lib

This commit is contained in:
matt1432 2024-09-24 16:12:57 -04:00
parent aa9723303b
commit 7a3ea83d40
7 changed files with 58 additions and 24 deletions

View file

@ -4,10 +4,10 @@ self: {
pkgs,
...
}: let
inherit (self.inputs) ags astal gtk-session-lock ts-for-gir-src;
inherit (self.inputs) ags astal gtk-session-lock;
in {
config = let
inherit (lib) boolToString mkIf toLower;
inherit (lib) boolToString mkIf;
# Configs
inherit (config.vars) hostName;
@ -70,15 +70,11 @@ in {
home = {
file = let
inherit (import "${self}/lib" {inherit pkgs;}) buildNodeModules;
mkType = package: girName: {
"${agsConfigDir}/config/types/@girs/${toLower girName}".source =
pkgs.callPackage
./mk-types {
inherit ts-for-gir-src package girName;
};
};
inherit
(import "${self}/lib" {inherit pkgs self;})
buildNodeModules
buildNodeTypes
;
in (
{
# Generated types
@ -87,8 +83,16 @@ in {
recursive = true; # To add other types inside the folder
};
}
// (mkType gtkSessionLock "GtkSessionLock-0.1")
// (mkType astalTray "AstalTray-0.1")
// (buildNodeTypes {
pname = "gtk-session-lock";
configPath = "${agsConfigDir}/config/types/@girs";
packages = [gtkSessionLock];
})
// (buildNodeTypes {
pname = "astal-tray";
configPath = "${agsConfigDir}/config/types/@girs";
packages = [astalTray];
})
// {
# Out of store symlinks
".config/ags".source = mkOutOfStoreSymlink "${flakeDir}/nixosModules/ags/config";

View file

@ -1 +0,0 @@
use flake $FLAKE#node

View file

@ -1,29 +0,0 @@
{
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
'';
}

File diff suppressed because it is too large Load diff

View file

@ -1,5 +0,0 @@
{
"dependencies": {
"@ts-for-gir/cli": "^3.3.0"
}
}