ext + raidz
This commit is contained in:
parent
8c47a51a41
commit
2693402afd
|
@ -47,7 +47,8 @@
|
|||
|
||||
users.users."enis" = {
|
||||
isNormalUser = true;
|
||||
hashedPasswordFile = "./password";
|
||||
# hashedPasswordFile = "./password";
|
||||
initialPassword = "1234";
|
||||
extraGroups = [
|
||||
"networkmanager"
|
||||
"audio"
|
||||
|
|
104
disko.nix
104
disko.nix
|
@ -1,7 +1,8 @@
|
|||
{ lib
|
||||
, root-disk ? "Expected a mf disk brother"
|
||||
, raid-disks ? "Expected disks for raid"
|
||||
, ...
|
||||
{
|
||||
lib,
|
||||
root-disk ? "Expected a mf disk brother",
|
||||
raid-disks ? "Expected disks for raid",
|
||||
...
|
||||
}: {
|
||||
disko.devices = {
|
||||
disk =
|
||||
|
@ -12,34 +13,55 @@
|
|||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
boot = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
mountOptions = ["umask=0077"];
|
||||
};
|
||||
};
|
||||
|
||||
zfs = {
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "zroot";
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
# disk2 = {
|
||||
# type = "disk";
|
||||
# device = "/dev/my-disk2";
|
||||
# content = {
|
||||
# type = "gpt";
|
||||
# partitions = {
|
||||
# boot = {
|
||||
# size = "1M";
|
||||
# type = "EF02"; # for grub MBR
|
||||
# };
|
||||
# mdadm = {
|
||||
# size = "100%";
|
||||
# content = {
|
||||
# type = "mdraid";
|
||||
# name = "raid1";
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
}
|
||||
// lib.attrsets.genAttrs raid-disks (
|
||||
name: {
|
||||
device = "/dev/" + name;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions.raid-pool = {
|
||||
// lib.attrsets.genAttrs raid-disks (name: {
|
||||
type = "disk";
|
||||
device = "/dev" + name;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
zfs = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
|
@ -47,59 +69,25 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
zpool = {
|
||||
zroot = {
|
||||
type = "zpool";
|
||||
rootFsOptions = {
|
||||
mountpoint = "none";
|
||||
compression = "zstd";
|
||||
acltype = "posixacl";
|
||||
xattr = "sa";
|
||||
"com.sun:auto-snapshot" = "false";
|
||||
};
|
||||
options = {
|
||||
ashift = "12";
|
||||
};
|
||||
datasets = {
|
||||
"root" = {
|
||||
type = "zfs_fs";
|
||||
options = {
|
||||
# encryption = "aes-256-gcm";
|
||||
# keyformat = "passphrase";
|
||||
# keylocation = "prompt";
|
||||
};
|
||||
mountpoint = "/";
|
||||
};
|
||||
});
|
||||
|
||||
"root/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "/nix";
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
zraid = lib.mkIf (builtins.length raid-disks > 0) {
|
||||
zpool = lib.mkIf (builtins.length raid-disks > 0) {
|
||||
zraid = {
|
||||
type = "zpool";
|
||||
mode = "raidz";
|
||||
options = {
|
||||
ashift = "12";
|
||||
autotrim = "on";
|
||||
autoexpand = "on";
|
||||
};
|
||||
# TODO: Cache-ing
|
||||
rootFsOptions = {
|
||||
compression = "zstd";
|
||||
mountpoint = "none";
|
||||
"com.sun:auto-snapshot" = "false";
|
||||
};
|
||||
|
||||
datasets = {
|
||||
"var" = {
|
||||
var = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/var";
|
||||
};
|
||||
"home" = {
|
||||
home = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/home";
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue