nixos-hypervisor/flake.nix

77 lines
2 KiB
Nix
Raw Normal View History

2024-09-09 10:48:56 +02:00
{
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";
};
2024-09-09 14:30:03 +02:00
outputs = inputs@{ self, nixpkgs, home-manager, microvm, ... }:
2024-09-09 10:48:56 +02:00
let
system = "x86_64-linux";
username = "tbarnouin";
in
{
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./configuration.nix
{
networking.hostName = "nixos";
}
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";
};
}
];
};
};
};
}