ext + raidz
This commit is contained in:
parent
8c47a51a41
commit
2693402afd
|
@ -47,7 +47,8 @@
|
||||||
|
|
||||||
users.users."enis" = {
|
users.users."enis" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
hashedPasswordFile = "./password";
|
# hashedPasswordFile = "./password";
|
||||||
|
initialPassword = "1234";
|
||||||
extraGroups = [
|
extraGroups = [
|
||||||
"networkmanager"
|
"networkmanager"
|
||||||
"audio"
|
"audio"
|
||||||
|
|
104
disko.nix
104
disko.nix
|
@ -1,7 +1,8 @@
|
||||||
{ lib
|
{
|
||||||
, root-disk ? "Expected a mf disk brother"
|
lib,
|
||||||
, raid-disks ? "Expected disks for raid"
|
root-disk ? "Expected a mf disk brother",
|
||||||
, ...
|
raid-disks ? "Expected disks for raid",
|
||||||
|
...
|
||||||
}: {
|
}: {
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk =
|
disk =
|
||||||
|
@ -12,34 +13,55 @@
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
ESP = {
|
boot = {
|
||||||
size = "512M";
|
size = "512M";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
format = "vfat";
|
format = "vfat";
|
||||||
mountpoint = "/boot";
|
mountpoint = "/boot";
|
||||||
mountOptions = [ "umask=0077" ];
|
mountOptions = ["umask=0077"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
root = {
|
||||||
zfs = {
|
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "zfs";
|
type = "filesystem";
|
||||||
pool = "zroot";
|
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 (
|
// lib.attrsets.genAttrs raid-disks (name: {
|
||||||
name: {
|
type = "disk";
|
||||||
device = "/dev/" + name;
|
device = "/dev" + name;
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions.raid-pool = {
|
partitions = {
|
||||||
|
zfs = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "zfs";
|
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" = {
|
zpool = lib.mkIf (builtins.length raid-disks > 0) {
|
||||||
type = "zfs_fs";
|
zraid = {
|
||||||
options.mountpoint = "/nix";
|
|
||||||
mountpoint = "/nix";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
zraid = lib.mkIf (builtins.length raid-disks > 0) {
|
|
||||||
type = "zpool";
|
type = "zpool";
|
||||||
mode = "raidz";
|
mode = "raidz";
|
||||||
options = {
|
# TODO: Cache-ing
|
||||||
ashift = "12";
|
|
||||||
autotrim = "on";
|
|
||||||
autoexpand = "on";
|
|
||||||
};
|
|
||||||
rootFsOptions = {
|
rootFsOptions = {
|
||||||
compression = "zstd";
|
compression = "zstd";
|
||||||
mountpoint = "none";
|
"com.sun:auto-snapshot" = "false";
|
||||||
};
|
};
|
||||||
|
|
||||||
datasets = {
|
datasets = {
|
||||||
"var" = {
|
var = {
|
||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
mountpoint = "/var";
|
mountpoint = "/var";
|
||||||
};
|
};
|
||||||
"home" = {
|
home = {
|
||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
mountpoint = "/home";
|
mountpoint = "/home";
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,11 @@
|
||||||
(import ./disko.nix {
|
(import ./disko.nix {
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
root-disk = "/dev/vda";
|
root-disk = "/dev/vda";
|
||||||
raid-disks = [];
|
raid-disks = [
|
||||||
|
"vdb"
|
||||||
|
"vdc"
|
||||||
|
"vdd"
|
||||||
|
];
|
||||||
})
|
})
|
||||||
inputs.home-manager.nixosModules.default
|
inputs.home-manager.nixosModules.default
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue