aboutsummaryrefslogtreecommitdiff
path: root/nix/hosts
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-08-03 14:04:03 -0700
committerFranck Cuny <franck@fcuny.net>2024-08-03 14:04:03 -0700
commit30558b5b98c362e4daabb9223286a2595191be4e (patch)
tree27ac618628521e2abd4c385b490e1b41ab0ab0a2 /nix/hosts
parentadd lint as a target and reformat (diff)
downloadinfra-30558b5b98c362e4daabb9223286a2595191be4e.tar.gz
add a linux VM as a new host
The linux VM runs with UTM, and it has a very basic configuration for now.
Diffstat (limited to '')
-rw-r--r--nix/hosts/vm/default.nix29
-rw-r--r--nix/hosts/vm/hardware.nix14
2 files changed, 43 insertions, 0 deletions
diff --git a/nix/hosts/vm/default.nix b/nix/hosts/vm/default.nix
new file mode 100644
index 0000000..a6dff3a
--- /dev/null
+++ b/nix/hosts/vm/default.nix
@@ -0,0 +1,29 @@
+{ pkgs, ... }: {
+ imports = [
+ ./hardware.nix
+ ];
+
+ boot.tmp.cleanOnBoot = true;
+ zramSwap.enable = false;
+
+ networking = {
+ hostName = "nixos";
+ domain = "";
+ };
+
+ services.openssh.enable = true;
+
+ users.users.root.openssh.authorizedKeys.keys = [
+ ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBkozy+X96u5ciX766bJ/AyQ3xm1tXZTIr5+4PVFZFi''
+ ];
+
+ system.stateVersion = "23.11";
+
+ environment = {
+ systemPackages = with pkgs; [
+ git
+ jq
+ vim
+ ];
+ };
+}
diff --git a/nix/hosts/vm/hardware.nix b/nix/hosts/vm/hardware.nix
new file mode 100644
index 0000000..89c3d8b
--- /dev/null
+++ b/nix/hosts/vm/hardware.nix
@@ -0,0 +1,14 @@
+{ modulesPath, ... }:
+{
+ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
+ boot.loader.grub = {
+ efiSupport = true;
+ efiInstallAsRemovable = true;
+ device = "nodev";
+ };
+ fileSystems."/boot" = { device = "/dev/disk/by-uuid/E783-E9AE"; fsType = "vfat"; };
+ boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" ];
+ boot.initrd.kernelModules = [ "nvme" ];
+ fileSystems."/" = { device = "/dev/vda2"; fsType = "ext4"; };
+ swapDevices = [{ device = "/dev/vda3"; }];
+}