mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-08 12:28:21 +00:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f9b7ba36d9 |
39
flake.nix
39
flake.nix
@@ -47,6 +47,11 @@
|
|||||||
system: let
|
system: let
|
||||||
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
||||||
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
||||||
|
|
||||||
|
# These are all of our VM tests.
|
||||||
|
tests = import ./nix/tests/default.nix {
|
||||||
|
nixpkgs = pkgs-unstable;
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix {
|
devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix {
|
||||||
zig = zig.packages.${system}."0.14.0";
|
zig = zig.packages.${system}."0.14.0";
|
||||||
@@ -72,6 +77,8 @@
|
|||||||
|
|
||||||
formatter.${system} = pkgs-stable.alejandra;
|
formatter.${system} = pkgs-stable.alejandra;
|
||||||
|
|
||||||
|
checks.${system} = tests;
|
||||||
|
|
||||||
apps.${system} = let
|
apps.${system} = let
|
||||||
runVM = (
|
runVM = (
|
||||||
module: let
|
module: let
|
||||||
@@ -91,15 +98,29 @@
|
|||||||
program = "${program}";
|
program = "${program}";
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in {
|
in
|
||||||
wayland-cinnamon = runVM ./nix/vm/wayland-cinnamon.nix;
|
{
|
||||||
wayland-gnome = runVM ./nix/vm/wayland-gnome.nix;
|
wayland-cinnamon = runVM ./nix/vm/wayland-cinnamon.nix;
|
||||||
wayland-plasma6 = runVM ./nix/vm/wayland-plasma6.nix;
|
wayland-gnome = runVM ./nix/vm/wayland-gnome.nix;
|
||||||
x11-cinnamon = runVM ./nix/vm/x11-cinnamon.nix;
|
wayland-plasma6 = runVM ./nix/vm/wayland-plasma6.nix;
|
||||||
x11-gnome = runVM ./nix/vm/x11-gnome.nix;
|
x11-cinnamon = runVM ./nix/vm/x11-cinnamon.nix;
|
||||||
x11-plasma6 = runVM ./nix/vm/x11-plasma6.nix;
|
x11-gnome = runVM ./nix/vm/x11-gnome.nix;
|
||||||
x11-xfce = runVM ./nix/vm/x11-xfce.nix;
|
x11-plasma6 = runVM ./nix/vm/x11-plasma6.nix;
|
||||||
};
|
x11-xfce = runVM ./nix/vm/x11-xfce.nix;
|
||||||
|
}
|
||||||
|
// (pkgs-stable.lib.mapAttrs' (
|
||||||
|
# This adds all of our VM tests as runnable apps that load
|
||||||
|
# the interactive driver (repl). We map all the names of the
|
||||||
|
# tests to "test-<name>" so its distinct from other apps.
|
||||||
|
name: value: {
|
||||||
|
name = "test-${name}";
|
||||||
|
value = {
|
||||||
|
type = "app";
|
||||||
|
program = pkgs-unstable.lib.getExe tests.${name}.driverInteractive;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
tests);
|
||||||
}
|
}
|
||||||
# Our supported systems are the same supported systems as the Zig binaries.
|
# Our supported systems are the same supported systems as the Zig binaries.
|
||||||
) (builtins.attrNames zig.packages)
|
) (builtins.attrNames zig.packages)
|
||||||
|
26
nix/tests/basic.nix
Normal file
26
nix/tests/basic.nix
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
name = "basic";
|
||||||
|
|
||||||
|
nodes.machine = {
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
users.users.alice = {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = ["wheel"];
|
||||||
|
packages = with pkgs; [
|
||||||
|
firefox
|
||||||
|
(pkgs.callPackage ../package.nix {})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.wait_for_unit("default.target")
|
||||||
|
machine.succeed("su -- alice -c 'which firefox'")
|
||||||
|
machine.fail("su -- root -c 'which firefox'")
|
||||||
|
'';
|
||||||
|
}
|
14
nix/tests/default.nix
Normal file
14
nix/tests/default.nix
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{nixpkgs}: let
|
||||||
|
# mkTest does nothing special right now, its just a wrapper around
|
||||||
|
# runNixOSTest, but it could be extended in the future so I pulled it out.
|
||||||
|
mkTest = path:
|
||||||
|
nixpkgs.testers.runNixOSTest {
|
||||||
|
imports = [
|
||||||
|
path
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
basic = mkTest ./basic.nix;
|
||||||
|
gnome = mkTest ./gnome.nix;
|
||||||
|
i3 = mkTest ./i3.nix;
|
||||||
|
}
|
56
nix/tests/gnome.nix
Normal file
56
nix/tests/gnome.nix
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
name = "gnome";
|
||||||
|
|
||||||
|
nodes.machine = {
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
users.users.alice = {
|
||||||
|
isNormalUser = true;
|
||||||
|
password = "alice";
|
||||||
|
extraGroups = ["wheel"];
|
||||||
|
packages = with pkgs; [
|
||||||
|
(pkgs.callPackage ../package.nix {})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver.enable = true;
|
||||||
|
|
||||||
|
services.xserver.displayManager = {
|
||||||
|
gdm.enable = true;
|
||||||
|
gdm.debug = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.displayManager.autoLogin = {
|
||||||
|
enable = true;
|
||||||
|
user = "alice";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver.desktopManager.gnome.enable = true;
|
||||||
|
services.xserver.desktopManager.gnome.debug = true;
|
||||||
|
|
||||||
|
systemd.user.services = {
|
||||||
|
"org.gnome.Shell@wayland" = {
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = [
|
||||||
|
# Clear the list before overriding it.
|
||||||
|
""
|
||||||
|
# Eval API is now internal so Shell needs to run in unsafe mode.
|
||||||
|
# TODO: improve test driver so that it supports openqa-like manipulation
|
||||||
|
# that would allow us to drop this mess.
|
||||||
|
"${pkgs.gnome-shell}/bin/gnome-shell --unsafe-mode"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.wait_for_unit("default.target")
|
||||||
|
machine.succeed("su -- alice -c 'which firefox'")
|
||||||
|
machine.fail("su -- root -c 'which firefox'")
|
||||||
|
'';
|
||||||
|
}
|
59
nix/tests/i3.nix
Normal file
59
nix/tests/i3.nix
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
name = "gnome";
|
||||||
|
|
||||||
|
nodes.machine = {
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
users.users.alice = {
|
||||||
|
isNormalUser = true;
|
||||||
|
password = "alice";
|
||||||
|
extraGroups = ["wheel"];
|
||||||
|
packages = with pkgs; [
|
||||||
|
(pkgs.callPackage ../package.nix {})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# We need an XDG portal for various applications to work properly,
|
||||||
|
# such as Flatpak applications.
|
||||||
|
xdg.portal = {
|
||||||
|
enable = true;
|
||||||
|
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
||||||
|
config.common.default = "*";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
xkb.layout = "us";
|
||||||
|
dpi = 220;
|
||||||
|
|
||||||
|
desktopManager = {
|
||||||
|
xterm.enable = false;
|
||||||
|
wallpaper.mode = "fill";
|
||||||
|
};
|
||||||
|
|
||||||
|
displayManager = {
|
||||||
|
defaultSession = "none+i3";
|
||||||
|
lightdm.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
windowManager = {
|
||||||
|
i3.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.displayManager.autoLogin = {
|
||||||
|
enable = true;
|
||||||
|
user = "alice";
|
||||||
|
};
|
||||||
|
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.wait_for_unit("default.target")
|
||||||
|
machine.succeed("su -- alice -c 'which firefox'")
|
||||||
|
machine.fail("su -- root -c 'which firefox'")
|
||||||
|
'';
|
||||||
|
}
|
Reference in New Issue
Block a user