mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-22 01:18:36 +03:00
nix vm: more reusability
This commit is contained in:
40
flake.nix
40
flake.nix
@ -60,42 +60,18 @@
|
||||
formatter.${system} = pkgs-stable.alejandra;
|
||||
|
||||
apps.${system} = let
|
||||
makeVM = (
|
||||
path: system: uid: gid:
|
||||
nixpkgs-stable.lib.nixosSystem {
|
||||
system = builtins.replaceStrings ["darwin"] ["linux"] system;
|
||||
modules = [
|
||||
{
|
||||
virtualisation.vmVariant = {
|
||||
virtualisation.host.pkgs = pkgs-stable;
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
self.overlays.debug
|
||||
];
|
||||
|
||||
users.groups.ghostty = {
|
||||
gid = gid;
|
||||
};
|
||||
|
||||
users.users.ghostty = {
|
||||
uid = gid;
|
||||
};
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
}
|
||||
./nix/vm/common.nix
|
||||
path
|
||||
];
|
||||
}
|
||||
);
|
||||
runVM = (
|
||||
path: let
|
||||
vm = import ./nix/vm/create.nix {
|
||||
inherit system path;
|
||||
nixpkgs = nixpkgs-stable;
|
||||
overlay = self.overlays.debug;
|
||||
};
|
||||
program = pkgs-stable.writeShellScript "run-ghostty-vm" ''
|
||||
SHARED_DIR=$(pwd)
|
||||
export SHARED_DIR
|
||||
|
||||
${(makeVM path system 1000 1000).config.system.build.vm}/bin/run-ghostty-vm
|
||||
${vm.config.system.build.vm}/bin/run-ghostty-vm
|
||||
'';
|
||||
in {
|
||||
type = "app";
|
||||
@ -124,6 +100,10 @@
|
||||
ghostty = self.packages.${prev.system}.ghostty-debug;
|
||||
};
|
||||
};
|
||||
create-vm = import ./nix/vm/create.nix;
|
||||
create-cinnamon-vm = import ./nix/vm/create-cinnamon.nix;
|
||||
create-gnome-vm = import ./nix/vm/create-gnome.nix;
|
||||
create-plasma6-vm = import ./nix/vm/create-plasma6.nix;
|
||||
};
|
||||
|
||||
nixConfig = {
|
||||
|
@ -1,4 +1,8 @@
|
||||
{...}: {
|
||||
imports = [
|
||||
./common.nix
|
||||
];
|
||||
|
||||
services.xserver = {
|
||||
displayManager = {
|
||||
lightdm = {
|
||||
|
@ -4,6 +4,10 @@
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./common.nix
|
||||
];
|
||||
|
||||
services.xserver = {
|
||||
displayManager = {
|
||||
gdm = {
|
||||
|
@ -1,4 +1,8 @@
|
||||
{...}: {
|
||||
imports = [
|
||||
./common.nix
|
||||
];
|
||||
|
||||
services = {
|
||||
displayManager = {
|
||||
sddm = {
|
||||
|
12
nix/vm/create-cinnamon.nix
Normal file
12
nix/vm/create-cinnamon.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
system,
|
||||
nixpkgs,
|
||||
overlay,
|
||||
path,
|
||||
uid ? 1000,
|
||||
gid ? 1000,
|
||||
}:
|
||||
import ./create.nix {
|
||||
inherit system nixpkgs overlay path uid gid;
|
||||
common = ./common-cinnamon.nix;
|
||||
}
|
12
nix/vm/create-gnome.nix
Normal file
12
nix/vm/create-gnome.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
system,
|
||||
nixpkgs,
|
||||
overlay,
|
||||
path,
|
||||
uid ? 1000,
|
||||
gid ? 1000,
|
||||
}:
|
||||
import ./create.nix {
|
||||
inherit system nixpkgs overlay path uid gid;
|
||||
common = ./common-gnome.nix;
|
||||
}
|
12
nix/vm/create-plasma6.nix
Normal file
12
nix/vm/create-plasma6.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
system,
|
||||
nixpkgs,
|
||||
overlay,
|
||||
path,
|
||||
uid ? 1000,
|
||||
gid ? 1000,
|
||||
}:
|
||||
import ./create.nix {
|
||||
inherit system nixpkgs overlay path uid gid;
|
||||
common = ./common-plasma6.nix;
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
nixpkgs,
|
||||
overlay,
|
||||
path,
|
||||
common ? ./common.nix,
|
||||
uid ? 1000,
|
||||
gid ? 1000,
|
||||
}: let
|
||||
@ -33,9 +34,9 @@ in
|
||||
uid = uid;
|
||||
};
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
system.stateVersion = nixpkgs.lib.trivial.release;
|
||||
}
|
||||
./common.nix
|
||||
common
|
||||
path
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user