nixos-hypervisor/flake.nix
2024-09-09 15:19:57 +02:00

77 lines
2 KiB
Nix

{
description = "A simple system flake using some Aux defaults";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
microvm.url = "github:astro/microvm.nix";
microvm.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nixpkgs, home-manager, microvm, ... }:
let
hostName = "nixos";
system = "x86_64-linux";
username = "tbarnouin";
in
{
nixosConfigurations = {
${hostName} = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./configuration.nix
{
networking.hostName = hostName;
}
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${username} = import ./home.nix;
}
microvm.nixosModules.host
{
microvm = {
autostart = [
"nginx"
];
vms = {
nginx = {
flake = self;
updateFlake = "git+file:///etc/nixos";
};
};
};
}
];
specialArgs = {
inherit inputs;
inherit username;
};
};
nginx = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
microvm.nixosModules.microvm
"${inputs.self}/systems"
"${inputs.self}/services"
{
services.vm_nginx = {
enable = true;
};
services.vm = {
enable = true;
hostname = "nginx";
vm_ip = "192.168.122.40";
macAddr = "02:00:00:00:00:40";
};
}
];
};
};
};
}