Move from ZFS to btrfs
This commit is contained in:
@@ -7,11 +7,11 @@
|
||||
|
||||
sydnix = {
|
||||
impermanence = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
directories = [
|
||||
# Warning: Neither /var/lib/nixos nor any of its parents are persisted.
|
||||
# "Warning: Neither /var/lib/nixos nor any of its parents are persisted.
|
||||
# This means all users/groups without specified uids/gids will have them
|
||||
# reassigned on reboot.
|
||||
# reassigned on reboot."
|
||||
"/var/lib/nixos"
|
||||
"/etc/ssh"
|
||||
];
|
||||
@@ -30,11 +30,11 @@
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
|
||||
systemd.initrdBin = with pkgs; [
|
||||
zfs
|
||||
coreutils
|
||||
babashka
|
||||
];
|
||||
# systemd.initrdBin = with pkgs; [
|
||||
# zfs
|
||||
# coreutils
|
||||
# babashka
|
||||
# ];
|
||||
};
|
||||
|
||||
loader = {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode disko /nixos/hosts/nixos-testbed/disko-config.nix
|
||||
# time sudo nixos-install --flake /nixos#nixos-testbed
|
||||
# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode disko /persist/dots/hosts/nixos-testbed/disko-config.nix
|
||||
# time sudo nixos-install --flake /persist/dots#nixos-testbed
|
||||
{ lib, ... }:
|
||||
{
|
||||
# imports = [ disko.nixosModules.disko ];
|
||||
boot.zfs.extraPools = [ "rpool" ];
|
||||
boot.zfs.devNodes = "/dev/disk/by-path";
|
||||
boot.initrd.supportedFilesystems = [ "zfs" ];
|
||||
boot.supportedFilesystems = [ "zfs" ];
|
||||
boot.initrd.supportedFilesystems.btrfs = true;
|
||||
boot.supportedFilesystems.btrfs = true;
|
||||
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
|
||||
disko.devices = {
|
||||
disk = {
|
||||
broot = {
|
||||
bootroot = {
|
||||
type = "disk";
|
||||
device = "/dev/vda";
|
||||
device = "/dev/sda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
@@ -29,63 +29,42 @@
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "rpool";
|
||||
type = "btrfs";
|
||||
|
||||
mountpoint = "/partition-root";
|
||||
swap.swapfile.size = "4G";
|
||||
|
||||
# Override existing partitions.
|
||||
extraArgs = [ "-f" ];
|
||||
|
||||
# Subvolumes must set a mountpoint in order to be mounted,
|
||||
# *unless their parent is mounted*.
|
||||
subvolumes = {
|
||||
# Subvolume names do not necessarily correspond to
|
||||
# mountpoints, despite the structural resemblance to a file
|
||||
# path.
|
||||
"/rootfs" = {
|
||||
mountpoint = "/";
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
};
|
||||
"/persist/home" = {
|
||||
mountpoint = "/persist/home";
|
||||
};
|
||||
"/swap" = {
|
||||
mountpoint = "/.swapvol";
|
||||
swap.swapfile.size = "4G";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
zpool = {
|
||||
rpool = {
|
||||
type = "zpool";
|
||||
datasets =
|
||||
let dataset = options:
|
||||
let default = {
|
||||
type = "zfs_fs";
|
||||
mountOptions = [ "noauto" ];
|
||||
options = {
|
||||
"com.sun:auto-snapshot" = "false";
|
||||
};
|
||||
};
|
||||
in lib.recursiveUpdate default options;
|
||||
in
|
||||
{
|
||||
"local" = dataset {};
|
||||
"darlings" = dataset {};
|
||||
"local/root" = dataset {
|
||||
mountpoint = "/";
|
||||
postCreateHook = ''
|
||||
zfs list -t snapshot -H -o name \
|
||||
| grep -E '^rpool/local/root@blank$' \
|
||||
|| zfs snapshot rpool/local/root@blank
|
||||
'';
|
||||
};
|
||||
"local/nix" = dataset { mountpoint = "/nix"; };
|
||||
"local/home" = dataset {
|
||||
mountpoint = "/home";
|
||||
postCreateHook = ''
|
||||
zfs list -t snapshot -H -o name \
|
||||
| grep -E '^rpool/local/home@blank$' \
|
||||
|| zfs snapshot rpool/local/home@blank
|
||||
'';
|
||||
};
|
||||
"darlings/persist" = dataset { mountpoint = "/persist"; };
|
||||
"darlings/home" = dataset {
|
||||
mountpoint = "/persist/home";
|
||||
};
|
||||
"reserved" = dataset {
|
||||
options = {
|
||||
canmount = "off";
|
||||
mountpoint = "none";
|
||||
reservation = "5GiB";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user