mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
nix: vms for testing ghostty
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,3 +17,4 @@ test/cases/**/*.actual.png
|
|||||||
glad.zip
|
glad.zip
|
||||||
/Box_test.ppm
|
/Box_test.ppm
|
||||||
/Box_test_diff.ppm
|
/Box_test_diff.ppm
|
||||||
|
/ghostty.qcow2
|
||||||
|
97
flake.nix
97
flake.nix
@ -31,37 +31,84 @@
|
|||||||
zig,
|
zig,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
builtins.foldl' nixpkgs-stable.lib.recursiveUpdate {} (builtins.map (system: let
|
builtins.foldl' nixpkgs-stable.lib.recursiveUpdate {} (
|
||||||
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
builtins.map (
|
||||||
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
system: let
|
||||||
in {
|
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
||||||
devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix {
|
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
||||||
zig = zig.packages.${system}."0.13.0";
|
in {
|
||||||
wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {};
|
devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix {
|
||||||
};
|
zig = zig.packages.${system}."0.13.0";
|
||||||
|
wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {};
|
||||||
|
};
|
||||||
|
|
||||||
packages.${system} = let
|
packages.${system} = let
|
||||||
mkArgs = optimize: {
|
mkArgs = optimize: {
|
||||||
inherit optimize;
|
inherit optimize;
|
||||||
|
|
||||||
revision = self.shortRev or self.dirtyShortRev or "dirty";
|
revision = self.shortRev or self.dirtyShortRev or "dirty";
|
||||||
};
|
};
|
||||||
in rec {
|
in rec {
|
||||||
ghostty-debug = pkgs-stable.callPackage ./nix/package.nix (mkArgs "Debug");
|
ghostty-debug = pkgs-stable.callPackage ./nix/package.nix (mkArgs "Debug");
|
||||||
ghostty-releasesafe = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseSafe");
|
ghostty-releasesafe = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseSafe");
|
||||||
ghostty-releasefast = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseFast");
|
ghostty-releasefast = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseFast");
|
||||||
|
|
||||||
ghostty = ghostty-releasefast;
|
ghostty = ghostty-releasefast;
|
||||||
default = ghostty;
|
default = ghostty;
|
||||||
};
|
};
|
||||||
|
|
||||||
formatter.${system} = pkgs-stable.alejandra;
|
formatter.${system} = pkgs-stable.alejandra;
|
||||||
|
|
||||||
# Our supported systems are the same supported systems as the Zig binaries.
|
nixosConfigurations = let
|
||||||
}) (builtins.attrNames zig.packages))
|
makeVM = (
|
||||||
|
path:
|
||||||
|
nixpkgs-stable.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
self.overlays.debug
|
||||||
|
];
|
||||||
|
}
|
||||||
|
./nix/vm/common.nix
|
||||||
|
path
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in {
|
||||||
|
"wayland-gnome-${system}" = makeVM ./nix/vm/wayland-gnome.nix;
|
||||||
|
};
|
||||||
|
|
||||||
|
apps.${system} = let
|
||||||
|
wrapVM = (
|
||||||
|
name: let
|
||||||
|
program = pkgs-stable.writeShellScript "run-ghostty-vm" ''
|
||||||
|
SHARED_DIR=$(pwd)
|
||||||
|
export SHARED_DIR
|
||||||
|
|
||||||
|
${self.nixosConfigurations."${name}-${system}".config.system.build.vm}/bin/run-ghostty-vm
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
type = "app";
|
||||||
|
program = "${program}";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in {
|
||||||
|
wayland-gnome = wrapVM "wayland-gnome";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
# Our supported systems are the same supported systems as the Zig binaries.
|
||||||
|
) (builtins.attrNames zig.packages)
|
||||||
|
)
|
||||||
// {
|
// {
|
||||||
overlays.default = final: prev: {
|
overlays = {
|
||||||
ghostty = self.packages.${prev.system}.default;
|
default = self.overlays.releasefast;
|
||||||
|
releasefast = final: prev: {
|
||||||
|
ghostty = self.packages.${prev.system}.ghostty-releasefast;
|
||||||
|
};
|
||||||
|
debug = final: prev: {
|
||||||
|
ghostty = self.packages.${prev.system}.ghostty-debug;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
33
nix/vm/common.nix
Normal file
33
nix/vm/common.nix
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{pkgs, ...}: {
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
|
networking.hostName = "ghostty";
|
||||||
|
networking.domain = "mitchellh.com";
|
||||||
|
|
||||||
|
virtualisation.vmVariant = {
|
||||||
|
virtualisation.memorySize = 2048;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.mutableUsers = true;
|
||||||
|
|
||||||
|
users.groups.ghostty = {
|
||||||
|
gid = 1000;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.ghostty = {
|
||||||
|
description = "Ghostty";
|
||||||
|
uid = 1000;
|
||||||
|
group = "ghostty";
|
||||||
|
extraGroups = ["wheel"];
|
||||||
|
isNormalUser = true;
|
||||||
|
initialPassword = "ghostty";
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.kitty
|
||||||
|
pkgs.ghostty
|
||||||
|
];
|
||||||
|
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
}
|
107
nix/vm/wayland-gnome.nix
Normal file
107
nix/vm/wayland-gnome.nix
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
services.displayManager = {
|
||||||
|
autoLogin = {
|
||||||
|
user = "ghostty";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
displayManager = {
|
||||||
|
gdm = {
|
||||||
|
enable = true;
|
||||||
|
autoSuspend = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
desktopManager = {
|
||||||
|
gnome = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.etc = {
|
||||||
|
"xdg/autostart/com.mitchellh.ghostty.desktop" = {
|
||||||
|
source = "${pkgs.ghostty}/share/applications/com.mitchellh.ghostty.desktop";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.gnomeExtensions.no-overview
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.gnome.excludePackages = with pkgs; [
|
||||||
|
atomix
|
||||||
|
cheese
|
||||||
|
epiphany
|
||||||
|
geary
|
||||||
|
gnome-music
|
||||||
|
gnome-photos
|
||||||
|
gnome-tour
|
||||||
|
hitori
|
||||||
|
iagno
|
||||||
|
tali
|
||||||
|
];
|
||||||
|
|
||||||
|
system.activationScripts = {
|
||||||
|
face = {
|
||||||
|
text = ''
|
||||||
|
mkdir -p /var/lib/AccountsService/{icons,users}
|
||||||
|
|
||||||
|
cp ${pkgs.ghostty}/share/icons/hicolor/1024x1024/apps/com.mitchellh.ghostty.png /var/lib/AccountsService/icons/ghostty
|
||||||
|
|
||||||
|
echo -e "[User]\nIcon=/var/lib/AccountsService/icons/ghostty\n" > /var/lib/AccountsService/users/ghostty
|
||||||
|
|
||||||
|
chown root:root /var/lib/AccountsService/users/ghostty
|
||||||
|
chmod 0600 /var/lib/AccountsService/users/ghostty
|
||||||
|
|
||||||
|
chown root:root /var/lib/AccountsService/icons/ghostty
|
||||||
|
chmod 0444 /var/lib/AccountsService/icons/ghostty
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.dconf = {
|
||||||
|
enable = true;
|
||||||
|
profiles.user.databases = [
|
||||||
|
{
|
||||||
|
settings = with lib.gvariant; {
|
||||||
|
"org/gnome/desktop/background" = {
|
||||||
|
picture-uri = "file://${pkgs.ghostty}/share/icons/hicolor/512x512/apps/com.mitchellh.ghostty.png";
|
||||||
|
picture-uri-dark = "file://${pkgs.ghostty}/share/icons/hicolor/512x512/apps/com.mitchellh.ghostty.png";
|
||||||
|
picture-options = "centered";
|
||||||
|
primary-color = "#000000000000";
|
||||||
|
secondary-color = "#000000000000";
|
||||||
|
};
|
||||||
|
"org/gnome/desktop/desktop" = {
|
||||||
|
interface = "prefer-dark";
|
||||||
|
};
|
||||||
|
"org/gnome/desktop/notifications" = {
|
||||||
|
show-in-lock-screen = false;
|
||||||
|
};
|
||||||
|
"org/gnome/desktop/screensaver" = {
|
||||||
|
lock-enabled = false;
|
||||||
|
picture-uri = "file://${pkgs.ghostty}/share/icons/hicolor/512x512/apps/com.mitchellh.ghostty.png";
|
||||||
|
picture-options = "centered";
|
||||||
|
primary-color = "#000000000000";
|
||||||
|
secondary-color = "#000000000000";
|
||||||
|
};
|
||||||
|
"org/gnome/desktop/session" = {
|
||||||
|
idle-delay = mkUint32 0;
|
||||||
|
};
|
||||||
|
"org/gnome/shell" = {
|
||||||
|
disable-user-extensions = false;
|
||||||
|
enabled-extensions = builtins.map (x: x.extensionUuid) (
|
||||||
|
lib.filter (p: p ? extensionUuid) config.environment.systemPackages
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user