diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 037c7bb15..ea2850f3a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,7 @@ jobs: - alejandra - typos - translations + - blueprint-compiler - test-pkg-linux - test-debian-12 steps: @@ -702,6 +703,35 @@ jobs: msgcmp --use-untranslated "$f" po/com.mitchellh.ghostty.pot; done + blueprint-compiler: + if: github.repository == 'ghostty-org/ghostty' + runs-on: namespace-profile-ghostty-sm + timeout-minutes: 60 + env: + ZIG_LOCAL_CACHE_DIR: /zig/local-cache + ZIG_GLOBAL_CACHE_DIR: /zig/global-cache + steps: + - uses: actions/checkout@v4 # Check out repo so we can lint it + - name: Setup Cache + uses: namespacelabs/nscloud-cache-action@v1.2.0 + with: + path: | + /nix + /zig + - uses: cachix/install-nix-action@v30 + with: + nix_path: nixpkgs=channel:nixos-unstable + - uses: cachix/cachix-action@v15 + with: + name: ghostty + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + skipPush: true + useDaemon: false # sometimes fails on short jobs + - name: check blueprints + run: nix develop -c ./nix/build-support/check-blueprints.sh + - name: check unchanged + run: git diff --exit-code + test-pkg-linux: strategy: fail-fast: false diff --git a/flake.nix b/flake.nix index fc8daf201..c8e53d7e9 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,8 @@ devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix { zig = zig.packages.${system}."0.14.0"; wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {}; + # remove once blueprint-compiler 0.16.0 is in the stable nixpkgs + blueprint-compiler = pkgs-unstable.blueprint-compiler; zon2nix = zon2nix; }; diff --git a/nix/build-support/build-inputs.nix b/nix/build-support/build-inputs.nix new file mode 100644 index 000000000..5886cfe30 --- /dev/null +++ b/nix/build-support/build-inputs.nix @@ -0,0 +1,43 @@ +{ + pkgs, + lib, + stdenv, + enableX11 ? true, + enableWayland ? true, +}: +[ + pkgs.libGL +] +++ lib.optionals stdenv.hostPlatform.isLinux [ + pkgs.bzip2 + pkgs.expat + pkgs.fontconfig + pkgs.freetype + pkgs.harfbuzz + pkgs.libpng + pkgs.libxml2 + pkgs.oniguruma + pkgs.simdutf + pkgs.zlib + + pkgs.glslang + pkgs.spirv-cross + + pkgs.libxkbcommon + + pkgs.glib + pkgs.gobject-introspection + pkgs.gsettings-desktop-schemas + pkgs.gtk4 + pkgs.libadwaita +] +++ lib.optionals (stdenv.hostPlatform.isLinux && enableX11) [ + pkgs.xorg.libX11 + pkgs.xorg.libXcursor + pkgs.xorg.libXi + pkgs.xorg.libXrandr +] +++ lib.optionals (stdenv.hostPlatform.isLinux && enableWayland) [ + pkgs.gtk4-layer-shell + pkgs.wayland +] diff --git a/nix/build-support/check-blueprints.sh b/nix/build-support/check-blueprints.sh new file mode 100755 index 000000000..8325981c0 --- /dev/null +++ b/nix/build-support/check-blueprints.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -o nounset -o pipefail -o errexit + +find src -name \*.blp -exec blueprint-compiler format {} \+ +find src -name \*.blp -exec blueprint-compiler compile --output=/dev/null {} \; diff --git a/nix/build-support/gi-typelib-path.nix b/nix/build-support/gi-typelib-path.nix new file mode 100644 index 000000000..2e9533cbf --- /dev/null +++ b/nix/build-support/gi-typelib-path.nix @@ -0,0 +1,17 @@ +{ + pkgs, + lib, + stdenv, +}: +lib.makeSearchPath "lib/girepository-1.0" (map (lib.getOutput "lib") (lib.optionals stdenv.hostPlatform.isLinux [ + pkgs.cairo + pkgs.gdk-pixbuf + pkgs.glib + pkgs.gobject-introspection + pkgs.graphene + pkgs.gtk4 + pkgs.gtk4-layer-shell + pkgs.harfbuzz + pkgs.libadwaita + pkgs.pango +])) diff --git a/nix/build-support/ld-library-path.nix b/nix/build-support/ld-library-path.nix new file mode 100644 index 000000000..b90a56d93 --- /dev/null +++ b/nix/build-support/ld-library-path.nix @@ -0,0 +1,10 @@ +{ + pkgs, + lib, + stdenv, + enableX11 ? true, + enableWayland ? true, +}: +lib.makeLibraryPath (import ./build-inputs.nix { + inherit pkgs lib stdenv enableX11 enableWayland; +}) diff --git a/nix/devShell.nix b/nix/devShell.nix index 4acadad97..48b884bca 100644 --- a/nix/devShell.nix +++ b/nix/devShell.nix @@ -40,7 +40,6 @@ hicolor-icon-theme, harfbuzz, libpng, - libGL, libxkbcommon, libX11, libXcursor, @@ -63,44 +62,18 @@ wayland-protocols, zon2nix, system, + pkgs, }: let # See package.nix. Keep in sync. - rpathLibs = - [ - libGL - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - bzip2 - expat - fontconfig - freetype - harfbuzz - libpng - libxml2 - oniguruma - simdutf - zlib - - glslang - spirv-cross - - libxkbcommon - libX11 - libXcursor - libXi - libXrandr - - libadwaita - gtk4 - gtk4-layer-shell - glib - gobject-introspection - wayland - ]; + ld_library_path = import ./build-support/ld-library-path.nix { + inherit pkgs lib stdenv; + }; + gi_typelib_path = import ./build-support/gi-typelib-path.nix { + inherit pkgs lib stdenv; + }; in mkShell { name = "ghostty"; - packages = [ # For builds @@ -186,7 +159,8 @@ in # This should be set onto the rpath of the ghostty binary if you want # it to be "portable" across the system. - LD_LIBRARY_PATH = lib.makeLibraryPath rpathLibs; + LD_LIBRARY_PATH = ld_library_path; + GI_TYPELIB_PATH = gi_typelib_path; shellHook = (lib.optionalString stdenv.hostPlatform.isLinux '' diff --git a/nix/package.nix b/nix/package.nix index 62d722d5e..46bf18122 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,26 +1,12 @@ { lib, stdenv, - bzip2, callPackage, - expat, - fontconfig, - freetype, - harfbuzz, - libpng, - oniguruma, - zlib, - libGL, - glib, - gtk4, - gtk4-layer-shell, gobject-introspection, - libadwaita, blueprint-compiler, libxml2, gettext, wrapGAppsHook4, - gsettings-desktop-schemas, git, ncurses, pkg-config, @@ -29,14 +15,10 @@ revision ? "dirty", optimize ? "Debug", enableX11 ? true, - libX11, - libXcursor, - libXi, - libXrandr, enableWayland ? true, - wayland, wayland-protocols, wayland-scanner, + pkgs, }: let # The Zig hook has no way to select the release type without actual # overriding of the default flags. @@ -48,6 +30,12 @@ zig_hook = zig_0_14.hook.overrideAttrs { zig_default_flags = "-Dcpu=baseline -Doptimize=${optimize} --color off"; }; + gi_typelib_path = import ./build-support/gi-typelib-path.nix { + inherit pkgs lib stdenv; + }; + buildInputs = import ./build-support/build-inputs.nix { + inherit pkgs lib stdenv enableX11 enableWayland; + }; in stdenv.mkDerivation (finalAttrs: { pname = "ghostty"; @@ -96,38 +84,12 @@ in wayland-protocols ]; - buildInputs = - [ - libGL - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - bzip2 - expat - fontconfig - freetype - harfbuzz - libpng - oniguruma - zlib - - libadwaita - gtk4 - glib - gsettings-desktop-schemas - ] - ++ lib.optionals enableX11 [ - libX11 - libXcursor - libXi - libXrandr - ] - ++ lib.optionals enableWayland [ - gtk4-layer-shell - wayland - ]; + buildInputs = buildInputs; dontConfigure = true; + GI_TYPELIB_PATH = gi_typelib_path; + zigBuildFlags = [ "--system" "${finalAttrs.deps}" diff --git a/src/apprt/gtk/ui/1.2/ccw-osc-52-read.blp b/src/apprt/gtk/ui/1.2/ccw-osc-52-read.blp index c76b69884..b250073d2 100644 --- a/src/apprt/gtk/ui/1.2/ccw-osc-52-read.blp +++ b/src/apprt/gtk/ui/1.2/ccw-osc-52-read.blp @@ -8,7 +8,7 @@ Adw.MessageDialog clipboard_confirmation_window { responses [ cancel: _("Deny") suggested, - ok: _("Allow") destructive + ok: _("Allow") destructive, ] default-response: "cancel"; @@ -16,7 +16,7 @@ Adw.MessageDialog clipboard_confirmation_window { extra-child: Overlay { styles [ - "osd" + "osd", ] ScrolledWindow text_view_scroll { @@ -33,7 +33,7 @@ Adw.MessageDialog clipboard_confirmation_window { right-margin: 8; styles [ - "clipboard-content-view" + "clipboard-content-view", ] } } @@ -60,7 +60,7 @@ Adw.MessageDialog clipboard_confirmation_window { margin-top: 12; styles [ - "opaque" + "opaque", ] Image { diff --git a/src/apprt/gtk/ui/1.2/ccw-osc-52-write.blp b/src/apprt/gtk/ui/1.2/ccw-osc-52-write.blp index 529a2fc52..d880df5f2 100644 --- a/src/apprt/gtk/ui/1.2/ccw-osc-52-write.blp +++ b/src/apprt/gtk/ui/1.2/ccw-osc-52-write.blp @@ -8,7 +8,7 @@ Adw.MessageDialog clipboard_confirmation_window { responses [ cancel: _("Deny") suggested, - ok: _("Allow") destructive + ok: _("Allow") destructive, ] default-response: "cancel"; @@ -16,7 +16,7 @@ Adw.MessageDialog clipboard_confirmation_window { extra-child: Overlay { styles [ - "osd" + "osd", ] ScrolledWindow text_view_scroll { @@ -33,7 +33,7 @@ Adw.MessageDialog clipboard_confirmation_window { right-margin: 8; styles [ - "clipboard-content-view" + "clipboard-content-view", ] } } @@ -60,7 +60,7 @@ Adw.MessageDialog clipboard_confirmation_window { margin-top: 12; styles [ - "opaque" + "opaque", ] Image { diff --git a/src/apprt/gtk/ui/1.2/ccw-paste.blp b/src/apprt/gtk/ui/1.2/ccw-paste.blp index 3ca12e966..f26921803 100644 --- a/src/apprt/gtk/ui/1.2/ccw-paste.blp +++ b/src/apprt/gtk/ui/1.2/ccw-paste.blp @@ -8,7 +8,7 @@ Adw.MessageDialog clipboard_confirmation_window { responses [ cancel: _("Cancel") suggested, - ok: _("Paste") destructive + ok: _("Paste") destructive, ] default-response: "cancel"; @@ -16,7 +16,7 @@ Adw.MessageDialog clipboard_confirmation_window { extra-child: Overlay { styles [ - "osd" + "osd", ] ScrolledWindow text_view_scroll { @@ -33,7 +33,7 @@ Adw.MessageDialog clipboard_confirmation_window { right-margin: 8; styles [ - "clipboard-content-view" + "clipboard-content-view", ] } } @@ -60,7 +60,7 @@ Adw.MessageDialog clipboard_confirmation_window { margin-top: 12; styles [ - "opaque" + "opaque", ] Image { diff --git a/src/apprt/gtk/ui/1.2/config-errors-dialog.blp b/src/apprt/gtk/ui/1.2/config-errors-dialog.blp index 4f750a3be..b844d6347 100644 --- a/src/apprt/gtk/ui/1.2/config-errors-dialog.blp +++ b/src/apprt/gtk/ui/1.2/config-errors-dialog.blp @@ -2,27 +2,27 @@ using Gtk 4.0; using Adw 1; Adw.MessageDialog config_errors_dialog { - heading: _("Configuration Errors"); - body: _("One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors."); + heading: _("Configuration Errors"); + body: _("One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors."); - responses [ - ignore: _("Ignore"), - reload: _("Reload Configuration") suggested, - ] + responses [ + ignore: _("Ignore"), + reload: _("Reload Configuration") suggested, + ] - extra-child: ScrolledWindow { - min-content-width: 500; - min-content-height: 100; - - TextView { - editable: false; - cursor-visible: false; - top-margin: 8; - bottom-margin: 8; - left-margin: 8; - right-margin: 8; + extra-child: ScrolledWindow { + min-content-width: 500; + min-content-height: 100; - buffer: TextBuffer error_message { }; - } - }; + TextView { + editable: false; + cursor-visible: false; + top-margin: 8; + bottom-margin: 8; + left-margin: 8; + right-margin: 8; + + buffer: TextBuffer error_message {}; + } + }; } diff --git a/src/apprt/gtk/ui/1.5/ccw-osc-52-read.blp b/src/apprt/gtk/ui/1.5/ccw-osc-52-read.blp index 60fca5b00..640556535 100644 --- a/src/apprt/gtk/ui/1.5/ccw-osc-52-read.blp +++ b/src/apprt/gtk/ui/1.5/ccw-osc-52-read.blp @@ -8,7 +8,7 @@ Adw.AlertDialog clipboard_confirmation_window { responses [ cancel: _("Deny") suggested, - ok: _("Allow") destructive + ok: _("Allow") destructive, ] default-response: "cancel"; @@ -16,7 +16,7 @@ Adw.AlertDialog clipboard_confirmation_window { extra-child: Overlay { styles [ - "osd" + "osd", ] ScrolledWindow text_view_scroll { @@ -33,7 +33,7 @@ Adw.AlertDialog clipboard_confirmation_window { right-margin: 8; styles [ - "clipboard-content-view" + "clipboard-content-view", ] } } @@ -60,7 +60,7 @@ Adw.AlertDialog clipboard_confirmation_window { margin-top: 12; styles [ - "opaque" + "opaque", ] Image { diff --git a/src/apprt/gtk/ui/1.5/ccw-osc-52-write.blp b/src/apprt/gtk/ui/1.5/ccw-osc-52-write.blp index 7ef17def0..2e28359ff 100644 --- a/src/apprt/gtk/ui/1.5/ccw-osc-52-write.blp +++ b/src/apprt/gtk/ui/1.5/ccw-osc-52-write.blp @@ -8,7 +8,7 @@ Adw.AlertDialog clipboard_confirmation_window { responses [ cancel: _("Deny") suggested, - ok: _("Allow") destructive + ok: _("Allow") destructive, ] default-response: "cancel"; @@ -16,7 +16,7 @@ Adw.AlertDialog clipboard_confirmation_window { extra-child: Overlay { styles [ - "osd" + "osd", ] ScrolledWindow text_view_scroll { @@ -33,7 +33,7 @@ Adw.AlertDialog clipboard_confirmation_window { right-margin: 8; styles [ - "clipboard-content-view" + "clipboard-content-view", ] } } @@ -60,7 +60,7 @@ Adw.AlertDialog clipboard_confirmation_window { margin-top: 12; styles [ - "opaque" + "opaque", ] Image { diff --git a/src/apprt/gtk/ui/1.5/ccw-paste.blp b/src/apprt/gtk/ui/1.5/ccw-paste.blp index 57539fb44..a5f909526 100644 --- a/src/apprt/gtk/ui/1.5/ccw-paste.blp +++ b/src/apprt/gtk/ui/1.5/ccw-paste.blp @@ -8,7 +8,7 @@ Adw.AlertDialog clipboard_confirmation_window { responses [ cancel: _("Cancel") suggested, - ok: _("Paste") destructive + ok: _("Paste") destructive, ] default-response: "cancel"; @@ -16,7 +16,7 @@ Adw.AlertDialog clipboard_confirmation_window { extra-child: Overlay { styles [ - "osd" + "osd", ] ScrolledWindow text_view_scroll { @@ -33,7 +33,7 @@ Adw.AlertDialog clipboard_confirmation_window { right-margin: 8; styles [ - "clipboard-content-view" + "clipboard-content-view", ] } } @@ -60,7 +60,7 @@ Adw.AlertDialog clipboard_confirmation_window { margin-top: 12; styles [ - "opaque" + "opaque", ] Image { diff --git a/src/apprt/gtk/ui/1.5/config-errors-dialog.blp b/src/apprt/gtk/ui/1.5/config-errors-dialog.blp index e6d81c0df..793e9295a 100644 --- a/src/apprt/gtk/ui/1.5/config-errors-dialog.blp +++ b/src/apprt/gtk/ui/1.5/config-errors-dialog.blp @@ -2,27 +2,27 @@ using Gtk 4.0; using Adw 1; Adw.AlertDialog config_errors_dialog { - heading: _("Configuration Errors"); - body: _("One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors."); + heading: _("Configuration Errors"); + body: _("One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors."); - responses [ - ignore: _("Ignore"), - reload: _("Reload Configuration") suggested, - ] + responses [ + ignore: _("Ignore"), + reload: _("Reload Configuration") suggested, + ] - extra-child: ScrolledWindow { - min-content-width: 500; - min-content-height: 100; - - TextView { - editable: false; - cursor-visible: false; - top-margin: 8; - bottom-margin: 8; - left-margin: 8; - right-margin: 8; + extra-child: ScrolledWindow { + min-content-width: 500; + min-content-height: 100; - buffer: TextBuffer error_message { }; - } - }; + TextView { + editable: false; + cursor-visible: false; + top-margin: 8; + bottom-margin: 8; + left-margin: 8; + right-margin: 8; + + buffer: TextBuffer error_message {}; + } + }; } diff --git a/src/apprt/gtk/ui/1.5/prompt-title-dialog.blp b/src/apprt/gtk/ui/1.5/prompt-title-dialog.blp index ffe38c980..d23594ba4 100644 --- a/src/apprt/gtk/ui/1.5/prompt-title-dialog.blp +++ b/src/apprt/gtk/ui/1.5/prompt-title-dialog.blp @@ -7,7 +7,7 @@ Adw.AlertDialog prompt_title_dialog { responses [ cancel: _("Cancel") suggested, - ok: _("OK") destructive + ok: _("OK") destructive, ] focus-widget: title_entry;