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
|
2024-09-10 09:51:13 +02:00
|
|
|
hostName = "nixos-hypervisor";
|
2024-09-09 10:48:56 +02:00
|
|
|
system = "x86_64-linux";
|
|
|
|
username = "tbarnouin";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
nixosConfigurations = {
|
2024-09-10 09:51:13 +02:00
|
|
|
${hostName} = nixpkgs.lib.nixosSystem {
|
2024-09-09 10:48:56 +02:00
|
|
|
inherit system;
|
|
|
|
modules = [
|
2024-09-10 09:51:13 +02:00
|
|
|
./hosts/${hostName}/configuration.nix
|
2024-09-09 10:48:56 +02:00
|
|
|
{
|
2024-09-10 09:51:13 +02:00
|
|
|
networking.hostName = hostName;
|
2024-09-09 10:48:56 +02:00
|
|
|
}
|
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
{
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
2024-09-10 09:51:13 +02:00
|
|
|
home-manager.users.${username} = import ./hosts/${hostName}/home.nix;
|
2024-09-09 10:48:56 +02:00
|
|
|
}
|
|
|
|
microvm.nixosModules.host
|
|
|
|
{
|
2024-09-09 15:19:57 +02:00
|
|
|
microvm = {
|
2024-09-09 10:48:56 +02:00
|
|
|
autostart = [
|
|
|
|
"nginx"
|
|
|
|
];
|
|
|
|
vms = {
|
2024-09-09 15:19:57 +02:00
|
|
|
nginx = {
|
2024-09-09 10:48:56 +02:00
|
|
|
flake = self;
|
|
|
|
updateFlake = "git+file:///etc/nixos";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
2024-09-09 15:19:57 +02:00
|
|
|
|
2024-09-09 10:48:56 +02:00
|
|
|
specialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
inherit username;
|
2024-09-10 09:51:13 +02:00
|
|
|
inherit hostName;
|
2024-09-10 10:51:57 +02:00
|
|
|
inherit system;
|
2024-09-09 10:48:56 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|