Something went wrong. Try again.
A GPU terminal emulator for Wayland and Windows on libghostty-vt, drawing with Vulkan, running a program on a pty or a serial port.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us># SPDX-License-Identifier: MIT
{ description = "harrier: a terminal emulator on libghostty-vt";
inputs = { nixpkgs = { url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"; }; # Turns build.zig.zon into build.zig.zon.nix, so that the package's Zig # dependencies are fetched by Nix rather than by a sandboxed `zig build`. zon2nix = { url = "git+https://git.jcollie.dev/jeff/zon2nix.git"; inputs.nixpkgs.follows = "nixpkgs"; }; # Only for the check that exercises the Home Manager module. home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; };
outputs = { self, nixpkgs, zon2nix, home-manager, ... }: let inherit (nixpkgs) lib; # Linux only: of the platforms harrier has, Wayland is the one Nix builds for. linuxSystems = builtins.filter ( system: (lib.systems.elaborate system).isLinux ) lib.systems.flakeExposed; makePackages = system: import nixpkgs { inherit system; }; forAllSystems = lib.genAttrs linuxSystems; in { packages = forAllSystems ( system: let pkgs = makePackages system; in rec { harrier = pkgs.callPackage ./package.nix { }; default = harrier; # The Windows installer, cross-compiled; what a release publishes. msi = pkgs.callPackage ./msi.nix { inherit harrier; }; # Only the terminfo entry, for a server harrier ssh-es into. harrier-terminfo = pkgs.callPackage ./terminfo.nix { }; # The Zig dependencies on their own, for a job that runs `zig build` # for something other than the package. zig-deps = pkgs.callPackage ./build.zig.zon.nix { }; } );
# programs.harrier: installs harrier, writes its configuration from # inline text or a file -- checked by `harrier validate-config` as it # is built -- and installs the D-Bus and systemd user service. homeModules = rec { harrier = import ./nix/home-manager.nix { inherit (self) packages; }; default = harrier; }; # The name Home Manager used before `homeModules`. homeManagerModules = self.homeModules;
# programs.harrier for NixOS: installs harrier, its D-Bus and systemd # user service, and links the GNOME Shell search provider where the # Shell looks. nixosModules = rec { harrier = import ./nix/nixos.nix { inherit (self) packages; }; default = harrier; };
# A window on a headless compositor, with something drawn in it. checks = lib.genAttrs [ "x86_64-linux" ] ( system: let pkgs = makePackages system; harrier = pkgs.callPackage ./package.nix { }; in { inherit harrier; harrier-terminfo = pkgs.callPackage ./terminfo.nix { }; sway = pkgs.testers.runNixOSTest (import ./tests/nixos/sway.nix { inherit harrier; }); activation = pkgs.testers.runNixOSTest ( import ./tests/nixos/activation.nix { inherit harrier; module = self.nixosModules.harrier; } ); tabs = pkgs.testers.runNixOSTest (import ./tests/nixos/tabs.nix { inherit harrier pkgs; }); splits = pkgs.testers.runNixOSTest (import ./tests/nixos/splits.nix { inherit harrier pkgs; }); foreground = pkgs.testers.runNixOSTest ( import ./tests/nixos/foreground.nix { inherit harrier pkgs; } ); hotkeys = pkgs.testers.runNixOSTest (import ./tests/nixos/hotkeys.nix { inherit harrier pkgs; }); shortcuts = pkgs.testers.runNixOSTest ( import ./tests/nixos/shortcuts.nix { inherit harrier pkgs; } ); portal = pkgs.testers.runNixOSTest (import ./tests/nixos/portal.nix { inherit harrier pkgs; }); dnd = pkgs.testers.runNixOSTest (import ./tests/nixos/dnd.nix { inherit harrier pkgs; }); home-manager = pkgs.testers.runNixOSTest ( import ./tests/nixos/home-manager.nix { inherit home-manager; module = self.homeModules.harrier; } ); # A configuration harrier cannot read fails the build that wanted # it, and says why. config-rejected = let validated = pkgs.callPackage ./nix/validated-config.nix { }; in pkgs.runCommand "harrier-config-rejected" { failed = pkgs.testers.testBuildFailure (validated { inherit harrier; src = pkgs.writeText "bad.struthio" '' .{ .colors = .{ .foreground = "#zzz", .background = if (ctx.appearance.color_scheme == .dark) "#nothex" else "#ffffff", }, .keybind = .{ .{ .keys = "hyper+x", .action = .copy } }, } ''; }); } '' grep -F 'colors.foreground: "#zzz" is not a color' $failed/testBuildFailure.log grep -F 'keybind[0]: "hyper+x" is not a key' $failed/testBuildFailure.log # A mistake under one color scheme only, found and said so. grep -F 'colors.background: "#nothex" is not a color (with color_scheme .dark)' $failed/testBuildFailure.log touch $out ''; } );
devShells = forAllSystems ( system: let pkgs = makePackages system; in { default = pkgs.mkShell { name = "harrier"; # The Vulkan loader is opened at run time, and the validation # layer is found through its manifest. LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.vulkan-loader ]; VK_ADD_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d"; nativeBuildInputs = [ pkgs.zig_0_17 pkgs.ncurses pkgs.vulkan-loader pkgs.vulkan-validation-layers pkgs.vulkan-tools pkgs.git-pages-cli pkgs.reuse # Regenerates build.zig.zon.nix: # tools/zon2nix.sh # It runs `zig env`, so it is wrapped to find this Zig. (pkgs.symlinkJoin { name = "zon2nix"; paths = [ zon2nix.packages.${system}.zon2nix ]; nativeBuildInputs = [ pkgs.makeWrapper ]; postBuild = '' wrapProgram $out/bin/zon2nix \ --prefix PATH : ${lib.makeBinPath [ pkgs.zig_0_17 ]} ''; }) ] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [ pkgs.kcov pkgs.perf ]; }; } ); };}