test
This commit is contained in:
147
modules/nixos/disko/aarch64-linux/default.nix.ori
Normal file
147
modules/nixos/disko/aarch64-linux/default.nix.ori
Normal file
@@ -0,0 +1,147 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
system,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.${namespace}.hardware.disko;
|
||||
isArm = builtins.match "aarch64*" system != null;
|
||||
rootDisk = "/dev/nvme0n1";
|
||||
|
||||
# BTRFS root partition configuration
|
||||
btrfsRoot = {
|
||||
name = "btrfs-root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ]; # Override existing partition
|
||||
# Subvolumes must set a mountpoint in order to be mounted,
|
||||
# unless their parent is mounted
|
||||
subvolumes = {
|
||||
"home" = {
|
||||
mountOptions = [ "compress=zstd" ];
|
||||
mountpoint = "/home";
|
||||
};
|
||||
"root" = {
|
||||
mountOptions = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
mountpoint = "/root";
|
||||
};
|
||||
"nix" = {
|
||||
mountOptions = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
"etc" = {
|
||||
mountOptions = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
mountpoint = "/etc";
|
||||
};
|
||||
"log" = {
|
||||
mountOptions = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
mountpoint = "/var/log";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# BCacheFS root partition configuration
|
||||
bcachefsRoot = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "bcachefs";
|
||||
# This refers to a filesystem in the `bcachefs_filesystems` attrset below.
|
||||
filesystem = "mounted_subvolumes_in_multi";
|
||||
label = "ssd.ssd1";
|
||||
extraFormatArgs = [
|
||||
"--discard"
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ ../options.nix ];
|
||||
config = lib.mkIf (isArm && cfg.enable) {
|
||||
disko.devices = {
|
||||
# root disk setup
|
||||
disk.main = {
|
||||
type = "disk";
|
||||
device = rootDisk;
|
||||
imageSize = "15G";
|
||||
content = {
|
||||
type = "gpt";
|
||||
# specify partitions
|
||||
partitions = {
|
||||
# /boot/firmware
|
||||
FIRMWARE = {
|
||||
priority = 1;
|
||||
name = "FIRMWARE";
|
||||
start = "1M";
|
||||
end = "1G";
|
||||
type = "0700";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot/firmware";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
# /boot
|
||||
ESP = {
|
||||
priority = 2;
|
||||
name = "ESP";
|
||||
# start = "1G";
|
||||
# end = "2G";
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
|
||||
root = if cfg.filesystem == "btrfs" then btrfsRoot else bcachefsRoot;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
bcachefs_filesystems = lib.mkIf (cfg.filesystem == "bcachefs") {
|
||||
mounted_subvolumes_in_multi = {
|
||||
type = "bcachefs_filesystem";
|
||||
# passwordFile = "/etc/nixos/pool.jwe";
|
||||
extraFormatArgs = [
|
||||
"--compression=zstd"
|
||||
];
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
};
|
||||
"/persistent" = {
|
||||
mountpoint = "/persistent";
|
||||
};
|
||||
"/nix" = {
|
||||
mountOptions = [
|
||||
"noatime"
|
||||
];
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
};
|
||||
mountpoint = "/partition-root";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user