diff --git a/flake.nix b/flake.nix index 036a994..96171b9 100644 --- a/flake.nix +++ b/flake.nix @@ -13,23 +13,24 @@ outputs = inputs@{ self, nixpkgs, home-manager, microvm, ... }: let + hostName = "nixos-hypervisor"; system = "x86_64-linux"; username = "tbarnouin"; in { nixosConfigurations = { - nixos-hypervisor = nixpkgs.lib.nixosSystem { + ${hostName} = nixpkgs.lib.nixosSystem { inherit system; modules = [ - ./hosts/nixos-hypervisor/configuration.nix + ./hosts/${hostName}/configuration.nix { - networking.hostName = "nixos-hypervisor"; + networking.hostName = hostName; } home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = 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 { @@ -50,6 +51,7 @@ specialArgs = { inherit inputs; inherit username; + inherit hostName; }; }; nginx = nixpkgs.lib.nixosSystem { diff --git a/hosts/nixos-hypervisor/configuration.nix b/hosts/nixos-hypervisor/configuration.nix index 25523a9..b646503 100644 --- a/hosts/nixos-hypervisor/configuration.nix +++ b/hosts/nixos-hypervisor/configuration.nix @@ -2,7 +2,7 @@ { imports = [ # Include the results of the hardware scan. - ./hardware-configuration.nix +# ./hardware-configuration.nix ]; nix.settings = { @@ -15,7 +15,7 @@ boot.kernel.sysctl."vm.swapiness" = 1; networking.useNetworkd = true; - + systemd.network.enable = true; systemd.network.networks."10-lan" = { matchConfig.Name = ["enp1s0" "vm-*"]; @@ -59,22 +59,22 @@ "render" "video" ]; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos" + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos" ]; }; - root = { - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos" + root = { + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos" ]; }; }; - + environment.systemPackages = with pkgs; [ - vim + vim htop wget - curl + curl git neofetch libvirt @@ -91,9 +91,9 @@ }; }; - # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ 22 ]; - #networking.firewall.allowedUDPPorts = [ ... ]; + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 22 ]; + #networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. networking.firewall.enable = false; system.stateVersion = "24.05"; # Did you read the comment?