Implement disko for legiondary

This commit is contained in:
Joseph Hanson 2024-06-24 13:00:06 -05:00
parent 1ac577b16c
commit b7a21a7dbe
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
2 changed files with 77 additions and 1 deletions

View file

@ -49,6 +49,9 @@
nix-inspect = {
url = "github:bluskript/nix-inspect";
};
# disko - Declarative disk partitioning and formatting using nix
disko.url = "github:nix-community/disko";
};
outputs =
@ -144,8 +147,10 @@
hostname = "legiondary";
system = "x86_64-linux";
hardwareModules = [
./nixos/profiles/hw-legion-15arh05h.nix
inputs.nixos-hardware.nixosModules.lenovo-legion-15arh05h
./nixos/profiles/hw-legion-15arh05h.nix
disko.nixosModules.disko
(import ./nixos/profiles/disko-nixos.nix { disks = [ "/dev/nvme0n1" ]; })
];
profileModules = [
./nixos/profiles/role-dev.nix

View file

@ -0,0 +1,71 @@
{ disks ? [ "/dev/sda" ], ... }: {
disko.devices = {
disk = {
main = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "gpt";
partitions = {
ESP = {
size = "1024M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
mode = "";
rootFsOptions = {
compression = "zstd";
"com.sun:auto-snapshot" = "false";
mountpoint = "none";
acltype = "posixacl";
};
options = {
ashift = 12;
};
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot@blank$' || zfs snapshot zroot@blank";
datasets = {
root = {
type = "zfs_fs";
mountpoint = "/";
};
nix = {
type = "zfs_fs";
options.mountpoint = "/nix";
};
var = {
type = "zfs_fs";
mountpoint = "/var";
};
home = {
type = "zfs_fs";
mountpoint = "/home";
options."com.sun:auto-snapshot" = "true"
};
};
};
};
};
}