make vm architecture agnostic
This commit is contained in:
parent
a6ddd527d4
commit
f6dbc88abb
7 changed files with 103 additions and 88 deletions
41
flake.nix
41
flake.nix
|
|
@ -73,6 +73,10 @@
|
|||
apple-silicon,
|
||||
...
|
||||
}: let
|
||||
# All systems we want to support for the generic VM
|
||||
supportedSystems = ["x86_64-linux" "aarch64-linux"];
|
||||
# to run the vm:
|
||||
# nixos-rebuild build-vm --flake ~/nix#$(nix eval --raw --impure --expr 'builtins.currentSystem')
|
||||
mkNixosSystem = {
|
||||
hostname,
|
||||
system,
|
||||
|
|
@ -83,7 +87,7 @@
|
|||
inherit system;
|
||||
specialArgs =
|
||||
{
|
||||
inherit catppuccin;
|
||||
inherit catppuccin system;
|
||||
}
|
||||
// extraSpecialArgs;
|
||||
modules =
|
||||
|
|
@ -144,8 +148,10 @@
|
|||
nixvim.homeModules.nixvim
|
||||
];
|
||||
};
|
||||
in {
|
||||
nixosConfigurations = {
|
||||
in
|
||||
{
|
||||
nixosConfigurations =
|
||||
{
|
||||
peach = mkNixosSystem {
|
||||
hostname = "peach";
|
||||
system = "aarch64-linux";
|
||||
|
|
@ -162,12 +168,14 @@
|
|||
inherit nix-cachyos-kernel;
|
||||
};
|
||||
};
|
||||
|
||||
vm-aarch64 = mkNixosSystem {
|
||||
hostname = "vm-aarch64";
|
||||
system = "aarch64-linux";
|
||||
};
|
||||
};
|
||||
}
|
||||
// nixpkgs.lib.genAttrs supportedSystems (
|
||||
system:
|
||||
mkNixosSystem {
|
||||
hostname = "vm-generic";
|
||||
inherit system;
|
||||
}
|
||||
);
|
||||
|
||||
homeConfigurations = {
|
||||
peach = mkHomeConfig {
|
||||
|
|
@ -180,11 +188,14 @@
|
|||
hostname = "alien";
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
vm-aarch64 = mkHomeConfig {
|
||||
};
|
||||
}
|
||||
// nixpkgs.lib.genAttrs supportedSystems (
|
||||
system:
|
||||
mkHomeConfig {
|
||||
user = "sckova";
|
||||
hostname = "vm-aarch64";
|
||||
system = "aarch64-linux";
|
||||
};
|
||||
};
|
||||
};
|
||||
hostname = "vm-generic";
|
||||
inherit system;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
imports = [];
|
||||
|
|
@ -30,7 +29,12 @@
|
|||
{device = "/dev/disk/by-label/swap";}
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
|
||||
hardware.parallels.enable = true;
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["prl-tools"];
|
||||
# Set platform from the system argument passed by the flake
|
||||
nixpkgs.hostPlatform = lib.mkDefault system;
|
||||
|
||||
# Enable Parallels tools only on aarch64
|
||||
hardware.parallels.enable = lib.mkIf (system == "aarch64-linux") true;
|
||||
nixpkgs.config.allowUnfreePredicate =
|
||||
lib.mkIf (system == "aarch64-linux")
|
||||
(pkg: builtins.elem (lib.getName pkg) ["prl-tools"]);
|
||||
}
|
||||
|
|
@ -235,13 +235,13 @@
|
|||
then "dark"
|
||||
else "light";
|
||||
|
||||
theme = {
|
||||
package = pkgs.kdePackages.breeze-gtk;
|
||||
name =
|
||||
if config.userOptions.isDark
|
||||
then "Breeze-Dark"
|
||||
else "Breeze";
|
||||
};
|
||||
# theme = {
|
||||
# package = pkgs.kdePackages.breeze-gtk;
|
||||
# name =
|
||||
# if config.userOptions.isDark
|
||||
# then "Breeze-Dark"
|
||||
# else "Breeze";
|
||||
# };
|
||||
|
||||
iconTheme = {
|
||||
name =
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
catppuccin,
|
||||
nix-cachyos-kernel,
|
||||
...
|
||||
|
|
@ -10,8 +8,9 @@
|
|||
networking.hostName = "alien";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
pkgs.ddcutil
|
||||
pkgs.mangohud
|
||||
ddcutil
|
||||
mangohud
|
||||
(bottles.override {removeWarningPopup = true;})
|
||||
];
|
||||
|
||||
# enable ddcutil
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
catppuccin,
|
||||
...
|
||||
}: {
|
||||
networking.hostName = "vm-aarch64";
|
||||
|
||||
boot.binfmt.emulatedSystems = [
|
||||
"x86_64-linux"
|
||||
"riscv64-linux"
|
||||
];
|
||||
|
||||
catppuccin.accent = "green";
|
||||
|
||||
home-manager.users.sckova = {
|
||||
imports = [catppuccin.homeModules.catppuccin];
|
||||
};
|
||||
|
||||
services.spice-vdagentd.enable = true;
|
||||
|
||||
virtualisation.vmVariant = {
|
||||
virtualisation = {
|
||||
memorySize = 8192;
|
||||
cores = 6;
|
||||
};
|
||||
};
|
||||
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
}
|
||||
32
system/hosts/vm-generic/default.nix
Normal file
32
system/hosts/vm-generic/default.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
catppuccin,
|
||||
...
|
||||
}: {
|
||||
networking.hostName = "vm";
|
||||
|
||||
# Enable emulation for architectures we're not currently running
|
||||
boot.binfmt.emulatedSystems =
|
||||
lib.optional (pkgs.stdenv.hostPlatform.system != "x86_64-linux") "x86_64-linux"
|
||||
++ lib.optional (pkgs.stdenv.hostPlatform.system != "aarch64-linux") "aarch64-linux"
|
||||
++ lib.optional (pkgs.stdenv.hostPlatform.system != "riscv64-linux") "riscv64-linux";
|
||||
|
||||
catppuccin.accent = "green";
|
||||
|
||||
home-manager.users.sckova = {
|
||||
imports = [catppuccin.homeModules.catppuccin];
|
||||
};
|
||||
|
||||
services.spice-vdagentd.enable = true;
|
||||
|
||||
virtualisation.vmVariant = {
|
||||
virtualisation = {
|
||||
memorySize = 8192;
|
||||
cores = 6;
|
||||
};
|
||||
};
|
||||
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue