diff --git a/flake.nix b/flake.nix index 15f46307..542b0af8 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,7 @@ nixosConfigurations = { # Virtual Machines nixos-vm-01 = libx.mkHost { hostname = "nixos-vm-01"; }; - nixos-osaka-vultr-01 = libx.mkHost { hostname = "nixos-osaka-vultr-01"; }; + nixos-vm-02 = libx.mkHost { hostname = "nixos-vm-02"; }; # Physical Machines nixos-laptop = libx.mkHost { hostname = "nixos-laptop"; desktop = "hyprland"; gpu = "intel"; theme = "gruvbox"; }; nixos-framework = libx.mkHost { hostname = "nixos-framework"; desktop = "hyprland"; gpu = "intel"; theme = "gruvbox"; }; @@ -47,7 +47,7 @@ homeConfigurations = { # Virtual Machines "albert@nixos-vm-01" = libx.mkHome { hostname = "nixos-vm-01"; }; - "albert@nixos-osaka-vultr-01" = libx.mkHome { hostname = "nixos-osaka-vultr-01"; }; + "albert@nixos-vm-02" = libx.mkHome { hostname = "nixos-vm-02"; }; # Physical Machines "albert@nixos-laptop" = libx.mkHome { hostname = "nixos-laptop"; desktop = "hyprland"; theme = "gruvbox"; }; "albert@nixos-framework" = libx.mkHome { hostname = "nixos-framework"; desktop = "hyprland"; theme = "gruvbox"; }; diff --git a/nixos/hosts/nixos-vm-02/default.nix b/nixos/hosts/nixos-vm-02/default.nix new file mode 100644 index 00000000..31b82a32 --- /dev/null +++ b/nixos/hosts/nixos-vm-02/default.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, modulesPath, desktop, username, ... }: { + imports = [ ./disks.nix ]; + nixpkgs.config.allowUnfree = false; + + boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + virtualisation.virtualbox.guest.enable = true; + time.timeZone = "Asia/Tokyo"; + networking.hostName = "nixos-vm-02"; + + boot.loader.grub = { + enable = true; + device = "/dev/sda"; + useOSProber = true; + }; + + networking.firewall.allowedTCPPorts = [ 22 ]; +} diff --git a/nixos/hosts/nixos-vm-02/disks.nix b/nixos/hosts/nixos-vm-02/disks.nix new file mode 100644 index 00000000..95851bfc --- /dev/null +++ b/nixos/hosts/nixos-vm-02/disks.nix @@ -0,0 +1,60 @@ +{ + disko.devices = { + disk = { + sda = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + ESP = { + label = "EFI"; + name = "ESP"; + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "defaults" + ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "crypted"; + extraOpenArgs = [ "--allow-discards" ]; + # if you want to use the key for interactive login be sure there is no trailing newline + # for example use `echo -n "password" > /tmp/secret.key` + #passwordFile = "/tmp/secret.key"; # Interactive + settings.keyFile = "/tmp/secret.key"; + # additionalKeyFiles = [ "/tmp/additionalSecret.key" ]; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + "/home" = { + mountpoint = "/home"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} \ No newline at end of file