From bc9f3f9951f59eb4546734c99e95f2873f42f533 Mon Sep 17 00:00:00 2001 From: GaspardCulis Date: Mon, 23 Sep 2024 16:57:09 +0200 Subject: [PATCH] feat(hosts): Added new `OVHCloud` basic host config --- flake.nix | 8 ++++ hosts/OVHCloud/default.nix | 25 +++++++++++ hosts/OVHCloud/disko-config.nix | 54 +++++++++++++++++++++++ hosts/OVHCloud/hardware-configuration.nix | 11 +++++ 4 files changed, 98 insertions(+) create mode 100644 hosts/OVHCloud/default.nix create mode 100644 hosts/OVHCloud/disko-config.nix create mode 100644 hosts/OVHCloud/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index d0074b1..b38ae73 100644 --- a/flake.nix +++ b/flake.nix @@ -47,6 +47,14 @@ home-manager.nixosModules.home-manager ]; }; + + OVHCloud = nixpkgs.lib.nixosSystem { + extraArgs = {inherit inputs;}; + modules = [ + ./hosts/OVHCloud + disko.nixosModules.disko + ]; + }; }; homeConfigurations = { diff --git a/hosts/OVHCloud/default.nix b/hosts/OVHCloud/default.nix new file mode 100644 index 0000000..d37609a --- /dev/null +++ b/hosts/OVHCloud/default.nix @@ -0,0 +1,25 @@ +{pkgs, ...}: { + imports = [ + ./hardware-configuration.nix + ]; + + # Nix + nix.settings.experimental-features = ["nix-command" "flakes"]; + + # Set your time zone. + time.timeZone = "Europe/Paris"; + + # Enable the OpenSSH daemon. + services.openssh = { + enable = true; + ports = [22]; + settings = { + PasswordAuthentication = false; + }; + }; + + environment.systemPackages = with pkgs; [ + helix + git + ]; +} diff --git a/hosts/OVHCloud/disko-config.nix b/hosts/OVHCloud/disko-config.nix new file mode 100644 index 0000000..8f36ed4 --- /dev/null +++ b/hosts/OVHCloud/disko-config.nix @@ -0,0 +1,54 @@ +{lib, ...}: { + disko.devices = { + disk.disk1 = { + device = lib.mkDefault "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + }; + }; + }; + }; + lvm_vg = { + pool = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%FREE"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ + "defaults" + ]; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/OVHCloud/hardware-configuration.nix b/hosts/OVHCloud/hardware-configuration.nix new file mode 100644 index 0000000..1cd7099 --- /dev/null +++ b/hosts/OVHCloud/hardware-configuration.nix @@ -0,0 +1,11 @@ +{modulesPath, ...}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ./disko-config.nix + ]; + + boot.loader.grub = { + efiSupport = true; + efiInstallAsRemovable = true; + }; +}