initial nixos-anywhere

This commit is contained in:
Pim Kunis 2023-11-13 22:44:43 +01:00
parent cf611e6362
commit dd8b23f5a9
5 changed files with 74 additions and 13 deletions

View file

@ -5,6 +5,10 @@ Currently, only one physical server (named jefke) is implemented.
## Deployment
### NEW
`nix run github:numtide/nixos-anywhere -- --flake .#hypervisor root@jefke.hyp`
### Prerequisites
Before a NixOS definition can be deployed, some prerequite preparational steps must be performed.

View file

@ -1,5 +1,5 @@
{ pkgs, ... }: {
imports = [ ./hardware-configuration.nix ];
imports = [ ./hardware-configuration.nix ./disk-config.nix ];
boot.loader = {
systemd-boot.enable = true;

55
disk-config.nix Normal file
View file

@ -0,0 +1,55 @@
# Running system:
# NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
# nvme0n1 259:0 0 465,8G 0 disk
# ├─nvme0n1p1 259:1 0 512M 0 part /boot
# ├─nvme0n1p2 259:2 0 456,5G 0 part /nix/store
# │ /
# └─nvme0n1p3 259:3 0 8,8G 0 part [SWAP]
# Filesystem 1K-blocks Used Available Use% Mounted on
# devtmpfs 809892 0 809892 0% /dev
# tmpfs 8098920 0 8098920 0% /dev/shm
# tmpfs 4049460 3988 4045472 1% /run
# tmpfs 8098920 456 8098464 1% /run/wrappers
# /dev/nvme0n1p2 469995160 17597168 428450100 4% /
# /dev/nvme0n1p1 523248 119660 403588 23% /boot
# tmpfs 1619784 0 1619784 0% /run/user/0
# Disk name: nvme0n1
# disko template: simple-efi
# https://raw.githubusercontent.com/nix-community/disko/master/example/simple-efi.nix
{
disko.devices = {
disk = {
vdb = {
device = "/dev/nvme0n1";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
type = "EF00";
size = "500M";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View file

@ -4,9 +4,11 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
deploy-rs.url = "github:serokell/deploy-rs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, deploy-rs, ... }:
outputs = { self, nixpkgs, deploy-rs, disko, ... }:
let system = "x86_64-linux";
in {
@ -14,7 +16,7 @@
nixosConfigurations.hypervisor = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ./configuration.nix ];
modules = [ disko.nixosModules.disko ./configuration.nix ];
};
deploy = {

View file

@ -7,18 +7,18 @@
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/b78f591c-c9b6-4dae-9837-56716d38990b";
fsType = "ext4";
};
# fileSystems."/" = {
# device = "/dev/disk/by-uuid/b78f591c-c9b6-4dae-9837-56716d38990b";
# fsType = "ext4";
# };
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/6936-84C2";
fsType = "vfat";
};
# fileSystems."/boot" = {
# device = "/dev/disk/by-uuid/6936-84C2";
# fsType = "vfat";
# };
swapDevices =
[{ device = "/dev/disk/by-uuid/79fbd322-e58d-4e45-8969-06ef494cefea"; }];
# swapDevices =
# [{ device = "/dev/disk/by-uuid/79fbd322-e58d-4e45-8969-06ef494cefea"; }];
networking.useDHCP = false;