Refactor testvm into reusable nixosModule for multiple architectures
This extracts the testvm configuration into a shared nixosModules.testvm
module that can be reused across different architectures. The module is
now used by both testvm-x86_64 and testvm-aarch64 nixosConfigurations,
eliminating code duplication.
Additionally, nixosConfigurations have been moved to the top-level flake
outputs to follow Nix conventions, rather than being nested inside
eachDefaultSystem. The virtwl proxy reference now uses ${pkgs.system}
instead of hardcoded x86_64-linux to support both architectures.
This commit is contained in:
parent
790dd0d1f4
commit
348cedab1a
1 changed files with 50 additions and 40 deletions
90
flake.nix
90
flake.nix
|
|
@ -9,6 +9,40 @@
|
|||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, virtwl, ... }: {
|
||||
nixosModules.testvm = { pkgs, ... }: {
|
||||
system.stateVersion = "25.11";
|
||||
|
||||
fonts.packages = [ pkgs.adwaita-fonts pkgs.dejavu_fonts ];
|
||||
environment.systemPackages = [
|
||||
pkgs.fastfetch
|
||||
pkgs.htop
|
||||
virtwl.packages.${pkgs.system}.proxy
|
||||
pkgs.wayland-utils
|
||||
pkgs.weston
|
||||
pkgs.waycheck
|
||||
pkgs.vulkan-tools
|
||||
pkgs.glmark2
|
||||
pkgs.mesa-demos
|
||||
pkgs.xorg.xeyes
|
||||
pkgs.xterm
|
||||
# pkgs.vkquake # build broken: Program 'spirv-remap' not found
|
||||
pkgs.veloren
|
||||
pkgs.kdePackages.kate
|
||||
pkgs.adwaita-icon-theme
|
||||
pkgs.amberol
|
||||
pkgs.bustle
|
||||
pkgs.d-spy
|
||||
pkgs.gnome-text-editor
|
||||
pkgs.firefox
|
||||
pkgs.ffmpeg-full
|
||||
pkgs.mpv
|
||||
pkgs.libva-utils
|
||||
pkgs.tailscale
|
||||
pkgs.zerotierone
|
||||
pkgs.localsend
|
||||
];
|
||||
};
|
||||
|
||||
nixosModules.default = { pkgs, lib, utils, config, ... }: let
|
||||
useTTY = {
|
||||
TTYPath = "/dev/hvc0";
|
||||
|
|
@ -217,6 +251,22 @@
|
|||
hardware.graphics.enable = true;
|
||||
hardware.graphics.package = self.packages.${pkgs.system}.mesa;
|
||||
};
|
||||
|
||||
nixosConfigurations.testvm-x86_64 = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
self.nixosModules.default
|
||||
self.nixosModules.testvm
|
||||
];
|
||||
};
|
||||
|
||||
nixosConfigurations.testvm-aarch64 = nixpkgs.lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
modules = [
|
||||
self.nixosModules.default
|
||||
self.nixosModules.testvm
|
||||
];
|
||||
};
|
||||
} // flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
|
|
@ -311,45 +361,5 @@
|
|||
patches = old.patches ++ [ ./radvmmio.patch ]; # already merged to git
|
||||
});
|
||||
|
||||
nixosConfigurations.testvm = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
self.nixosModules.default
|
||||
({ ... }: {
|
||||
system.stateVersion = "25.11";
|
||||
|
||||
fonts.packages = [ pkgs.adwaita-fonts pkgs.dejavu_fonts ];
|
||||
environment.systemPackages = [
|
||||
pkgs.fastfetch
|
||||
pkgs.htop
|
||||
virtwl.packages.x86_64-linux.proxy
|
||||
pkgs.wayland-utils
|
||||
pkgs.weston
|
||||
pkgs.waycheck
|
||||
pkgs.vulkan-tools
|
||||
pkgs.glmark2
|
||||
pkgs.mesa-demos
|
||||
pkgs.xorg.xeyes
|
||||
pkgs.xterm
|
||||
# pkgs.vkquake # build broken: Program 'spirv-remap' not found
|
||||
pkgs.veloren
|
||||
pkgs.kdePackages.kate
|
||||
pkgs.adwaita-icon-theme
|
||||
pkgs.amberol
|
||||
pkgs.bustle
|
||||
pkgs.d-spy
|
||||
pkgs.gnome-text-editor
|
||||
pkgs.firefox
|
||||
pkgs.ffmpeg-full
|
||||
pkgs.mpv
|
||||
pkgs.libva-utils
|
||||
pkgs.tailscale
|
||||
pkgs.zerotierone
|
||||
pkgs.localsend
|
||||
];
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue