diff --git a/lib/pkgs/default.nix b/lib/pkgs/default.nix index 02b9d06d..d991c3fa 100644 --- a/lib/pkgs/default.nix +++ b/lib/pkgs/default.nix @@ -31,6 +31,7 @@ in { configPath, packages, pname, + delete ? [], }: let withGirNames = map (package: { @@ -48,15 +49,18 @@ in { then "AstalPowerProfiles-0.1" else if package.pname == "gtk4" then "Gtk-4.0" + else if package.pname == "libadwaita" + then "Adw-1" else (concatMapStrings capitalise (splitString "-" package.pname)) + "-0.1"; }) packages; in { - "${configPath}${optionalString (length packages == 1) "/${toLower (elemAt withGirNames 0).girName}"}".source = - pkgs.callPackage - ./mk-types { + "${configPath}${optionalString (length packages == 1) "/${toLower (elemAt withGirNames 0).girName}"}" = { + force = true; + source = pkgs.callPackage ./mk-types { inherit (self.inputs) ts-for-gir-src; - inherit pname withGirNames; + inherit delete pname withGirNames; }; + }; }; } diff --git a/lib/pkgs/mk-types/default.nix b/lib/pkgs/mk-types/default.nix index 2797c2d9..47a0913d 100644 --- a/lib/pkgs/mk-types/default.nix +++ b/lib/pkgs/mk-types/default.nix @@ -4,9 +4,10 @@ withGirNames, buildNpmPackage, ts-for-gir-src, + delete ? [], ... }: let - inherit (lib) concatMapStringsSep; + inherit (lib) concatMapStringsSep optionalString; buildPhase = '' npx @ts-for-gir/cli generate ${concatMapStringsSep " " (p: p.girName) withGirNames} \ @@ -31,6 +32,9 @@ in ''; installPhase = '' + ${optionalString (delete != []) ( + "rm -f " + concatMapStringsSep " " (file: "./types/${file}.d.ts") delete + )} cp -r ./types $out ''; } diff --git a/modules/ags/config/default.nix b/modules/ags/config/default.nix index f05eabea..21a9ca87 100644 --- a/modules/ags/config/default.nix +++ b/modules/ags/config/default.nix @@ -1,3 +1,3 @@ { - npmDepsHash = "sha256-FzWSWDEqsJxhYOhfSvmZU+/hqw44wm60nM7l32ut1+Y="; + npmDepsHash = "sha256-qn1+dIo7p1+PYlR2qAmnCrR8xE93mYbwNCjDYISgnqU="; } diff --git a/modules/ags/config/env.d.ts b/modules/ags/config/env.d.ts index 2c93f116..9cdf81ce 100644 --- a/modules/ags/config/env.d.ts +++ b/modules/ags/config/env.d.ts @@ -1,6 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ - -const SRC: string; +declare const SRC: string; declare module 'inline:*' { const content: string; @@ -8,18 +6,18 @@ declare module 'inline:*' { export default content; } -declare module '*.sass' { - const content: string; - - export default content; -} - declare module '*.scss' { const content: string; export default content; } +declare module '*.blp' { + const content: string; + + export default content; +} + declare module '*.css' { const content: string; diff --git a/modules/ags/config/package-lock.json b/modules/ags/config/package-lock.json index 2670ba31..db2e211a 100644 Binary files a/modules/ags/config/package-lock.json and b/modules/ags/config/package-lock.json differ diff --git a/modules/ags/config/package.json b/modules/ags/config/package.json index 3c89ae93..f5950673 100644 --- a/modules/ags/config/package.json +++ b/modules/ags/config/package.json @@ -5,7 +5,6 @@ "dependencies": { "@eslint/js": "9.17.0", "@stylistic/eslint-plugin": "2.12.1", - "@types/node": "22.10.2", "eslint": "9.17.0", "eslint-plugin-jsdoc": "50.6.1", "fzf": "0.5.2", diff --git a/modules/ags/gtk4/env.d.ts b/modules/ags/gtk4/env.d.ts index 467c0a41..9cdf81ce 100644 --- a/modules/ags/gtk4/env.d.ts +++ b/modules/ags/gtk4/env.d.ts @@ -1,21 +1,25 @@ -declare const SRC: string +declare const SRC: string; -declare module "inline:*" { - const content: string - export default content +declare module 'inline:*' { + const content: string; + + export default content; } -declare module "*.scss" { - const content: string - export default content +declare module '*.scss' { + const content: string; + + export default content; } -declare module "*.blp" { - const content: string - export default content +declare module '*.blp' { + const content: string; + + export default content; } -declare module "*.css" { - const content: string - export default content +declare module '*.css' { + const content: string; + + export default content; } diff --git a/modules/ags/gtk4/package-lock.json b/modules/ags/gtk4/package-lock.json deleted file mode 100644 index 2670ba31..00000000 Binary files a/modules/ags/gtk4/package-lock.json and /dev/null differ diff --git a/modules/ags/gtk4/package-lock.json b/modules/ags/gtk4/package-lock.json new file mode 120000 index 00000000..a908665d --- /dev/null +++ b/modules/ags/gtk4/package-lock.json @@ -0,0 +1 @@ +../config/package-lock.json \ No newline at end of file diff --git a/modules/ags/gtk4/package.json b/modules/ags/gtk4/package.json deleted file mode 100644 index 3c89ae93..00000000 --- a/modules/ags/gtk4/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "ags", - "version": "0.0.0", - "main": "app.ts", - "dependencies": { - "@eslint/js": "9.17.0", - "@stylistic/eslint-plugin": "2.12.1", - "@types/node": "22.10.2", - "eslint": "9.17.0", - "eslint-plugin-jsdoc": "50.6.1", - "fzf": "0.5.2", - "jiti": "2.4.2", - "typescript-eslint": "8.19.0" - } -} diff --git a/modules/ags/gtk4/package.json b/modules/ags/gtk4/package.json new file mode 120000 index 00000000..f3ea5f3b --- /dev/null +++ b/modules/ags/gtk4/package.json @@ -0,0 +1 @@ +../config/package.json \ No newline at end of file diff --git a/modules/ags/packages.nix b/modules/ags/packages.nix index 7e8fb9a5..b91672f2 100644 --- a/modules/ags/packages.nix +++ b/modules/ags/packages.nix @@ -5,11 +5,11 @@ self: { pkgs, ... }: let - inherit (self.inputs) ags gtk-session-lock; + inherit (self.inputs) ags astal gtk-session-lock; gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default; - inherit (lib) attrValues boolToString getExe optionalAttrs optionals; + inherit (lib) attrValues boolToString filter getExe optionalAttrs optionals; inherit (osConfig.networking) hostName; @@ -37,7 +37,7 @@ in { }; astalLibs = attrValues { inherit - (ags.inputs.astal.packages.${pkgs.system}) + (astal.packages.${pkgs.system}) io astal3 astal4 @@ -59,6 +59,7 @@ in { inherit (pkgs) + libadwaita gtk4 # Needed to build types ; }; @@ -118,7 +119,7 @@ in { ; mkTsConf = gtkVer: let - inherit (ags.packages.${pkgs.system}) gjs; + inherit (astal.packages.${pkgs.system}) gjs; in pkgs.writers.writeJSON "tsconfig.json" { "$schema" = "https://json.schemastore.org/tsconfig"; @@ -127,6 +128,7 @@ in { "strict" = true; "target" = "ES2022"; "module" = "ES2022"; + "lib" = ["ES2022"]; "moduleResolution" = "Bundler"; "noEmit" = true; "jsx" = "react-jsx"; @@ -141,19 +143,28 @@ in { (buildGirTypes { pname = "ags"; configPath = "${cfg.configDir}/@girs"; - packages = cfg.astalLibs; + packages = filter (x: + x.pname != "astal4" && x.pname != "libadwaita") + cfg.astalLibs; + delete = ["gdk-4.0" "gtk-4.0" "gsk-4.0"]; }) // (buildGirTypes { pname = "ags"; configPath = "${gtk4ConfigDir}/@girs"; - packages = cfg.astalLibs; + packages = filter (x: + x.pname != "astal3" && x.pname != "gtk-session-lock") + cfg.astalLibs; }) // { - "${cfg.configDir}/node_modules".source = - buildNodeModules ./config (import ./config).npmDepsHash; + "${cfg.configDir}/node_modules" = { + force = true; + source = buildNodeModules ./config (import ./config).npmDepsHash; + }; - "${gtk4ConfigDir}/node_modules".source = - buildNodeModules ./config (import ./config).npmDepsHash; + "${gtk4ConfigDir}/node_modules" = { + force = true; + source = buildNodeModules ./config (import ./config).npmDepsHash; + }; "${cfg.configDir}/tsconfig.json".source = mkTsConf 3;