mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-21 08:58:37 +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;
|
formatter.${system} = pkgs-stable.alejandra;
|
||||||
|
|
||||||
apps.${system} = let
|
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 = (
|
runVM = (
|
||||||
path: let
|
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" ''
|
program = pkgs-stable.writeShellScript "run-ghostty-vm" ''
|
||||||
SHARED_DIR=$(pwd)
|
SHARED_DIR=$(pwd)
|
||||||
export SHARED_DIR
|
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 {
|
in {
|
||||||
type = "app";
|
type = "app";
|
||||||
@ -124,6 +100,10 @@
|
|||||||
ghostty = self.packages.${prev.system}.ghostty-debug;
|
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 = {
|
nixConfig = {
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./common.nix
|
||||||
|
];
|
||||||
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
displayManager = {
|
displayManager = {
|
||||||
lightdm = {
|
lightdm = {
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
imports = [
|
||||||
|
./common.nix
|
||||||
|
];
|
||||||
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
displayManager = {
|
displayManager = {
|
||||||
gdm = {
|
gdm = {
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./common.nix
|
||||||
|
];
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
displayManager = {
|
displayManager = {
|
||||||
sddm = {
|
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,
|
nixpkgs,
|
||||||
overlay,
|
overlay,
|
||||||
path,
|
path,
|
||||||
|
common ? ./common.nix,
|
||||||
uid ? 1000,
|
uid ? 1000,
|
||||||
gid ? 1000,
|
gid ? 1000,
|
||||||
}: let
|
}: let
|
||||||
@ -33,9 +34,9 @@ in
|
|||||||
uid = uid;
|
uid = uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "24.11";
|
system.stateVersion = nixpkgs.lib.trivial.release;
|
||||||
}
|
}
|
||||||
./common.nix
|
common
|
||||||
path
|
path
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user