Skip to content

Commit

Permalink
add testing VM
Browse files Browse the repository at this point in the history
  • Loading branch information
lostbean committed Jan 31, 2024
1 parent b755a0a commit d5f4eae
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
25 changes: 25 additions & 0 deletions internal_testsuites/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions internal_testsuites/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
outputs = { self, nixpkgs, }: {
nixosModules.vm = { ... }: {
# Make VM output to the terminal instead of a separate window
virtualisation.vmVariant.virtualisation.graphics = false;
};

nixosModules.base = { pkgs, ... }: {
system.stateVersion = "23.11";

# Configure networking
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = true;

# Create user "test"
services.getty.autologinUser = "tester";
users.users.test.isNormalUser = true;

# Enable passwordless ‘sudo’ for the "test" user
users.users.test.extraGroups = [ "wheel" ];
security.sudo.wheelNeedsPassword = false;
};

nixosConfigurations.linuxVM = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ self.nixosModules.base self.nixosModules.vm ];
};
packages.x86_64-linux.linuxVM =
self.nixosConfigurations.linuxVM.config.system.build.vm;

nixosConfigurations.darwinVM = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
self.nixosModules.base
self.nixosModules.vm
{
virtualisation.vmVariant.virtualisation.host.pkgs =
nixpkgs.legacyPackages.aarch64-darwin;
}
];
};
packages.aarch64-darwin.darwinVM =
self.nixosConfigurations.darwinVM.config.system.build.vm;

};
}

0 comments on commit d5f4eae

Please sign in to comment.