Functionning template

This commit is contained in:
Théo Barnouin 2024-09-10 09:51:13 +02:00
parent f1260cbc95
commit 91e61ef0a6
2 changed files with 19 additions and 17 deletions

View file

@ -13,23 +13,24 @@
outputs = inputs@{ self, nixpkgs, home-manager, microvm, ... }: outputs = inputs@{ self, nixpkgs, home-manager, microvm, ... }:
let let
hostName = "nixos-hypervisor";
system = "x86_64-linux"; system = "x86_64-linux";
username = "tbarnouin"; username = "tbarnouin";
in in
{ {
nixosConfigurations = { nixosConfigurations = {
nixos-hypervisor = nixpkgs.lib.nixosSystem { ${hostName} = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [
./hosts/nixos-hypervisor/configuration.nix ./hosts/${hostName}/configuration.nix
{ {
networking.hostName = "nixos-hypervisor"; networking.hostName = hostName;
} }
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.${username} = import ./hosts/nixos-hypervisor/home.nix; home-manager.users.${username} = import ./hosts/${hostName}/home.nix;
} }
microvm.nixosModules.host microvm.nixosModules.host
{ {
@ -50,6 +51,7 @@
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
inherit username; inherit username;
inherit hostName;
}; };
}; };
nginx = nixpkgs.lib.nixosSystem { nginx = nixpkgs.lib.nixosSystem {

View file

@ -2,7 +2,7 @@
{ imports = { imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix # ./hardware-configuration.nix
]; ];
nix.settings = { nix.settings = {
@ -15,7 +15,7 @@
boot.kernel.sysctl."vm.swapiness" = 1; boot.kernel.sysctl."vm.swapiness" = 1;
networking.useNetworkd = true; networking.useNetworkd = true;
systemd.network.enable = true; systemd.network.enable = true;
systemd.network.networks."10-lan" = { systemd.network.networks."10-lan" = {
matchConfig.Name = ["enp1s0" "vm-*"]; matchConfig.Name = ["enp1s0" "vm-*"];
@ -59,22 +59,22 @@
"render" "render"
"video" "video"
]; ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos"
]; ];
}; };
root = { root = {
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos"
]; ];
}; };
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim vim
htop htop
wget wget
curl curl
git git
neofetch neofetch
libvirt libvirt
@ -91,9 +91,9 @@
}; };
}; };
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedTCPPorts = [ 22 ];
#networking.firewall.allowedUDPPorts = [ ... ]; #networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether. networking.firewall.enable = false; # Or disable the firewall altogether. networking.firewall.enable = false;
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?