mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
machine/thinkman: migrate to disko
This commit is contained in:
parent
b17d5c65de
commit
06937b156b
3 changed files with 78 additions and 30 deletions
|
@ -2,7 +2,6 @@
|
|||
{
|
||||
imports = [
|
||||
./boot.nix
|
||||
./disks.nix
|
||||
./hardware-configuration.nix
|
||||
./network.nix
|
||||
./profiles.nix
|
||||
|
@ -12,6 +11,10 @@
|
|||
|
||||
networking.hostName = "thinkman";
|
||||
|
||||
disko.devices = import ./disko-config.nix {
|
||||
disks = [ "/dev/disk/by-id/nvme-eui.0025385b01410682" ];
|
||||
};
|
||||
|
||||
sops = {
|
||||
defaultSopsFile = ./secrets.yaml;
|
||||
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
|
|
74
machines/thinkman/disko-config.nix
Normal file
74
machines/thinkman/disko-config.nix
Normal file
|
@ -0,0 +1,74 @@
|
|||
{ disks ? [ "/dev/nvme0" ], ... }:
|
||||
{
|
||||
disk = {
|
||||
vdb = {
|
||||
type = "disk";
|
||||
device = builtins.head disks;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02"; # for grub MBR
|
||||
};
|
||||
ESP = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
];
|
||||
};
|
||||
};
|
||||
luks = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "encrypted";
|
||||
extraOpenArgs = [ "--allow-discards" ];
|
||||
passwordFile = "/tmp/disk.key";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "pool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
lvm_vg = {
|
||||
pool = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "100G";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
home = {
|
||||
size = "450G";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/home";
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "32G";
|
||||
content = {
|
||||
type = "swap";
|
||||
randomEncryption = true;
|
||||
resumeDevice = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
boot.initrd.luks.devices."luks-drive" = {
|
||||
name = "luks-drive";
|
||||
device = "/dev/disk/by-partlabel/Crypt";
|
||||
preLVM = true;
|
||||
allowDiscards = true;
|
||||
};
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/thinkman-root";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-label/thinkman-bo";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = "/dev/disk/by-label/thinkman-home";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [{
|
||||
device = "/dev/disk/by-label/thinkman-swap";
|
||||
}];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue