From 8ac09a92e9ca7fd12754214f192f68c190683851 Mon Sep 17 00:00:00 2001 From: Xe Date: Wed, 22 Dec 2021 11:57:09 -0500 Subject: [PATCH] add vm named hugo Signed-off-by: Xe --- deploy | 5 +++++ flake.nix | 23 +++++++++++++++++++++-- hardware/libvirt-generic/default.nix | 25 +++++++++++++++++++++++++ hosts/vm/hugo/default.nix | 3 +++ 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100755 deploy create mode 100644 hardware/libvirt-generic/default.nix create mode 100644 hosts/vm/hugo/default.nix diff --git a/deploy b/deploy new file mode 100755 index 0000000..f8bb412 --- /dev/null +++ b/deploy @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +nix run github:serokell/deploy-rs diff --git a/flake.nix b/flake.nix index 665bd0f..040c444 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,8 @@ home-manager.nixosModules.home-manager ({ config, ... }: { system.configurationRevision = self.sourceInfo.rev; - services.getty.greetingLine = ''<<< Welcome to NixOS ${config.system.nixos.label} @ ${self.sourceInfo.rev} - \l >>>''; + services.getty.greetingLine = + "<<< Welcome to NixOS ${config.system.nixos.label} @ ${self.sourceInfo.rev} - \\l >>>"; }) ] ++ extraModules; }; @@ -32,7 +33,13 @@ ]; }; - nixosConfigurations.logos = mkSystem [ ./hosts/logos ./hardware/alrest ]; + nixosConfigurations = { + logos = mkSystem [ ./hosts/logos ./hardware/alrest ]; + + # vms + ## logos + hugo = mkSystem [ ./hosts/vm/hugo ./hardware/libvirt-generic ]; + }; deploy.nodes.logos = { hostname = "192.168.2.35"; @@ -46,6 +53,18 @@ }; }; + deploy.nodes.hugo = { + hostname = "10.77.129.6"; + sshUser = "root"; + fastConnection = true; + + profiles.system = { + user = "root"; + path = deploy-rs.lib.x86_64-linux.activate.nixos + self.nixosConfigurations.hugo; + }; + }; + # This is highly advised, and will prevent many possible mistakes checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; diff --git a/hardware/libvirt-generic/default.nix b/hardware/libvirt-generic/default.nix new file mode 100644 index 0000000..790d7f6 --- /dev/null +++ b/hardware/libvirt-generic/default.nix @@ -0,0 +1,25 @@ +{ config, pkgs, modulesPath, ... }: +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ../../common ]; + + services.openssh.enable = true; + + boot.initrd.availableKernelModules = + [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/vda"; + + nixpkgs.config.allowUnfree = true; + + fileSystems."/" = { + device = "/dev/vda1"; + fsType = "ext4"; + }; + + services.qemuGuest.enable = true; +} diff --git a/hosts/vm/hugo/default.nix b/hosts/vm/hugo/default.nix new file mode 100644 index 0000000..a5a82c8 --- /dev/null +++ b/hosts/vm/hugo/default.nix @@ -0,0 +1,3 @@ +{ ... }: { + networking.hostName = "hugo"; +}