mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
nix vm: add documentation, add Gnome/X11 VM
This commit is contained in:
@ -77,3 +77,58 @@ pull request will be accepted with a high degree of certainty.
|
|||||||
> **Pull requests are NOT a place to discuss feature design.** Please do
|
> **Pull requests are NOT a place to discuss feature design.** Please do
|
||||||
> not open a WIP pull request to discuss a feature. Instead, use a discussion
|
> not open a WIP pull request to discuss a feature. Instead, use a discussion
|
||||||
> and link to your branch.
|
> and link to your branch.
|
||||||
|
|
||||||
|
## Nix Virtual Machines
|
||||||
|
|
||||||
|
Several Nix virtual machine definitions are provided by the project for testing
|
||||||
|
and developing Ghostty against multiple different Linux desktop environments.
|
||||||
|
|
||||||
|
Running these requires a working Nix installation, either Nix on your
|
||||||
|
favorite Linux distribution, NixOS, or macOS with nix-darwin installed. Futher
|
||||||
|
requirements for macOS are detailed below.
|
||||||
|
|
||||||
|
VMs should only be run on your local desktop and then powered off when not in
|
||||||
|
use, which will discard any changes to the VM.
|
||||||
|
|
||||||
|
The VM definitions provide minimal software "out of the box" but additional
|
||||||
|
software can be installed by using standard Nix mechanisms like `nix run nixpkgs#<package>`.
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
|
||||||
|
1. Check out the Ghostty source and change to the directory.
|
||||||
|
2. Run `nix run .#<vmtype>`. `<vmtype>` can be any of the VMs defined in the
|
||||||
|
`nix/vm` directory (without the `.nix` suffix) excluding any file prefixed
|
||||||
|
with `common`.
|
||||||
|
3. The VM will build and then launch. Depending on the speed of your system, this
|
||||||
|
can take a while, but eventually you should get a new VM window.
|
||||||
|
4. The Ghostty source directory should be mounted to `/tmp/shared` in the VM. Depending
|
||||||
|
on what UID and GID of the user that you launched the VM as, `/tmp/shared` _may_ be
|
||||||
|
writable by the VM user, so be careful!
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
1. To run the VMs on macOS you will need to enable the Linux builder in your `nix-darwin`
|
||||||
|
config. This _should_ be as simple as adding `nix.linux-builder.enable=true` to your
|
||||||
|
configuration and then rebuilding. See [this](https://nixcademy.com/posts/macos-linux-builder/)
|
||||||
|
blog post for more information about the Linux builder and how to tune the performance.
|
||||||
|
2. Once the Linux builder has been enabled, you should be able to follow the Linux instructions
|
||||||
|
above to launch a VM.
|
||||||
|
|
||||||
|
### Contributing new VM definitions
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
We welcome the contribution of new VM definitions, as long as they meet the following criteria:
|
||||||
|
|
||||||
|
1. The should be different enough from existing VM definitions that they represent a distinct
|
||||||
|
user (and developer) experience.
|
||||||
|
2. There's a significant Ghostty user population that uses a similar environment.
|
||||||
|
3. The VMs can be built using only packages from the current stable NixOS release.
|
||||||
|
|
||||||
|
#### VM Definition Criteria
|
||||||
|
|
||||||
|
1. VMs should be as minimal as possible so that they build and launch quickly.
|
||||||
|
Additonal software can be added at runtime with a command like `nix run nixpkgs#<package name>`.
|
||||||
|
2. VMs should not expose any services to the network, or run any remote access
|
||||||
|
software like SSH, VNC or RDP.
|
||||||
|
3. VMs should auto-login using the "ghostty" user.
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
);
|
);
|
||||||
in {
|
in {
|
||||||
"wayland-gnome-${system}" = makeVM ./nix/vm/wayland-gnome.nix;
|
"wayland-gnome-${system}" = makeVM ./nix/vm/wayland-gnome.nix;
|
||||||
|
"x11-gnome-${system}" = makeVM ./nix/vm/x11-gnome.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
apps.${system} = let
|
apps.${system} = let
|
||||||
@ -98,6 +99,7 @@
|
|||||||
);
|
);
|
||||||
in {
|
in {
|
||||||
wayland-gnome = wrapVM "wayland-gnome";
|
wayland-gnome = wrapVM "wayland-gnome";
|
||||||
|
x11-gnome = wrapVM "x11-gnome";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
# Our supported systems are the same supported systems as the Zig binaries.
|
# Our supported systems are the same supported systems as the Zig binaries.
|
||||||
|
133
nix/vm/common-gnome.nix
Normal file
133
nix/vm/common-gnome.nix
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
displayManager = {
|
||||||
|
gdm = {
|
||||||
|
enable = true;
|
||||||
|
autoSuspend = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
desktopManager = {
|
||||||
|
gnome = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.gnomeExtensions.no-overview
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.gnome.excludePackages = with pkgs; [
|
||||||
|
atomix
|
||||||
|
baobab
|
||||||
|
cheese
|
||||||
|
epiphany
|
||||||
|
evince
|
||||||
|
file-roller
|
||||||
|
geary
|
||||||
|
gnome-backgrounds
|
||||||
|
gnome-calculator
|
||||||
|
gnome-calendar
|
||||||
|
gnome-clocks
|
||||||
|
gnome-connections
|
||||||
|
gnome-contacts
|
||||||
|
gnome-disk-utility
|
||||||
|
gnome-extension-manager
|
||||||
|
gnome-logs
|
||||||
|
gnome-maps
|
||||||
|
gnome-music
|
||||||
|
gnome-photos
|
||||||
|
gnome-software
|
||||||
|
gnome-system-monitor
|
||||||
|
gnome-text-editor
|
||||||
|
gnome-themes-extra
|
||||||
|
gnome-tour
|
||||||
|
gnome-user-docs
|
||||||
|
gnome-weather
|
||||||
|
hitori
|
||||||
|
iagno
|
||||||
|
loupe
|
||||||
|
nautilus
|
||||||
|
orca
|
||||||
|
seahorse
|
||||||
|
simple-scan
|
||||||
|
snapshot
|
||||||
|
sushi
|
||||||
|
tali
|
||||||
|
totem
|
||||||
|
yelp
|
||||||
|
];
|
||||||
|
|
||||||
|
services.gnome = {
|
||||||
|
gnome-browser-connector.enable = false;
|
||||||
|
gnome-initial-setup.enable = false;
|
||||||
|
gnome-online-accounts.enable = false;
|
||||||
|
gnome-remote-desktop.enable = false;
|
||||||
|
rygel.enable = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
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/interface" = {
|
||||||
|
color-scheme = "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
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.geary.enable = false;
|
||||||
|
}
|
@ -11,6 +11,18 @@
|
|||||||
virtualisation.memorySize = 2048;
|
virtualisation.memorySize = 2048;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
settings = {
|
||||||
|
trusted-users = [
|
||||||
|
"root"
|
||||||
|
"ghostty"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
extraOptions = ''
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
users.mutableUsers = true;
|
users.mutableUsers = true;
|
||||||
|
|
||||||
users.groups.ghostty = {
|
users.groups.ghostty = {
|
||||||
@ -26,10 +38,27 @@
|
|||||||
initialPassword = "ghostty";
|
initialPassword = "ghostty";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.etc = {
|
||||||
|
"xdg/autostart/com.mitchellh.ghostty.desktop" = {
|
||||||
|
source = "${pkgs.ghostty}/share/applications/com.mitchellh.ghostty.desktop";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
pkgs.kitty
|
pkgs.kitty
|
||||||
pkgs.ghostty
|
pkgs.ghostty
|
||||||
|
pkgs.zig_0_13
|
||||||
];
|
];
|
||||||
|
|
||||||
|
services.displayManager = {
|
||||||
|
autoLogin = {
|
||||||
|
user = "ghostty";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
system.stateVersion = "24.11";
|
system.stateVersion = "24.11";
|
||||||
}
|
}
|
||||||
|
@ -1,145 +1,9 @@
|
|||||||
{
|
{...}: {
|
||||||
config,
|
imports = [
|
||||||
lib,
|
./common-gnome.nix
|
||||||
pkgs,
|
];
|
||||||
...
|
|
||||||
}: {
|
|
||||||
services.displayManager = {
|
services.displayManager = {
|
||||||
autoLogin = {
|
defaultSession = "gnome";
|
||||||
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
|
|
||||||
baobab
|
|
||||||
cheese
|
|
||||||
epiphany
|
|
||||||
evince
|
|
||||||
file-roller
|
|
||||||
geary
|
|
||||||
gnome-backgrounds
|
|
||||||
gnome-calculator
|
|
||||||
gnome-calendar
|
|
||||||
gnome-clocks
|
|
||||||
gnome-connections
|
|
||||||
gnome-contacts
|
|
||||||
gnome-disk-utility
|
|
||||||
gnome-extension-manager
|
|
||||||
gnome-logs
|
|
||||||
gnome-maps
|
|
||||||
gnome-music
|
|
||||||
gnome-photos
|
|
||||||
gnome-software
|
|
||||||
gnome-system-monitor
|
|
||||||
gnome-text-editor
|
|
||||||
gnome-themes-extra
|
|
||||||
gnome-tour
|
|
||||||
gnome-user-docs
|
|
||||||
gnome-weather
|
|
||||||
hitori
|
|
||||||
iagno
|
|
||||||
loupe
|
|
||||||
nautilus
|
|
||||||
orca
|
|
||||||
seahorse
|
|
||||||
simple-scan
|
|
||||||
snapshot
|
|
||||||
sushi
|
|
||||||
tali
|
|
||||||
totem
|
|
||||||
yelp
|
|
||||||
];
|
|
||||||
|
|
||||||
services.gnome = {
|
|
||||||
gnome-browser-connector.enable = false;
|
|
||||||
gnome-initial-setup.enable = false;
|
|
||||||
gnome-online-accounts.enable = false;
|
|
||||||
gnome-remote-desktop.enable = false;
|
|
||||||
rygel.enable = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
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/interface" = {
|
|
||||||
color-scheme = "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
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.geary.enable = false;
|
|
||||||
}
|
}
|
||||||
|
9
nix/vm/x11-gnome.nix
Normal file
9
nix/vm/x11-gnome.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./common-gnome.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
services.displayManager = {
|
||||||
|
defaultSession = "gnome-xorg";
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user